示例#1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            DtoWarehouse w = new DtoWarehouse();

            w.MaKho  = txtWarehouseID.Text.ToString();
            w.TenKho = txtWarehouseName.Text.ToString();
            w.GhiChu = txtNote.Text.ToString();

            if (_isEditing)
            {
                if (_bllWarehouse.EditWarehouse(w))
                {
                    MessageBox.Show(Constants.MsgNotificationEditSuccessfuly);
                }
                else
                {
                    MessageBox.Show(Constants.MsgAlreadyExist);
                }
                btnCancel.PerformClick();
                return;
            }
            if (_bllWarehouse.AddWarehouse(w))
            {
                MessageBox.Show(Constants.MsgNotificationSuccessfuly);
            }
            else
            {
                MessageBox.Show(Constants.MsgAlreadyExist);
            }
        }
示例#2
0
 public bool EditWarehouse(DtoWarehouse data)
 {
     try
     {
         return(_dalWarehouse.EditWarehouse(data) != 0 ? true : false);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
示例#3
0
        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);
            }
        }
示例#5
0
 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);
     }
 }