Esempio n. 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         LPS.ProductCategory productcategory = new LPS.ProductCategory();
         productcategory.Active         = chkPCActive.Checked;
         productcategory.ProductCatName = txtPCName.Value.Trim();
         db.ProductCategories.Add(productcategory);
         db.SaveChanges();
         LoadData();
     }
     catch (Exception ex)
     {
     }
 }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                LPS.ProductCategory productcategory = new LPS.ProductCategory();
                productcategory.Active = chkPCActive.Checked;
                productcategory.ProductCatName = txtPCName.Value.Trim();
                db.ProductCategories.Add(productcategory);
                db.SaveChanges();
                LoadData();
            }
            catch (Exception ex)
            {

            }
        }
Esempio n. 3
0
        protected void gvListItem_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int         id       = Int32.Parse(e.CommandArgument.ToString());
            GridViewRow row      = (GridViewRow)(((Button)e.CommandSource).NamingContainer);
            Label       lblTitle = (Label)row.Cells[1].FindControl("lblName");



            if (e.CommandName.ToLower() == "deleteitem")
            {
                LPS.ProductCategory productcategory = db.ProductCategories.Find(id);
                db.ProductCategories.Remove(productcategory);
                db.SaveChanges();
                LoadData();
            }
        }
Esempio n. 4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                int Id = Int32.Parse(CatID.Value);
                LPS.ProductCategory productcategory = new LPS.ProductCategory();
                productcategory                = db.ProductCategories.FirstOrDefault(x => x.ProductCatID == Id);
                productcategory.Active         = chkPCActive.Checked;
                productcategory.ProductCatName = txtPCName.Value.Trim();

                db.SaveChanges();
                LoadData();
            }
            catch (Exception ex)
            {
            }
        }
Esempio n. 5
0
        private void LoadData()
        {
            if (!comClass.IsNumeric(Request.QueryString.Get("Id")))
            {
                Response.Redirect(BackUrl.Value);
            }
            else
            {
                int Id = Int32.Parse(Request.QueryString.Get("Id"));
                LPS.ProductCategory cat = new LPS.ProductCategory();
                cat = db.ProductCategories.FirstOrDefault(x => x.ProductCatID == Id);

                CatID.Value         = cat.ProductCatID.ToString();
                txtPCName.Value     = cat.ProductCatName;
                chkPCActive.Checked = cat.Active;
            }
        }