コード例 #1
0
ファイル: BllWarehouse.cs プロジェクト: SoseUIT034/OOAD-2015
 public bool EditWarehouse(DtoWarehouse data)
 {
     try
     {
         return _dalWarehouse.EditWarehouse(data) != 0 ? true : false;
     }
     catch (Exception ex)
     {
         return false;
     }
 }
コード例 #2
0
ファイル: GuiWarehouses.cs プロジェクト: SoseUIT034/OOAD-2015
 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++;
     }
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
ファイル: DalWarehouse.cs プロジェクト: SoseUIT034/OOAD-2015
        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);
            }
        }