Esempio n. 1
0
        public void Them(ref DataGridViewX dgvQDPT, ref TextBoxX txtMaQDPT, ref TextBoxX txtQDPTTienPhat, QuyDinhPhieuTraBUS qdptBUS)
        {
            QuyDinhPhieuTraDTO qdptDTO = new QuyDinhPhieuTraDTO();

            if (!qdptBUS.MapDataQDPTFromGUIQDPT(ref qdptDTO, txtMaQDPT, txtQDPTTienPhat, qdptBUS))
            {
                MessageBox.Show("Dữ liệu không hợp lệ", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (qdptBUS.IsTrungKhopKhoaChinh(qdptDTO.Maqd, dgvQDPT))
            {
                MessageBox.Show("Trùng mã quy định phiếu trả", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (dgvQDPT.RowCount != 0)
            {
                QuyDinhPhieuTraDTO temp = new QuyDinhPhieuTraDTO();
                qdptBUS.UpdatePreviousDataRowQDPT(ref temp, dgvQDPT);
                qdptBUS.Sua(temp);
                qdptDTO.Ngayra = qdptDTO.Ngayra.AddDays(1);
            }
            if (qdptBUS.Them(qdptDTO))
            {
                MessageBox.Show("Thêm thành công");
                qdptBUS.LoadTabQDPT(ref dgvQDPT, ref txtMaQDPT, ref txtQDPTTienPhat, qdptBUS);
            }
            else
            {
                MessageBox.Show("Thêm không thành công", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        public void Sua(ref DataGridViewX dgvQDPT, ref TextBoxX txtMaQDPT, ref TextBoxX txtQDPTTienPhat, QuyDinhPhieuTraBUS qdptBUS)
        {
            QuyDinhPhieuTraDTO qdptDTO = new QuyDinhPhieuTraDTO();

            if (!qdptBUS.MapDataQDPTFromGUIQDPT(ref qdptDTO, txtMaQDPT, txtQDPTTienPhat, qdptBUS))
            {
                MessageBox.Show("Dữ liệu không hợp lệ", "", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                return;
            }
            if (qdptBUS.Sua(qdptDTO))
            {
                MessageBox.Show("Cập nhật thành công");
                qdptBUS.LoadTabQDPT(ref dgvQDPT, ref txtMaQDPT, ref txtQDPTTienPhat, qdptBUS);
            }
            else
            {
                MessageBox.Show("Cập nhật không thành công", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }