private string UpdateCustomerRecord(JToken amCustomers_Result, string suiteConstactId, string logId) { try { if (amCustomers_Result != null && suiteConstactId != null) { var suiteWrapper = new SuiteWrapper(); suitesessionId = suiteWrapper.Login().GetAwaiter().GetResult(); var contactrequest = new CreateContactRequest { Email = Convert.ToString(amCustomers_Result.SelectToken("preferred_email")), Phone = Convert.ToString(amCustomers_Result.SelectToken("phone_number")), FirstName = Convert.ToString(amCustomers_Result.SelectToken("given_name")), LastName = Convert.ToString(amCustomers_Result.SelectToken("family_name")), Salutation = Convert.ToString(amCustomers_Result.SelectToken("title")), Fax = Convert.ToString(amCustomers_Result.SelectToken("fax_number")), Comments = Convert.ToString(amCustomers_Result.SelectToken("notes")), ContactType = "Individual", CompanyName = Convert.ToString(amCustomers_Result.SelectToken("company_name")), AMCustomerId = Convert.ToString(amCustomers_Result.SelectToken("row_id")), Approvalestatus = "Pending_Approval", Id = suiteConstactId }; var request = new InsertRequest { SessionId = suitesessionId, ModuleName = "Contacts", Entity = contactrequest }; var resp = suiteWrapper.Update(request).GetAwaiter().GetResult(); common.InsertSuiteAmIntegrationLogDetail(new CreateTraceLogRequest() { Description = "Updated Customer RecordID :" + resp.Id, Name = "InsertSuiteContact", Entity_c = "Customer" }, logId); SuiteWrapper.WriteTraceLog("InsertSuiteContact", "Updated Customer RecordID :" + resp.Id); return(resp.Id); } } catch (Exception ex) { common.InsertSuiteAmIntegrationLogDetail(new CreateTraceLogRequest() { Description = "Error : " + ex.Message, Name = "InsertSuiteContact", Entity_c = "Customer" }, logId); SuiteWrapper.WriteTraceLog("InsertSuiteContact", "Error : " + ex.Message); } return(""); }
private string UpdateSuiteRegistration(CreateRegistrationRequest registerRequest, string logId) { var suiteWrapper = new SuiteWrapper(); suitesessionId = suiteWrapper.Login().GetAwaiter().GetResult(); var request = new InsertRequest(); request.SessionId = suitesessionId; request.ModuleName = "reg_Registration"; request.Entity = registerRequest; var resp = suiteWrapper.Update(request).GetAwaiter().GetResult(); common.InsertSuiteAmIntegrationLogDetail(new CreateTraceLogRequest() { Description = "Updated Suite Registration successfully Id: " + resp.Id, Name = "UpdateSuiteRegistration", Entity_c = "Registration" }, logId); SuiteWrapper.WriteTraceLog("UpdateSuiteRegistration", "Updated Suite Registration successfully Id: " + resp.Id); return(resp.Id); }