public UnitOfMeasures isUserExisting(string sizes) { DataTable dt = new DataTable("Category"); dt.Clear(); string query = "SELECT * FROM UnitOfMeasures where UnitOfMeasure='" + sizes + "'"; dt = DataAccess.DBAdapter.GetRecordSet(query); UnitOfMeasures log = null; if (dt.Rows.Count > 0) { log = new UnitOfMeasures(dt.Rows[0]); } return log; }
public string insertMeasures(UnitOfMeasures cats) { string Message = string.Empty; int result = 0; con.Open(); SqlCommand cmd = new SqlCommand("INSERT INTO [UnitOfMeasures]([UnitOfMeasure]) VALUES (@UnitOfMeasure)", con); cmd.Parameters.AddWithValue("@UnitOfMeasure", cats.UnitOfMeasure); result = cmd.ExecuteNonQuery(); con.Close(); return Message; }
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(); }
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); } }