Example #1
0
        protected void btnClick_btnUpdateUnit(object sender, EventArgs e)
        {
            productdata      = new ProductData();
            product          = new Product();
            product.UnitID   = string.IsNullOrEmpty(hfTypeID.Value) ? 0 : Convert.ToInt32(hfTypeID.Value);
            product.UnitName = string.IsNullOrEmpty(txtUnit.Text.ToString()) ? string.Empty : Convert.ToString(txtUnit.Text);

            if (dpIsActive.SelectedItem.Value == "1")
            {
                product.IsActive = false;
            }
            if (dpIsActive.SelectedItem.Value == "2")
            {
                product.IsActive = true;
            }
            product.flag = "Update";
            int Result = 0;

            Result = productdata.AddUnitInfo(product);
            if (Result > 0)
            {
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Unit Updated  Successfully";

                ClearTextBox();
                BindUnitInfo();
                pnlError.Update();
                upMain.Update();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }