private int CheckForRegistrationAvailalibilityForContact(string registrationId, string clientId, string logId) { var suiteWrapper = new SuiteWrapper(); suitesessionId = suiteWrapper.Login().GetAwaiter().GetResult(); GetRelationshipsRequest request = new GetRelationshipsRequest { session = suitesessionId, module_id = registrationId, module_name = "reg_Registration", link_field_name = "contacts_reg_registration_1", related_fields = new List <string>() { "id" }, related_module_query = $"contacts_reg_registration_1contacts_ida='{clientId}'" }; try { var registration_List = suiteWrapper.GetRelationship <GetRelationshipsResponse>(request).GetAwaiter().GetResult(); return(registration_List.SugarEntryList.Count()); } catch (Exception ex) { SuiteWrapper.WriteTraceLog("GetSuiteAddress", "Error : " + ex.Message); common.InsertSuiteAmIntegrationLogDetail(new CreateTraceLogRequest() { Description = "Error : " + ex.Message, Name = "GetSuiteAddress", Entity_c = "Customer" }, logId); } return(-1); }
private int GetSuiteAddressCount(string ContactId, string LogId) { var suiteWrapper = new SuiteWrapper(); suitesessionId = suiteWrapper.Login().GetAwaiter().GetResult(); GetRelationshipsRequest request = new GetRelationshipsRequest { session = suitesessionId, module_id = ContactId, module_name = "Contacts", link_field_name = "contacts_add1_addresses_1", related_fields = new List <string>() { "id" } }; try { var suiteAddress = suiteWrapper.GetRelationship <GetRelationshipsResponse>(request).GetAwaiter().GetResult(); return(suiteAddress.SugarEntryList.Count()); } catch (Exception ex) { SuiteWrapper.WriteTraceLog("GetSuiteAddress", "Error : " + ex.Message); common.InsertSuiteAmIntegrationLogDetail(new CreateTraceLogRequest() { Description = "Error : " + ex.Message, Name = "GetSuiteAddress", Entity_c = "Customer" }, LogId); } return(-1); }