Exemplo n.º 1
0
        protected void lBtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                bool status = false;
                lbMsg.Text = string.Empty;
                AdvanceListMaster listMaster = new AdvanceListMaster(ConnectionString);
                listMaster.ListName = txtListName.Text;
                listMaster.ListDesc = txtListDescription.Text;
                listMaster.ListCowner = txtListCreationowner.Text;

                AdvanceListMasters listNames = AdvanceListMaster.SelectByField("ListName", txtListName.Text.Trim(), ConnectionString);
                if (listNames.Count > 0)
                {
                    throw new Exception(string.Format("List: {0},  already exists. Please enter other name.", txtListName.Text));
                }
                listMaster.CreatedDate = System.DateTime.Now;
                status = listMaster.Insert();
                string lbl = "";
                lbl = txtListName.Text;
                if (txtListName.Text.Contains(""")) { lbl = Server.HtmlEncode(txtListName.Text); }
                if (status == true)
                {
                    lblMsg.ForeColor = System.Drawing.Color.Green;
                    lblMsg.Text = string.Format("List: {0} Created Successfully.", lbl);
                }
                else
                {
                    lblMsg.Text = string.Format("List: {0} Created Failed.", lbl);
                }
                upnlMainmsg.Update();
            }
            catch (Exception ex)
            {
                lbMsg.Text = "Error: " + ex.Message;
                ModalPopupExtenderlist.Show();
            }
        }