public bool EditWarehouse(DtoWarehouse data) { try { return _dalWarehouse.EditWarehouse(data) != 0 ? true : false; } catch (Exception ex) { return false; } }
private async Task FillDataTable() { int index = 0; foreach (DataRow row in _balWarehouses.GetListWarehouses().Rows) { DtoWarehouse data = new DtoWarehouse(); data.MaKho = row[0].ToString(); data.TenKho = row[1].ToString(); data.TrangThai = CommonFunction.IntToBool(row[2].ToString()); data.NgayTao = DateTime.Parse(row[3].ToString()); data.GhiChu = row[4].ToString(); dgList.Rows.Add(data.MaKho, data.TenKho, data.TrangThai, data.NgayTao, data.GhiChu); index++; } }
private void btnAdd_Click(object sender, EventArgs e) { DtoWarehouse w = new DtoWarehouse(); w.MaKho = txtWarehouseID.Text.ToString(); w.TenKho = txtWarehouseName.Text.ToString(); w.TrangThai = chkState.Checked; w.NgayTao = DateTime.Now; w.GhiChu = txtNote.Text.ToString(); if (_balWarehouses.AddWarehouse(w)) { MessageBox.Show(Constants.MsgNotification); } else { MessageBox.Show(Constants.MsgExceptionAlready); } }
public int EditWarehouse(DtoWarehouse data) { try { SqlParameter[] para = { new SqlParameter("@MaKho", data.MaKho), new SqlParameter("@TenKho", data.TenKho), new SqlParameter("@Ghichu", data.GhiChu), }; return SqlHelper.ExecuteNonQuery(Constants.ConnectionString, CommandType.StoredProcedure, "EditWarehouse", para); } catch (SqlException) { throw new ArgumentException(Constants.MsgExceptionSql); } catch (Exception) { throw new AggregateException(Constants.MsgExceptionError); } }