Example #1
0
        private void Luu(int Trang_thai)
        {
            int rs = 0;

            KiemTraDuLieu(ref rs);

            if (rs == 1)
            {
                rs = PhieuNhapCtrl.Insert(ledNhanVienNhap.EditValue, ledNhaCungCap.EditValue, ledKhoNhap.EditValue, txtChungTuGoc.Text, dteNgayNhap.EditValue, mmoGhiChu.Text, 6);

                if (rs == 0)
                {
                    NotifyHelper.ShowError("Thêm phiếu nhập không thành công", "Lỗi thêm phiếu nhập");
                    return;
                }

                rs = PhieuNhapCtrl.AddDetails(rs, Trang_thai, grvPhieuNhapCT);

                if (rs == 0)
                {
                    NotifyHelper.ShowError("Thêm các chi tiết phiếu nhập không thành công", "Lỗi thêm chi tiết phiếu nhập");
                    PhieuNhapCtrl.Delete(rs);

                    return;
                }

                NotifyHelper.ShowInfo("Thêm phiếu nhập thành công", "Thêm phiếu nhập");

                btnLamLai.PerformClick();
            }
        }
Example #2
0
        private void KiemTraDuLieu(ref int result)
        {
            if (ledNhanVienNhap.EditValue == null)
            {
                NotifyHelper.ShowError("Chưa chọn nhân viên nhập", "Lỗi thêm dữ liệu");
                ledNhanVienNhap.Focus();
                result = 0;
                return;
            }

            if (ledKhoNhap.EditValue == null)
            {
                NotifyHelper.ShowError("Chưa chọn nhân kho nhập", "Lỗi thêm dữ liệu");
                ledKhoNhap.Focus();
                result = 0;
                return;
            }

            if (ledNhaCungCap.EditValue == null)
            {
                NotifyHelper.ShowError("Chưa chọn nhà cung cấp", "Lỗi thêm dữ liệu");
                ledNhaCungCap.Focus();
                result = 0;
                return;
            }

            if (dteNgayNhap.EditValue == "")
            {
                NotifyHelper.ShowError("Chưa chọn ngày nhập kho", "Lỗi thêm dữ liệu");
                dteNgayNhap.Focus();
                result = 0;
                return;
            }

            if (grvPhieuNhapCT.RowCount < 2)
            {
                NotifyHelper.ShowError("Chưa nhập chi tiết phiếu nhập nào", "Lỗi thêm dữ liệu");
                grvPhieuNhapCT.Focus();
                result = 0;
                return;
            }

            result = 1;
        }
        private void KiemTraDuLieu(ref int result)
        {
            if (ledNhanVienNhap.EditValue == null)
            {
                NotifyHelper.ShowError("Chưa chọn nhân viên nhập", "Lỗi thêm dữ liệu");
                ledNhanVienNhap.Focus();
                result = 0;
                return;
            }

            if (ledKhoNhap.EditValue == null)
            {
                NotifyHelper.ShowError("Chưa chọn nhân kho nhập", "Lỗi thêm dữ liệu");
                ledKhoNhap.Focus();
                result = 0;
                return;
            }

            if (ledNhaCungCap.EditValue == null)
            {
                NotifyHelper.ShowError("Chưa chọn nhà cung cấp", "Lỗi thêm dữ liệu");
                ledNhaCungCap.Focus();
                result = 0;
                return;
            }

            if (dteNgayNhap.EditValue == "")
            {
                NotifyHelper.ShowError("Chưa chọn ngày nhập kho", "Lỗi thêm dữ liệu");
                dteNgayNhap.Focus();
                result = 0;
                return;
            }

            if (ledThanCuaCuon.EditValue == null)
            {
                NotifyHelper.ShowError("Chưa chọn thân cửa cuốn", "Lỗi thêm dữ liệu");
                ledThanCuaCuon.Focus();
                result = 0;
                return;
            }

            if (ledMoToCuaCuon.EditValue == null)
            {
                NotifyHelper.ShowError("Chưa chọn mô tơ cửa cuốn", "Lỗi thêm dữ liệu");
                ledMoToCuaCuon.Focus();
                result = 0;
                return;
            }

            if (ledChotCuaCuon.EditValue == null)
            {
                NotifyHelper.ShowError("Chưa chọn chốt cửa cuốn", "Lỗi thêm dữ liệu");
                ledChotCuaCuon.Focus();
                result = 0;
                return;
            }

            if (ledKhoaCuaCuon.EditValue == null)
            {
                NotifyHelper.ShowError("Chưa chọn kháo cửa cuốn", "Lỗi thêm dữ liệu");
                ledKhoaCuaCuon.Focus();
                result = 0;
                return;
            }

            result = 1;
        }