public XmlDocument AddRecipientWithListIDs(string UserID, string Password, string ListIds, long contactID) { try { StringBuilder str = new StringBuilder(); str.Append("<RecipientInfo>"); string Con = GetConnectionString(UserID, Password); LogStartInfo("AddRecipientWithListIDs", Con, UserID); if (Con.Trim().Length != 0 && ListIds.Trim().Length != 0 && Convert.ToInt64(contactID) != 0) { String[] list; list = ListIds.Split(','); ListContactMasters listContMastersContacts = ListContactMaster.SelectByField("ContactId", contactID, Con); for (int k = 0; k < list.Length; k++) { ListContactMasters listContactMaster = ListContactMaster.SelectAllByListIDAndContactID(Convert.ToInt64(list[k].ToString()), contactID, Con); ListContactMaster listContMaster = new ListContactMaster(Con); listContMaster.ContactId = contactID; listContMaster.IsActive = true; listContMaster.ListMasterID = Convert.ToInt64(list[k].ToString()); if (listContactMaster.Count > 0) { } else { bool statusInsert = listContMaster.Insert(); str.Append("<Message>Recipient inserted Successfully</Message>"); Logger.logdata(logforRpService, "Recipient inserted Successfully"); } } } else { str.Append("<Message>Please Enter Valid Inputs</Message>"); Logger.logdata(logforRpService, "Please Enter Valid Inputs"); } LogEndInfo("AddRecipientWithListIDs"); str.Append("</RecipientInfo>"); doc.LoadXml(str.ToString()); } catch (Exception ex) { Logger.logError(logforRpService, ex); } return doc; }
public XmlDocument AddRecipientWithListIDs(string UserID, string Password, string ListIds, long contactID) { XmlDocument doc = new System.Xml.XmlDocument(); StringBuilder str = new StringBuilder(); str.Append("<RecipientInfo>"); string Con = GetConnectionString(UserID, Password); if (Con.Trim().Length != 0 && ListIds.Trim().Length != 0 && Convert.ToInt64(contactID) != 0) { String[] list; list = ListIds.Split(','); ListContactMasters listContMastersContacts = ListContactMaster.SelectByField("ContactId", contactID, Con); for (int k = 0; k < list.Length; k++) { ListContactMasters listContactMaster = ListContactMaster.SelectAllByListIDAndContactID(Convert.ToInt64(list[k].ToString()), contactID, Con); ListContactMaster listContMaster = new ListContactMaster(Con); listContMaster.ContactId = contactID; listContMaster.ListMasterID = Convert.ToInt64(list[k].ToString()); if (listContactMaster.Count > 0) { } else { bool statusInsert = listContMaster.Insert(); str.Append("<Message>Recipient inserted Successfully</Message>"); } } } else { str.Append("<Message>Please Enter Valid Inputs</Message>"); } str.Append("</RecipientInfo>"); doc.LoadXml(str.ToString()); return doc; }