Beispiel #1
0
        protected void btnClick_btnAddProducrID(object sender, EventArgs e)
        {
            productdata         = new ProductData();
            product             = new Product();
            product.ProductID   = 0;
            product.ProductName = txtProductName.Text;
            product.ProductCode = "A123";

            product.TypeID      = string.IsNullOrEmpty(dpType.SelectedItem.ToString()) ? 0 : Convert.ToInt32(dpType.SelectedValue);
            product.CommodityID = string.IsNullOrEmpty(dpCommodity.SelectedItem.ToString()) ? 0 : Convert.ToInt32(dpCommodity.SelectedValue);
            product.BrandID     = string.IsNullOrEmpty(dpBrand.SelectedItem.ToString()) ? 0 : Convert.ToInt32(dpBrand.SelectedValue);
            product.State       = Convert.ToString(dpState.SelectedValue);
            product.SlabID      = string.IsNullOrEmpty(dpSlab.SelectedItem.ToString()) ? 0 : Convert.ToInt32(dpSlab.SelectedValue);


            product.Quantity = string.IsNullOrEmpty(txtQuantity.Text.ToString()) ? 0.0 : Convert.ToDouble(txtQuantity.Text);

            product.UnitID       = string.IsNullOrEmpty(dpUnit.SelectedItem.ToString()) ? 0 : Convert.ToInt32(dpUnit.SelectedValue);
            product.TypeID       = string.IsNullOrEmpty(dpType.SelectedItem.ToString()) ? 0 : Convert.ToInt32(dpType.SelectedValue);
            product.Prize        = string.IsNullOrEmpty(txtPrize.Text.ToString()) ? 0.0 : Convert.ToDouble(txtPrize.Text);
            product.SlabCode     = "";
            product.CreatedBy    = GlobalInfo.Userid;
            product.Createddate  = DateTime.Now.ToString("dd-MM-yyyy");
            product.ModifiedBy   = GlobalInfo.Userid;
            product.ModifiedDate = DateTime.Now.ToString("dd-MM-yyyy");
            product.flag         = "Insert";
            int Result = 0;

            Result = productdata.AddProductInfo(product);



            if (Result > 0)
            {
                // txtProductName.ReadOnly = true;

                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Product Add  Successfully";
                clearText();
                BindProduct();
                btnupdateProduct.Visible = false;
                btnAddProduct.Visible    = true;
                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();
            }
        }