Example #1
0
        protected void BtnOk_Click(object sender, EventArgs e)
        {
            busProducts busProd = new busProducts();
            FrameWork.Products frmProd = new FrameWork.Products();
            frmProd.ProductName = this.txtProdName.Text;
            frmProd.ProductCode = this.txtCode.Text;
            frmProd.Description = this.txtProdDescription.Text;
            frmProd.CategoryID = int.Parse(this.drpCategory.SelectedValue);
            frmProd.ProductSizeID = int.Parse(this.drpSize.SelectedValue);
            frmProd.UnitOfMeasureID = int.Parse(this.drpUOM.SelectedValue);
            isExisting = isUserExisting();
            if (isExisting.Equals(true))
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Product already Exists')", true);
            }
            else
            {

                string x = busProd.insertProducts(frmProd);

                if (x.Trim() == string.Empty)
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Successfully added new Product')", true);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Failed to added new Product')", true);
                }
            }
            DataTable dt = new DataTable("User");
            dt = busProd.allProducts();
            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
Example #2
0
 protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     DataTable dt = new DataTable("User");
     busProducts busProd = new busProducts();
     this.GridView1.PageIndex = e.NewPageIndex;
     dt = new DataTable("User");
     dt = busProd.allProducts();
     GridView1.DataSource = dt;
     GridView1.DataBind();
 }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            if (!IsPostBack)
            {
                busUnitOfMeasure busuom = new busUnitOfMeasure();
                DataTable dt = new DataTable("User");
                dt = busuom.allUOM();
                this.drpUOM.Items.Clear();
                this.drpUOM.Items.Add(new ListItem("select one", "0"));
                foreach (DataRow dr in dt.Rows)
                {
                    this.drpUOM.Items.Add(new ListItem(dr["UnitOfMeasure"].ToString(), dr["ID"].ToString()));
                }
                busSizes bussize = new busSizes();

                dt = bussize.allSize();
                this.drpSize.Items.Clear();
                this.drpSize.Items.Add(new ListItem("select one", "0"));
                foreach (DataRow dr in dt.Rows)
                {
                    this.drpSize.Items.Add(new ListItem(dr["ProductSize"].ToString(), dr["ID"].ToString()));
                }
                busCategories buscat = new busCategories();

                dt = buscat.allCategories();
                this.drpCategory.Items.Clear();
                this.drpCategory.Items.Add(new ListItem("select one", "0"));
                foreach (DataRow dr in dt.Rows)
                {
                    this.drpCategory.Items.Add(new ListItem(dr["Category"].ToString(), dr["ID"].ToString()));
                }
                busProducts busProd = new busProducts();
                dt = new DataTable("User");
                dt = busProd.allProducts();
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = new DataTable("Products");
                busProducts busProd = new busProducts();
                dt = new DataTable("Products");
                dt = busProd.allProducts();
                ViewState["Products"] = dt;
                this.ddpProduct.Items.Clear();
                this.ddpProduct.Items.Add(new ListItem("select one", "0"));
                foreach (DataRow dr in dt.Rows)
                {
                    this.ddpProduct.Items.Add(new ListItem(dr["ProductName"].ToString(), dr["ID"].ToString()));
                }
                //this.drpFeeds.Items.Clear();
                //this.drpFeeds.Items.Add(new ListItem("select one", "0"));
                //foreach (DataRow dr in dt.Rows)
                //{
                //    this.drpFeeds.Items.Add(new ListItem(dr["ProductName"].ToString(), dr["ID"].ToString()));
                //}

            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = new DataTable("User");
                busProducts busProd = new busProducts();
                dt = new DataTable("User");
                dt = busProd.allProducts();
                ViewState["Products"] = dt;
                this.drpProduct.Items.Clear();
                this.drpProduct.Items.Add(new ListItem("Select One", "0"));
                foreach (DataRow dr in dt.Rows)
                {
                    this.drpProduct.Items.Add(new ListItem(dr["ProductName"].ToString(), dr["ID"].ToString()));
                }

                busSupplier busSup = new busSupplier();
                dt = busSup.allSupplier();
                ViewState["Supplier"] = dt;
                this.drpSupplier.Items.Clear();
                this.drpSupplier.Items.Add(new ListItem("Select One", "0"));
                foreach (DataRow dr in dt.Rows)
                {
                    this.drpSupplier.Items.Add(new ListItem(dr["Company"].ToString(), dr["ID"].ToString()));
                }
            }
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["user"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            if (!IsPostBack)
            {
                busCustomer buscust = new busCustomer();

                DataTable dt = new DataTable("User");
                dt = buscust.allCustomer();
                ViewState["Customer"] = dt;
                this.drpCustomer.Items.Clear();
                this.drpCustomer.Items.Add(new ListItem("select one", "0"));
                foreach (DataRow dr in dt.Rows)
                {
                    this.drpCustomer.Items.Add(new ListItem(dr["Company"].ToString(), dr["ID"].ToString()));
                }
                busProducts busProd = new busProducts();
                dt = new DataTable("User");
                dt = busProd.allProducts();
                ViewState["Products"] = dt;
                this.drpProduct.Items.Clear();
                this.drpProduct.Items.Add(new ListItem("select one", "0"));
                foreach (DataRow dr in dt.Rows)
                {
                    this.drpProduct.Items.Add(new ListItem(dr["ProductName"].ToString(), dr["ID"].ToString()));
                }
            }
        }
Example #7
0
 private bool isUserExisting()
 {
     string userid = this.txtProdName.Text;
     busProducts busprod = new busProducts();
     FrameWork.Products frmprod = new FrameWork.Products();
     frmprod = busprod.isUserExisting(userid);
     //FrameWork.Employees log = busemp.isUserExisting(userid);
     if (frmprod == null)
     {
         return false;
     }
     else if (userid.Equals(frmprod.ProductName))
     {
         return true;
     }
     else
     {
         return false;
     }
 }