public FrameWork.Length isUserExisting(string Category) { DataTable dt = new DataTable("Length"); dt.Clear(); string query = "SELECT * FROM Length where Lengths='" + Category + "'"; dt = DataAccess.DBAdapter.GetRecordSet(query); FrameWork.Length log = null; if (dt.Rows.Count > 0) { log = new FrameWork.Length(dt.Rows[0]); } return log; }
private bool isUserExisting() { string userid = this.txtCategory.Text; busLength buscat = new busLength(); FrameWork.Length frmcat = new FrameWork.Length(); frmcat = buscat.isUserExisting(userid); //FrameWork.Employees log = busemp.isUserExisting(userid); if (frmcat == null) { return false; } else if (userid.Equals(frmcat.Lengths)) { return true; } else { return false; } }
protected void btnSave_Click(object sender, EventArgs e) { busLength buscat = new busLength(); FrameWork.Length frmcat = new FrameWork.Length(); frmcat.Lengths = this.txtCategory.Text; isExisting = isUserExisting(); if (isExisting.Equals(true)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Length existing')", true); } else { buscat.insertCategory(frmcat); } DataTable dt = new DataTable("User"); dt = buscat.allCategories(); GridView1.DataSource = dt; GridView1.DataBind(); }