internal List <BOTopCategory> SelectTopCatList(BOTopCategory _botopcat) { SqlCommand _sqlcommand; SqlDataAdapter _sqlDataAdapter; using (SqlConnection _con = ConnectionInfo.GetConnection()) { _sqlcommand = new SqlCommand(); _sqlcommand.CommandText = "SP_GetTopCategory"; _sqlcommand.CommandType = System.Data.CommandType.StoredProcedure; _sqlcommand.Connection = _con; _con.Open(); _sqlcommand.Parameters.AddWithValue("@Event", _botopcat.Event); _sqlDataAdapter = new SqlDataAdapter(_sqlcommand); DataTable _dataTable = new DataTable(); _sqlDataAdapter.Fill(_dataTable); List <BOTopCategory> TopCateList = (from cu in _dataTable.AsEnumerable() select new BOTopCategory { TopCategoryName = cu.Field <string>("TopCategoryName"), TopCategoryId = cu.Field <int>("TopCategoryId") }).ToList(); return(TopCateList); } }
private void FillTopCategory() { BOTopCategory _botopcat = new BOTopCategory(); _botopcat.Event = "GETALL"; List <BOTopCategory> TCateList = btcat.SelectTopCategoryList(_botopcat); cmbTopCategory.DataSource = TCateList; cmbTopCategory.DisplayMember = "TopCategoryName"; cmbTopCategory.ValueMember = "TopCategoryID"; }
private void Bind_TopCategoryCombo() { BOTopCategory _botopcat = new BOTopCategory(); BATopCategory _batopcat = new BATopCategory(); _botopcat.Event = "GETALL"; List<BOTopCategory> TCateList = _batopcat.SelectTopCategoryList(_botopcat); if (TCateList.Count > 0) { cmbTopcat.DataSource = TCateList; cmbTopcat.DisplayMember = "TopCategoryName"; cmbTopcat.ValueMember = "TopCategoryID"; } }
public List <BOTopCategory> SelectTopCategoryList(BOTopCategory btcat) { DataTable _dtable = new DataTable(); _dtable = SelectTopCategory(btcat); List <BOTopCategory> TopCateList = (from cu in _dtable.AsEnumerable() select new BOTopCategory { TopCategoryName = cu.Field <string>("TopCategoryName"), TopCategoryId = cu.Field <int>("TopCategoryId") }).ToList(); return(TopCateList); }
private void FillTopCategoryCombo() { BOTopCategory _botopcat = new BOTopCategory(); BATopCategory _batopcat = new BATopCategory(); _botopcat.Event = "GETALL"; List <BOTopCategory> TCateList = _batopcat.SelectTopCategoryList(_botopcat); if (TCateList.Count > 0) { cmbTopcate.DataSource = TCateList; cmbTopcate.DisplayMember = "TopCategoryName"; cmbTopcate.ValueMember = "TopCategoryID"; FillSecondCategoryCombo("GetWithTopCatId", Convert.ToInt32(cmbTopcate.SelectedValue)); } }
internal int IUDTopCategory(BOTopCategory _botcat) { int returnvalue = default(int); SqlCommand _sqlcommand; using (SqlConnection _sqlconnection = ConnectionInfo.GetConnection()) { _sqlcommand = new SqlCommand(); _sqlcommand.Connection = _sqlconnection; _sqlcommand.CommandText = "SP_IUDTopCategory"; _sqlcommand.CommandType = CommandType.StoredProcedure; _sqlconnection.Open(); _sqlcommand.Parameters.AddWithValue("@TopCategoryId", _botcat.TopCategoryId); _sqlcommand.Parameters.AddWithValue("@TopCategoryName", _botcat.TopCategoryName); _sqlcommand.Parameters.AddWithValue("@IsActive", _botcat.IsActive); _sqlcommand.Parameters.AddWithValue("@IsDelete", _botcat.IsDelete); _sqlcommand.Parameters.AddWithValue("@CreatedBy", _botcat.CreatedBy); _sqlcommand.Parameters.AddWithValue("@CreatedDate", _botcat.CreatedDate); _sqlcommand.Parameters.AddWithValue("@UpdatedBy", _botcat.UpdatedBy); _sqlcommand.Parameters.AddWithValue("@UpdatedDate", _botcat.UpdatedDate); _sqlcommand.Parameters.AddWithValue("@Event", _botcat.Event); _sqlcommand.Parameters.AddWithValue("@returnValue", 0).Direction = System.Data.ParameterDirection.InputOutput; try { _sqlcommand.ExecuteNonQuery(); returnvalue = Convert.ToInt32(_sqlcommand.Parameters["@returnValue"].Value); } catch (Exception ex) { Common.LogError(ex); } finally { _sqlconnection.Close(); _sqlcommand.Dispose(); } } return(returnvalue); }
public DataTable SelectTopCategory(BOTopCategory btcat) { SqlCommand _sqlcommand; SqlDataAdapter _sqlDataAdapter; using (SqlConnection _con = ConnectionInfo.GetConnection()) { _sqlcommand = new SqlCommand(); _sqlcommand.CommandText = "SP_GetTopCategory"; _sqlcommand.CommandType = System.Data.CommandType.StoredProcedure; _sqlcommand.Connection = _con; _con.Open(); _sqlcommand.Parameters.AddWithValue("@Event", btcat.Event); _sqlDataAdapter = new SqlDataAdapter(_sqlcommand); DataTable _dataTable = new DataTable(); _sqlDataAdapter.Fill(_dataTable); return(_dataTable); } }
private void dgvTopCategory_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { if (headval) { if (dgvTopCategory.Columns[e.ColumnIndex].Name == "Edit") { TopCatId = Convert.ToInt32(dgvTopCategory.Rows[e.RowIndex].Cells[0].Value.ToString()); txtTopCategory.Text = dgvTopCategory.Rows[e.RowIndex].Cells[1].Value.ToString(); txtTopCategory.Focus(); btnAdd.Text = "Update"; } else if (dgvTopCategory.Columns[e.ColumnIndex].Name == "Delete") { DialogResult result1 = MessageBox.Show("Are you sure you want to delete\nrecord " + dgvTopCategory.Rows[e.RowIndex].Cells[1].Value.ToString() + " ?", "Warning", MessageBoxButtons.YesNo); if (result1 == DialogResult.Yes) { TopCatId = Convert.ToInt32(dgvTopCategory.Rows[e.RowIndex].Cells[0].Value.ToString()); BOTopCategory _botcat = new BOTopCategory(); _botcat.TopCategoryId = TopCatId; _botcat.TopCategoryName = txtTopCategory.Text; _botcat.IsActive = true; _botcat.IsDelete = true; _botcat.CreatedBy = loginID; _botcat.CreatedDate = DateTime.UtcNow; _botcat.UpdatedBy = loginID; _botcat.UpdatedDate = DateTime.UtcNow; _botcat.Event = "Delete"; MessageBox.Show(Common.Message(dgvTopCategory.Rows[e.RowIndex].Cells[1].Value.ToString(), _batcat.Delete(_botcat))); ClearControl(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public List <BOTopCategory> SelectTopCategoryList(BOTopCategory _botcat) { return(datcat.SelectTopCategoryList(_botcat)); }
public int Delete(BOTopCategory _botcat) { return(datcat.IUDTopCategory(_botcat)); }
public DataTable SelectTopCategory(BOTopCategory _botcat) { return(datcat.SelectTopCategory(_botcat)); }
public int Insert(BOTopCategory _botcat) { return(datcat.IUDTopCategory(_botcat)); }
internal int Delete(BOTopCategory _botcat) { return(_datcat.IUDTopCategory(_botcat)); }
internal int Insert(BOTopCategory _botcat) { return(_datcat.IUDTopCategory(_botcat)); }
internal List <BOTopCategory> SelectTopCategoryList(BOTopCategory _botopcat) { return(_datopcat.SelectTopCatList(_botopcat)); }