Exemplo n.º 1
0
        public static void FillDropDownListContactCategory(DropDownList ddl)
        {
            ContactCategoryBAL balContactCategory = new ContactCategoryBAL();

            ddl.DataSource     = balContactCategory.SelectForDropdownList();
            ddl.DataValueField = "ContactCategoryID";
            ddl.DataTextField  = "ContactCategoryName";
            ddl.DataBind();
            ddl.Items.Insert(0, new ListItem("Select Item", "-1"));
        }
        private void FillGridViewContactCategory()
        {
            ContactCategoryBAL balContactCategory = new ContactCategoryBAL();
            DataTable          dtContactCategory  = new DataTable();

            dtContactCategory = balContactCategory.SelectAll();
            if (dtContactCategory != null && dtContactCategory.Rows.Count > 0)
            {
                gvContactCategoryList.DataSource = dtContactCategory;
                gvContactCategoryList.DataBind();
            }
        }
Exemplo n.º 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            #region Server Side Validation

            lblError.Text = "";
            if (txtContactCategoryName.Text.Trim().ToUpper() == "")
            {
                lblError.Text += "Enter ContactCategory Name <br/>";
            }

            if (lblError.Text != "")
            {
                return;
            }
            #endregion Server Side Validation

            #region Collecting Data
            ContactCategoryENT entContactCategory = new ContactCategoryENT();
            if (txtContactCategoryName.Text.Trim().ToUpper() != "")
            {
                entContactCategory.ContactCategoryName = txtContactCategoryName.Text.Trim().ToUpper();
            }
            ContactCategoryBAL balContactCategory = new ContactCategoryBAL();
            #endregion Collecting Data
            if (Request.QueryString["ContactCategoryID"] == null)
            {
                #region insertingData
                if (balContactCategory.Insert(entContactCategory))
                {
                    Response.Redirect("~/AdminPanel/ContactCategory/ContactCategoryList.aspx");
                }
                else
                {
                    lblError.Text = balContactCategory.Message;
                }
                #endregion insertingData
            }
            else
            {
                #region updatingData
                entContactCategory.ContactCategoryID = Convert.ToInt32(Request.QueryString["ContactCategoryID"]);
                if (balContactCategory.Update(entContactCategory))
                {
                    Response.Redirect("~/AdminPanel/ContactCategory/ContactCategoryList.aspx");
                }
                else
                {
                    lblError.Text = balContactCategory.Message;
                }
                #endregion updatingData
            }
        }
 protected void gvContactCategoryList_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandArgument != null)
     {
         ContactCategoryBAL balContactCategory = new ContactCategoryBAL();
         if (balContactCategory.Delete(Convert.ToInt32(e.CommandArgument.ToString().Trim())))
         {
             Response.Redirect("~/Adminpanel/ContactCategory/ContactCategoryList.aspx");
             lblError.Text = "";
         }
         else
         {
             lblError.Text = balContactCategory.Message;
         }
     }
 }
Exemplo n.º 5
0
        private void fillControls(SqlInt32 ContactCategoryID)
        {
            ContactCategoryENT entContactCategory = new ContactCategoryENT();
            ContactCategoryBAL balContactCategory = new ContactCategoryBAL();

            entContactCategory = balContactCategory.SelectByPK(ContactCategoryID);
            if (entContactCategory != null)
            {
                if (!entContactCategory.ContactCategoryName.IsNull)
                {
                    txtContactCategoryName.Text = entContactCategory.ContactCategoryName.Value.ToString();
                }
            }
            else
            {
                lblError.Text = balContactCategory.Message;
            }
        }