Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.37 KB | None | 0 0
  1. public bool CreateEvent(Operations operation)
  2.         {
  3.             try
  4.             {
  5.                 if (operation == null)
  6.                     return false;
  7.  
  8.                 user = (Users)Session["CurrentUser"];
  9.                 var contentResources = services.ApiResult(user, Constants.RscService);
  10.                 var resource = ResourceData(contentResources, operation.Resources.ResourceID);
  11.  
  12.                 EpicorRest.AppPoolHost = ConfigurationManager.AppSettings["EpicorRest.AppPoolHos"];
  13.                 EpicorRest.AppPoolInstance = ConfigurationManager.AppSettings["EpicorRest.AppPoolInstance"];
  14.                 EpicorRest.UserName = user.UserLogin;
  15.                 EpicorRest.Password = user.Password;
  16.                 EpicorRest.IgnoreCertErrors = true;
  17.  
  18.                 EpicorRest.CallSettings = new CallSettings(operation.CompanyID, string.Empty, string.Empty, string.Empty);
  19.  
  20.                 dynamic UDRecord = new
  21.                 {
  22.                     Company = operation.CompanyID,
  23.                     Key1 = Guid.NewGuid().ToString(),
  24.                     Key2 = "",
  25.                     Key3 = "",
  26.                     Key4 = "",
  27.                     Key5 = "",
  28.                     Address1_c = operation.ShipAddress1,
  29.                     Address2_c = operation.ShipAddress2,
  30.                     Comment_c = operation.SchedComment,
  31.                     CustName_c = operation.CustName,
  32.                     Email_c = operation.CustEmail,
  33.                     PhoneNum_c = operation.CustPhoneNum,
  34.                     StartDate_c = operation.StartOperationDate,
  35.                     EndDate_c = operation.EndOperationDate,
  36.                     JobNum_c = operation.JobNum,
  37.                     Operation_c = operation.OpCode,
  38.                     Resource_c = operation.Resources.ResourceID,
  39.                     ResourceGroup_c = resource.GroupID,
  40.                     ShipToCity_c = operation.ShipCity,
  41.                     ShipToState_c = operation.ShipState,
  42.                     ShipToZIP_c = operation.ShipZip,
  43.                     Part_c = operation.PartNum,
  44.                     RowMod = "U"
  45.                 };
  46.                 EpicorRest.PostUDRecord("UD20", UDRecord);
  47.  
  48.                 return true;
  49.             }
  50.             catch (Exception ex)
  51.             {
  52.                 string errorMessage = ex.Message;
  53.                 return false;
  54.             }
  55.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement