コード例 #1
0
ファイル: QMHelper.cs プロジェクト: santhign/Grid
        public async Task <int> FinalBuddyProcessing()
        {
            try
            {
                BSSAPIHelper bsshelper = new BSSAPIHelper();

                OrderDataAccess _orderAccess = new OrderDataAccess(_iconfiguration);

                DatabaseResponse configResponse = await _orderAccess.GetConfiguration(ConfiType.BSS.ToString());

                GridBSSConfi config = bsshelper.GetGridConfig((List <Dictionary <string, string> >)configResponse.Results);

                DatabaseResponse serviceCAF = await _orderAccess.GetBSSServiceCategoryAndFee(ServiceTypes.Free.ToString());

                try
                {
                    foreach (BuddyCheckList b in buddyActionList)
                    {
                        int process = await  ProcessBuddy(b, config, (((List <ServiceFees>)serviceCAF.Results)).FirstOrDefault().ServiceCode);
                    }

                    List <BuddyCheckList> unProcessedBuddies = buddyActionList.Where(b => b.IsProcessed == false).ToList();

                    if (unProcessedBuddies != null && unProcessedBuddies.Count > 0)
                    {
                        foreach (BuddyCheckList upBuddy in unProcessedBuddies)
                        {
                            DatabaseResponse upBuddyCreateResponse = await _orderAccess.CreatePendingBuddyList(upBuddy);
                        }

                        return(0);
                    }
                    else
                    {
                        ProcessOrderQueueMessage(buddyActionList[0].OrderID);

                        return(1);
                    }
                }

                catch (Exception ex)
                {
                    LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));

                    return(0);
                }
            }
            catch (Exception ex)
            {
                LogInfo.Error(new ExceptionHelper().GetLogString(ex, ErrorLevel.Critical));
                return(0);
            }
        }