Exemple #1
0
        private void ProcessRequests(Guid portalId)
        {
            MsCrmResultObject resultRequestList = GiftHelper.GetGiftReuqestListByStatus(portalId, GiftStatus.Confirmed, _sda);

            if (resultRequestList.Success)
            {
                try
                {
                    List <UserGiftRequest> lstRequests = resultRequestList.GetReturnObject <List <UserGiftRequest> >();

                    FileLogHelper.LogFunction(this.GetType().Name, "RequestCount:" + lstRequests.Count.ToString(), @Globals.FileLogPath);

                    foreach (UserGiftRequest req in lstRequests)
                    {
                        MsCrmResult result = SendToServiceBirIleri(req);

                        if (result.Success)
                        {
                            req.OrderCode = result.Result;
                            req.Status    = new OptionSetValueWrapper()
                            {
                                AttributeValue = (int)GiftStatus.ServiceSent
                            };
                        }
                        else
                        {
                            req.ErrorDesc = result.Result;
                            req.Status    = new OptionSetValueWrapper()
                            {
                                AttributeValue = (int)GiftStatus.ServiceError
                            };

                            FileLogHelper.LogFunction(this.GetType().Name, "SendToService::" + result.Result, @Globals.FileLogPath);
                        }

                        GiftHelper.UpdateGiftRequest(req, _service);
                    }
                }
                catch (Exception ex)
                {
                    FileLogHelper.LogFunction(this.GetType().Name, ex.Message, @Globals.FileLogPath);
                }
            }
            else
            {
                FileLogHelper.LogFunction(this.GetType().Name, resultRequestList.Result, @Globals.FileLogPath);
            }
        }