protected void DeleteLinkButton_Click(object sender, EventArgs e) { contactID = Convert.ToInt32(Session["EditContactID"]); ContactBL contactBL = new ContactBL(); contactBL.DeleteContactByID(contactID); this.ContactGridView.DataBind(); this.ContactGridView.SelectedIndex = -1; this.MiniContactFormView.DataBind(); this.MiniContactDetailsView.DataBind(); ContactListUpdatePanel.Update(); MiniDetailsUpdatePanel.Update(); EditLinkButton.Visible = false; DeleteLinkButton.Visible = false; MeetingSummaryLinkButton.Visible = false; NotifyLinkButton.Visible = false; Session["EditContactID"] = 0; Session.Remove("ContactName"); Session.Remove("AssignedTo"); Session.Remove("ReceiverName"); Session.Remove("ReceiverEmail"); Session.Remove("NotifyUser"); Session.Remove("ContactAccountID"); Session.Remove("ContactName"); }
protected void IssueLinkButton_Click(object sender, EventArgs e) { string email = String.Empty; string contactName = String.Empty; string targetid = String.Empty; foreach (GridViewRow row in ContactGridView.Rows) { if ((row.FindControl("ContactCheckBox") as CheckBox).Checked) { var dataKey = ContactGridView.DataKeys[row.RowIndex]; if (dataKey != null) { ContactBL contactBL = new ContactBL(); long contactID = Convert.ToInt64(dataKey.Value); IEnumerable<DAL.Contact> contacts = contactBL.GetContactByID(contactID); foreach (var contact in contacts) { if (contact.PrimaryEmail != null) { string emailaddress = contact.PrimaryEmail.ToString(); if (emailaddress != null) { Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"); Match match = regex.Match(emailaddress); if (match.Success) { email += emailaddress + ";"; targetid += contactID.ToString(CultureInfo.InvariantCulture) + ";"; contactName += contact.FirstName.ToString() + ", "; } } } } } } } Session["targetID"] = targetid.TrimEnd(';'); Session["toUser"] = email; TextBox ContactName = CampaignTargetDetailsView.FindControl("TargetTextBox") as TextBox; ContactName.Text = contactName; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "script", "CloseModals(['BodyContent_TargetListModalPanel']);", true); }