protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { Response.Redirect("Login.aspx"); } if (!IsPostBack) { busThick buscat = new busThick(); DataTable dt = new DataTable("User"); dt = buscat.allCategories(); GridView1.DataSource = dt; GridView1.DataBind(); } }
private bool isUserExisting() { string userid = this.txtCategory.Text; busThick buscat = new busThick(); FrameWork.Thick frmcat = new FrameWork.Thick(); frmcat = buscat.isUserExisting(userid); //FrameWork.Employees log = busemp.isUserExisting(userid); if (frmcat == null) { return false; } else if (userid.Equals(frmcat.Thickness)) { return true; } else { return false; } }
protected void btnSave_Click(object sender, EventArgs e) { busThick buscat = new busThick(); FrameWork.Thick frmcat = new FrameWork.Thick(); frmcat.Thickness = this.txtCategory.Text; isExisting = isUserExisting(); if (isExisting.Equals(true)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Width existing')", true); } else { buscat.insertCategory(frmcat); } DataTable dt = new DataTable("User"); dt = buscat.allCategories(); GridView1.DataSource = dt; GridView1.DataBind(); }