protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { Response.Redirect("Login.aspx"); } if (!IsPostBack) { busSizes bussize = new busSizes(); DataTable dt = new DataTable("User"); dt = bussize.allSize(); GridView1.DataSource = dt; GridView1.DataBind(); } }
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(); } }
private bool isUserExisting() { string userid = this.txtSizes.Text; busSizes bussize = new busSizes(); FrameWork.Sizes frmcat = new FrameWork.Sizes(); frmcat = bussize.isUserExisting(userid); //FrameWork.Employees log = busemp.isUserExisting(userid); if (frmcat == null) { return false; } else if (userid.Equals(frmcat.ProductSize)) { return true; } else { return false; } }
protected void btnSave_Click(object sender, EventArgs e) { busSizes bussize = new busSizes(); FrameWork.Sizes frmcat = new FrameWork.Sizes(); frmcat.ProductSize = this.txtSizes.Text; isExisting = isUserExisting(); if (isExisting.Equals(true)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Size existing')", true); } else { bussize.insertSizes(frmcat); } DataTable dt = new DataTable("User"); dt = bussize.allSize (); GridView1.DataSource = dt; GridView1.DataBind(); }