protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { Response.Redirect("Login.aspx"); } if (!IsPostBack) { busUnitOfMeasure buscat = new busUnitOfMeasure(); DataTable dt = new DataTable("User"); dt = buscat.allUOM(); 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.txtUOM.Text; busUnitOfMeasure buscat = new busUnitOfMeasure(); FrameWork.UnitOfMeasures frmcat = new FrameWork.UnitOfMeasures(); frmcat = buscat.isUserExisting(userid); //FrameWork.Employees log = busemp.isUserExisting(userid); if (frmcat == null) { return(false); } else if (userid.Equals(frmcat.UnitOfMeasure)) { return(true); } else { return(false); } }
protected void btnSave_Click(object sender, EventArgs e) { busUnitOfMeasure busuom = new busUnitOfMeasure(); FrameWork.UnitOfMeasures frmcat = new FrameWork.UnitOfMeasures(); frmcat.UnitOfMeasure = this.txtUOM.Text; isExisting = isUserExisting(); if (isExisting.Equals(true)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Unit Of Measure existing')", true); } else { busuom.insertMeasures(frmcat); } DataTable dt = new DataTable("User"); dt = busuom.allUOM(); GridView1.DataSource = dt; GridView1.DataBind(); }