Пример #1
0
 public bool DonViTinh_Update(DonViTinh inp)
 {
     try
     {
         return(DonViTinh_bus.Update(inp));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 private void btnLuu_Click(object sender, EventArgs e)
 {
     if (ValidateData())
     {
         obj.IDDonViTinh  = IDDonViTinh;
         obj.TenDonViTinh = txtTenDonViTinh.Text;
         obj.GhiChu       = txtGhiChu.Text;
         bus.Update(obj);
         XtraMessageBox.Show("Cập nhật đơn vị tính thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
 }
Пример #3
0
        private void btnCapNhat_Click(object sender, EventArgs e)
        {
            if (dgvData.Rows.Count < 1 || dgvData.CurrentCellAddress.Y < 0)
            {
                return;
            }
            if (ThieuDuLieu(false))
            {
                return;
            }

            if (MessageBox.Show("Xác nhận?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.No)
            {
                return;
            }

            int i  = dgvData.CurrentRow.Index;
            int ID = Convert.ToInt32(dgvData.Rows[i].Cells["ColID"].Value.ToString());

            SetDataIndex(ID);

            long re = bus.Update(itemIndex);

            if (re > 0)
            {
                MessageBox.Show("Thành công.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoadData();
            }
            else
            {
                if (re == -2)
                {
                    MessageBox.Show("Trùng mã", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    MessageBox.Show("Không thành công.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }