public ThickOfFilm isUserExisting(string Category) { DataTable dt = new DataTable("Thickness"); dt.Clear(); string query = "SELECT * FROM ThickOfFilm where Thickness='" + Category + "'"; dt = DataAccess.DBAdapter.GetRecordSet(query); ThickOfFilm log = null; if (dt.Rows.Count > 0) { log = new ThickOfFilm(dt.Rows[0]); } return log; }
public string insertCategory(ThickOfFilm cats) { string Message = string.Empty; int result = 0; con.Open(); SqlCommand cmd = new SqlCommand("INSERT INTO [ThickOfFilm]([Thickness]) VALUES (@Thickness)", con); cmd.Parameters.AddWithValue("@Thickness", cats.Thickness); result = cmd.ExecuteNonQuery(); con.Close(); return Message; }
private bool isUserExisting() { string userid = this.txtCategory.Text; busThickOfFilm buscat = new busThickOfFilm(); FrameWork.ThickOfFilm frmcat = new FrameWork.ThickOfFilm(); 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) { busThickOfFilm buscat = new busThickOfFilm(); FrameWork.ThickOfFilm frmcat = new FrameWork.ThickOfFilm(); frmcat.Thickness = this.txtCategory.Text; isExisting = isUserExisting(); if (isExisting.Equals(true)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Thick existing')", true); } else { buscat.insertCategory(frmcat); } DataTable dt = new DataTable("User"); dt = buscat.allCategories(); GridView1.DataSource = dt; GridView1.DataBind(); }