Beispiel #1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDelete_Click(object sender, ImageClickEventArgs e)
    {
        if ((EViewType)ViewState["ViewType"] == EViewType.BUSINESSCARD)
        {
            foreach (string str in hfdlcontact.Value.Split(new char[] { ',' }))
            {
                Int32 contactid = 0;
                if (Int32.TryParse(str.Trim(), out contactid))
                {
                    var franchisorDal = new FranchisorDAL();
                    franchisorDal.RemoveContact(contactid, 0);
                }
            }
            hfdlcontact.Value = "";
        }
        else
        {
            for (int i = 0; i < grdContacts.Rows.Count; i++)
            {
                var chkRowTemp = (HtmlInputCheckBox)grdContacts.Rows[i].FindControl("chkRowChild");

                if (chkRowTemp.Checked)
                {
                    Int32 contactid     = Convert.ToInt32(grdContacts.DataKeys[i].Value);
                    var   franchisorDal = new FranchisorDAL();
                    franchisorDal.RemoveContact(contactid, 0);
                }
            }
        }
        divErrorMsg.Visible   = true;
        divErrorMsg.InnerText = "Contact(s) deleted successfully.";
        GetAllContacts();
    }