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); } }
public GiftServiceResult Post(GiftUpdateInfo val) { GiftServiceResult returnValue = new GiftServiceResult(); if (string.IsNullOrWhiteSpace(val.api_key) || string.IsNullOrWhiteSpace(val.id)) { returnValue.message = "Failure"; return(returnValue); } if (val.api_key != "6r9ZTok8zp4yZxKq") { returnValue.message = "Not authorized"; return(returnValue); } try { IOrganizationService service = MSCRM.GetOrgService(true); UserGiftRequest request = new UserGiftRequest(); request.Id = new Guid(val.id); request.ShippingCompany = val.shipping_company; request.ShippingNo = val.shipping_no; request.Note = val.note; request.ServiceStatus = val.status; GiftHelper.UpdateGiftRequest(request, service); returnValue.message = "Success"; } catch (Exception ex) { returnValue.message = "Failure | Ex:" + ex.Message; } return(returnValue); }