public void checklistupdate() { try { ListContactMasters listContMastersContacts = ListContactMaster.SelectByField("ContactId", contactID, connectionString); ListContactMasters listContactMaster = ListContactMaster.SelectAllByListIDAndContactID(Convert.ToInt64(listId.ToString()), contactID, connectionString); ListContactMaster listContMaster = new ListContactMaster(connectionString); listContMaster.ContactId = contactID; listContMaster.ListMasterID = Convert.ToInt64(listId.ToString()); listContMaster.CreatedDate = DateTime.Now; listContMaster.IsActive = true; if (listContactMaster.Count > 0) { } else { bool statusInsert = listContMaster.InsertWithActiveStatus(); } } catch (Exception ex) { throw ex; } }
public void checklistupdate() { try { ListContactMasters listContMastersContacts = ListContactMaster.SelectByField("ContactId", contactID, ConnectionString); //Modified By Anwar Jan17 2012 List<int> removelist = new List<int>(); for (int j = 0; j < listContMastersContacts.Count; j++) { if (!list.Contains(listContMastersContacts[j].ListMasterID.ToString())) removelist.Add(Convert.ToInt32(listContMastersContacts[j].ListMasterID)); } for (int k = 0; k < removelist.Count; k++) { ListContactMasters listContactMaster = ListContactMaster.SelectAllByListIDAndContactID(Convert.ToInt64(removelist[k].ToString()), contactID, ConnectionString); ListContactMaster listContMaster = new ListContactMaster(ConnectionString); listContMaster.ListContactId = listContactMaster[0].ListContactId; if (listContactMaster.Count > 0) { bool statusDelete = listContMaster.Delete(); } } for (int k = 0; k < list.Count; k++) { ListContactMasters listContactMaster = ListContactMaster.SelectAllByListIDAndContactID(Convert.ToInt64(list[k].ToString()), contactID, ConnectionString); ListContactMaster listContMaster = new ListContactMaster(ConnectionString); listContMaster.ContactId = contactID; listContMaster.ListMasterID = Convert.ToInt64(list[k].ToString()); listContMaster.CreatedDate = DateTime.Now; listContMaster.IsActive = true; if (listContactMaster.Count > 0) { } else { bool statusInsert = listContMaster.InsertWithActiveStatus(); } } if (!chkIsActive1.Checked && lstBoxListNames.Items.Count > 0) { bool Status = ListContactMaster.ChangeContactStatusByList(contactID, chkIsActive1.Checked, ConnectionString); } binddata(contactID); } catch (Exception ex) { throw ex; } }
protected void LBYes_Click(object sender, EventArgs e) { try { ListContactMasters listContMastersContacts = ListContactMaster.SelectByField("ContactId", Convert.ToInt64(hdEcontactId.Value), ConnectionString); ListContactMasters listContactMaster = ListContactMaster.SelectAllByListIDAndContactID(Convert.ToInt64(hiddenEditID.Value.ToString()), Convert.ToInt64(hdEcontactId.Value), ConnectionString); ListContactMaster listContMaster = new ListContactMaster(ConnectionString); listContMaster.ContactId = Convert.ToInt64(hdEcontactId.Value); listContMaster.ListMasterID = Convert.ToInt64(hiddenEditID.Value.ToString()); listContMaster.CreatedDate = DateTime.Now; listContMaster.IsActive = true; if (listContactMaster.Count > 0) { hdELC.Value = "1"; } else { bool statusInsert = listContMaster.InsertWithActiveStatus(); } if (hdEcontactstatus.Value == "1") { if (hdELC.Value == "1") { statusmessage.Append(string.Format("Contact \"" + txtEmailAddress1.Text + "\" is already exists in this List.")); lbCMsg.Style.Add("color", "Red"); } else { statusmessage.Append(string.Format("Contact \"" + txtEmailAddress1.Text + "\" has been Added successfully in the List.")); lbCMsg.Style.Add("color", "Green"); } lbCMsg.Text = statusmessage.ToString(); lbCMsg.Visible = true; txtContactfirstname.Text = string.Empty; txtContactLastname.Text = string.Empty; txtEmailAddress1.Text = string.Empty; AddContactsPopupExtender.Show(); } else { if (hdELC.Value == "1") { statusmessage.Append(string.Format("Contact \"" + txtEmailAddress1.Text + "\" is already exists in this List.")); lbCMsg.Style.Add("color", "Red"); } else { statusmessage.Append(string.Format("Contact \"" + txtEmailAddress1.Text + "\" has been Added successfully in the List.")); lbCMsg.Style.Add("color", "Green"); } lblMainMsg.Text = statusmessage.ToString(); lblMainMsg.Visible = true; bindGrid("", "ASC", "ListName"); udpnlListGridview.Update(); } } catch (Exception ex) { throw ex; } }