Exemplo n.º 1
0
 protected override void OnLoad()
 {
     if (idKho == -1)
     {
         if (userId == -1)
         {
             ListInitInfo = DmNhanVienDataProvider.GetListDmNhanVienUsingInfor();
         }
         else
         {
             ListInitInfo = DmNhanVienDataProvider.GetListDmNhanVienInforByUserId(userId);
         }
     }
     else if (idKho >= 0)
     {
         if (isTruongCa)
         {
             ListInitInfo = DmNhanVienDataProvider.GetListTruongCaInforByIdKho(idKho);
         }
         else
         {
             ListInitInfo = DmNhanVienDataProvider.GetListDmNhanVienInforByIdKho(idKho);
         }
     }
     else if (idTrungTam > 0 && idNhomNguoiDung > 0)
     {
         ListInitInfo = DmNhanVienDataProvider.GetListDmNhanVienInforByIdTrungTamAndNhomNguoiDung(idTrungTam, idNhomNguoiDung);
     }
 }
Exemplo n.º 2
0
        private void SaveNhanVien()
        {
            if (Check())
            {
                try
                {
                    ConnectionUtil.Instance.BeginTransaction();
                    if (frmNV.isAdd)
                    {
                        //tao ma vach tu ma nhan vien
                        txtMaVach.Text = GtidCryptionEx.EncryptEx(txtMaNhanVien.Text.Trim(), true);

                        int Oid = DmNhanVienDataProvider.Insert(SetNhanVien());
                        SaveKhoNhanVien(Oid);
                        //note: @All các transaction đòi hỏi phải giải phóng nhanh nên commit hay rollback phải đặt trước các lệnh làm pendding nó
                        ConnectionUtil.Instance.CommitTransaction();
                    }
                    else
                    {
                        dm.IdNhanVien = frmNV.Oid;
                        DmNhanVienDataProvider.Update(SetNhanVien());
                        SaveKhoNhanVien(frmNV.Oid);
                        ConnectionUtil.Instance.CommitTransaction();
                    }
                }
                catch (Exception)
                {
                    ConnectionUtil.Instance.RollbackTransaction();
                    throw;
                }
            }
        }
Exemplo n.º 3
0
        private void LoadChungTuHeader()
        {
            LoaiChungTu      = Business.ChungTu.LoaiChungTu;
            TrangThaiDonHang = Business.ChungTu.TrangThai;
            Draft            = Business.ChungTu.Draft;

            bteKhoXuat.Tag    = DMKhoDataProvider.GetKhoByIdInfo(Business.ChungTu.IdKho);
            bteKhoXuat.Text   = bteKhoXuat.Tag != null ? ((DMKhoInfo)bteKhoXuat.Tag).TenKho : "";
            bteKhachHang.Tag  = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(Business.ChungTu.IdDoiTuong);
            bteKhachHang.Text = bteKhachHang.Tag != null ? ((DMDoiTuongInfo)bteKhachHang.Tag).TenDoiTuong : "";
            IdKhoSelected     = Business.ChungTu.IdKho;
            txtGhiChu.Text    = Business.ChungTu.GhiChu;

            txtSoOrderKH.Text     = Business.ChungTu.SoChungTu;
            mstNgayLapPhieu.Value = Business.ChungTu.NgayLap;
            txtSoPhieu.Text       = Business.ChungTu.SoPhieuXuat;
            try
            {
                mstNgayXuat.Value = Business.ChungTu.NgayXuatHang;
            }
            catch
            {
                mstNgayXuat.Value = DateTime.Now;
            }

            cboNhanVien.SelectedValue = Business.ChungTu.IdNhanVienGiao;
            bteNhanVien.Tag           = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(Business.ChungTu.IdNhanVienGiao);
            bteNhanVien.Text          = bteNhanVien.Tag != null ? ((DMNhanVienInfo)bteNhanVien.Tag).HoTen : "";
            txtDienThoai.Text         = Business.ChungTu.DienThoai;
            txtHoTenKhachHang.Text    = Business.ChungTu.HoTen;
            txtDiaChi.Text            = Business.ChungTu.DiaChi;
        }
Exemplo n.º 4
0
        private void LoadChungTuHeader()
        {
            LoadTrungTam();
            LoadKhoXuat();
            LoadKhachHang();

            txtSoOrderKH.Text     = ChungTu.SoChungTu;
            mstNgayLapPhieu.Value = ChungTu.NgayLap;
            txtSoChungTuGoc.Text  = ChungTu.SoChungTuGoc;

            txtSoPhieuDC.Text = ChungTu.SoPhieuDC;

            bteThuongVien.Tag         = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(ChungTu.IdNhanVien);
            bteThuongVien.Text        = bteThuongVien.Tag != null ? ((DMNhanVienInfo)bteThuongVien.Tag).HoTen : "";
            cboGiaoHang.SelectedIndex = ChungTu.GiaoNhan;

            try
            {
                mstNgayHenGiaoHang.Value = ChungTu.NgayHenGiaoHang;
            }
            catch
            {
                mstNgayHenGiaoHang.Value = CommonProvider.Instance.GetSysDate();
            }

            txtGhiChu.Text = ChungTu.GhiChu;

            txtSoSerie.Text        = ChungTu.SoSeri;
            bteKhachLe.Tag         = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(ChungTu.IdKhachLe);
            bteKhachLe.Text        = bteKhachHang.Tag != null ? ((DMDoiTuongInfo)bteKhachHang.Tag).TenDoiTuong : "";
            txtCongTy.Text         = ChungTu.CongTy;
            txtHoTenKhachHang.Text = ChungTu.HoTen;
            txtDiaChi.Text         = ChungTu.DiaChi;
            txtSoHDDaMua.Text      = ChungTu.SoHDDaMua;
        }
Exemplo n.º 5
0
 private void Delete()
 {
     DmNhanVienDataProvider.Delete(new DMNhanVienInfo {
         IdNhanVien = Oid
     });
     LoadData();
     SetControl(false);
 }
        //fill dữ liệu vào control
        private void LoadOldChungTuInfor(ChungTuBanHangInfor lstHD)
        {
            grbChungTuMua.Text = "Thông tin phiếu mua hàng: " +
                                 (String.IsNullOrEmpty(lstHD.TenTrungTam)
                          ? ""
                          : (lstHD.TenTrungTam + (String.IsNullOrEmpty(lstHD.TenKho) ? "" : "(" + lstHD.TenKho + ")")));
            _IdTrungTam               = lstHD.IdTrungTam;
            txtSoGiaoDich.Text        = lstHD.SoChungTu;
            txtSoPhieuXuat.Text       = lstHD.SoPhieuXuat;
            dteNgayLap.EditValue      = lstHD.NgayLap;
            dteNgayXuat.EditValue     = lstHD.NgayXuatHang;
            txtKiHieu.Text            = lstHD.KyHieu;
            txtSoHoaDon.Text          = lstHD.SoSeri;
            txtTenDoiTuong.Text       = lstHD.HoTen;
            txtCongTy.Text            = lstHD.CongTy;
            cboGioiTinh.SelectedIndex = lstHD.GioiTinh;
            txtCMND.Text              = lstHD.SoCMND;
            txtSoDienThoai.Text       = lstHD.MaSoThue;
            txtEmail.Text             = lstHD.Email;
            txtDiaChiHD.Text          = lstHD.DiaChiHoaDon;
            txtDiaChiGH.Text          = lstHD.DiaChiGiaoHang;
            txtSoDienThoai.Text       = lstHD.DienThoai;

            if (lstHD.IdNhanVien != 0)
            {
                DMNhanVienInfo thuongvien = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(lstHD.IdNhanVien);
                if (thuongvien != null)
                {
                    bteThuongVien.Tag  = thuongvien;
                    bteThuongVien.Text = thuongvien.HoTen;
                }
            }

            if (lstHD.IdDoiTuong != 0)
            {
                DMDoiTuongInfo doituong = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(lstHD.IdDoiTuong);
                if (doituong != null)
                {
                    txtKhachHang.Tag  = doituong;
                    txtKhachHang.Text = doituong.TenDoiTuong;
                }
            }
            if (lstHD.IdKhachLe != 0)
            {
                DMDoiTuongInfo khachle = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(lstHD.IdKhachLe);
                if (khachle != null)
                {
                    bteKhachLe.Tag  = khachle;
                    bteKhachLe.Text = khachle.TenDoiTuong;
                }
            }

            txtTongTienTT.Text   = Common.Double2Str(lstHD.TongTienThanhToan);
            txtTienThucTra.Text  = Common.Double2Str(lstHD.TienThanhToanThuc);
            txtTienConNo.Text    = Common.Double2Str(lstHD.TienConNo);
            txtTienTraKhach.Text = "0";
            txtTienNoKhach.Text  = txtTienThucTra.Text;
        }
Exemplo n.º 7
0
 private void LoadThuNgan()
 {
     ThuNganSelected = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(Declare.IdThuNgan);
     if (ThuNganSelected != null)
     {
         bteThuNgan.Text = ThuNganSelected.HoTen;
         bteThuNgan.Tag  = ThuNganSelected;
     }
 }
Exemplo n.º 8
0
 private void LoadTruongCa()
 {
     TruongCaSelected = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(Declare.IdTruongCa);
     if (TruongCaSelected != null)
     {
         bteTruongCa.Text = TruongCaSelected.HoTen;
         bteTruongCa.Tag  = TruongCaSelected;
     }
 }
Exemplo n.º 9
0
        private void btnFilter_Click(object sender, EventArgs e)
        {
            DMNhanVienInfo dm = new DMNhanVienInfo();

            dm.HoTen           = txtFilterTen.Text.Trim();
            dm.MaNhanVien      = txtFilterMa.Text.Trim();
            dm.IdChucVu        = Convert.ToInt32(cboChucDanhS.SelectedValue.ToString());
            dm.IdPhongBan      = Convert.ToInt32(cboPhongBanS.SelectedValue.ToString());
            grcBase.DataSource = DmNhanVienDataProvider.Search(dm);
        }
Exemplo n.º 10
0
        private void LoadQLTrucTiep(int idQLTrucTiep)
        {
            DMNhanVienInfo nv = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(idQLTrucTiep);

            if (nv != null)
            {
                bteQLTrucTiep.Text = nv.HoTen;
                bteQLTrucTiep.Tag  = nv;
            }
        }
        private void LoadNhanVienGiaoNhan()
        {
            //load nhan vien
            int            idNhanVien = ChiTietGiaoNhan.IdNhanVien > 0 ? ChiTietGiaoNhan.IdNhanVien : nguoiDung.IdNhanVien;
            DMNhanVienInfo nhanVien   = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(idNhanVien);

            if (nhanVien != null)
            {
                bteThuongVien.Tag  = nhanVien;
                bteThuongVien.Text = nhanVien.HoTen;
                txtMaNhanVien.Text = nhanVien.MaNhanVien;
            }
            if (ChiTietGiaoNhan.IdNhanVien2 > 0)
            {
                DMNhanVienInfo nv = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(ChiTietGiaoNhan.IdNhanVien2);
                if (nv != null)
                {
                    bteThuongVien2.Tag  = nv;
                    bteThuongVien2.Text = nv.HoTen;
                    txtMaNhanVien2.Text = nv.MaNhanVien;
                }
            }
            if (ChiTietGiaoNhan.IdNhanVien3 > 0)
            {
                DMNhanVienInfo nv = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(ChiTietGiaoNhan.IdNhanVien3);
                if (nv != null)
                {
                    bteThuongVien3.Tag  = nv;
                    bteThuongVien3.Text = nv.HoTen;
                    txtMaNhanVien3.Text = nv.MaNhanVien;
                }
            }
            //load lai xe
            if (ChiTietGiaoNhan.IdLaiXe > 0)
            {
                DMNhanVienInfo nv = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(ChiTietGiaoNhan.IdLaiXe);
                if (nv != null)
                {
                    bteLaiXe.Tag  = nv;
                    bteLaiXe.Text = nv.HoTen;
                }
            }
            //load doi tac
            if (ChiTietGiaoNhan.IdDoiTac > 0)
            {
                DMNhanVienInfo dt = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(ChiTietGiaoNhan.IdDoiTac);
                if (dt != null)
                {
                    bteDoiTac.Tag  = dt;
                    bteDoiTac.Text = dt.HoTen;
                }
            }
            txtNhanVienDoiTac.Text = ChiTietGiaoNhan.NhanVienDoiTac;
        }
Exemplo n.º 12
0
 protected override void OnLoad()
 {
     if (idTrungTam == 0)
     {
         base.OnLoad();
     }
     else
     {
         ListInitInfo = DmNhanVienDataProvider.GetListDmNhanVienInforByIdTrungTam(idTrungTam);
     }
 }
Exemplo n.º 13
0
        private bool Check()
        {
            if (String.IsNullOrEmpty(txtMaNhanVien.Text))
            {
                txtMaNhanVien.Focus();
                throw new InvalidOperationException("Mã nhân viên không được để trống !");
            }
            if (String.IsNullOrEmpty(txtHoTen.Text))
            {
                txtHoTen.Focus();
                throw new InvalidOperationException("Tên nhân viên không được để trống !");
            }
            if (cboPhongBan.Text.Trim().Length == 0)
            {
                cboPhongBan.Focus();
                throw new InvalidOperationException("Phòng ban chưa được chọn!");
            }
            if (cboChucVu.Text.Trim().Length == 0)
            {
                cboChucVu.Focus();
                throw new InvalidOperationException("Chức vụ chưa được chọn!");
            }
            if (this.txtEmail.Text.Trim().Length > 0 && Common.ValidEmail(this.txtEmail.Text.Trim()) == false)
            {
                this.txtEmail.Focus();
                throw new InvalidOperationException("Email chưa đúng định dạng!");
            }
            if (bteTrungTam.Tag == null)
            {
                this.txtEmail.Focus();
                throw new InvalidOperationException("Chưa chọn trung tâm của nhân viên!");
            }
            if (frmNV.IsSync)
            {
                if (txtHoTen.Text != dm.HoTen)
                {
                    throw new InvalidOperationException("Tên nhân viên đã bị thay đổi !");
                }
                if (txtMaNhanVien.Text != dm.MaNhanVien)
                {
                    throw new InvalidOperationException("Mã nhân viên đã bị thay đổi !");
                }
            }


            if (DmNhanVienDataProvider.KiemTra(new DMNhanVienInfo {
                IdNhanVien = frmNV.Oid, MaNhanVien = txtMaNhanVien.Text.Trim()
            }))
            {
                throw new InvalidOperationException("Mã nhân viên đã tồn tại trong hệ thống !");
            }
            return(true);
        }
Exemplo n.º 14
0
 private void Delete()
 {
     if (frmNV.isAdd)
     {
         throw new InvalidOperationException("Bạn không thể xóa khi đang thêm mới !");
     }
     if (frmNV.IsSync)
     {
         throw new InvalidOperationException("Bạn không thể xóa dữ liệu được đồng bộ!");
     }
     DmNhanVienDataProvider.Delete(new DMNhanVienInfo {
         IdNhanVien = frmNV.Oid
     });
 }
        private void frm_PhieuDeNghiXuatTieuHaoNew_Load(object sender, EventArgs e)
        {
            if (chungTuInfo == null || chungTuInfo.IdChungTu == 0)
            {
                dteNgay.Text      = Convert.ToString(CommonProvider.Instance.GetSysDate());
                dteNgay.BackColor = Color.White;
                dteNgay.ForeColor = Color.Black;
                //bteTVDN.Text = Declare.UserName;
                txtSoPhieu.Text  = CommonProvider.Instance.GetSoPhieu("PXTH");
                txtNguoiLap.Text = Declare.UserName;
                IsAdd            = true;
            }
            else
            {
                txtSoPhieu.Text     = business.ChungTu.SoChungTu;
                txtNguoiLap.Text    = business.ChungTu.NguoiTao;
                dteNgay.DateTime    = business.ChungTu.NgayLap;
                bteNguoiQuanLy.Text = business.ChungTu.NguoiQuanLy;
                bteTVDN.Text        = business.ChungTu.HoTen;
                bteTVDN.Tag         = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(business.ChungTu.IdNhanVien);
                bteTVDN.Enabled     = false;
                bteTrungTam.Text    = business.ChungTu.TenTrungTam;
                bteTrungTam.Tag     = DMTrungTamDataProvider.GetTrungTamByIdInfo(business.ChungTu.IdTrungTam);
                bteNguoiQuanLy.Tag  = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(business.ChungTu.IdNguoiQuanLy);
                bteKho.Text         = business.ChungTu.TenKho;
                bteKho.Tag          = DMKhoDataProvider.GetKhoByIdInfo(business.ChungTu.IdKho);
                txtGhiChu.Text      = business.ChungTu.GhiChu;
                txtGhiChu.Enabled   = false;
                btnCapNhat.Enabled  = false;
                btnThemSP.Enabled   = false;
                btnXoaSP.Enabled    = false;
                bteKho.Enabled      = false;
                bteTrungTam.Enabled = false;
            }

            bdSource = new BindingSource();
            if (business.ListChiTietChungTu != null)
            {
                bdSource.DataSource = new BindingList <DeNghiXuatTieuHaoChiTietInfonew>(business.ListChiTietChungTu);
                bdSource.AddingNew += new AddingNewEventHandler(bdSource_AddingNew);
                grcList.DataSource  = bdSource;
            }
            dteNgay.Enabled = false;
            LoadChiPhi();
            LoadPhongBan();
            LoadNganh();
        }
Exemplo n.º 16
0
        private void Delete()
        {
            if (MessageBox.Show("Bạn có muốn xóa bản ghi này ?", "thông báo", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                //Kho_NhanVienDelInfo kho = new Kho_NhanVienDelInfo();
                //kho.IdNhanVien = OidNhanVien;
                //Kho_NhanVienDataProvider.Delete(new Kho_NhanvienInfo { IdNhanVien = OidNhanVien });
                //DmNhanVienInfo nv = new DmNhanVienInfo();

                //nv.IdNhanVien = OidNhanVien;
                DmNhanVienDataProvider.Delete(new DMNhanVienInfo {
                    IdNhanVien = OidNhanVien
                });
                MessageBox.Show("Xóa thành công bản ghi !");
                LoadData();
                SetControl(false);
            }
        }
        private void txtMaNhanVien3_Leave(object sender, EventArgs e)
        {
            DMNhanVienInfo nhanvien = DmNhanVienDataProvider.GetNhanVienByText(txtMaNhanVien3.Text);

            if (nhanvien != null)
            {
                txtMaNhanVien3.Text = nhanvien.MaNhanVien;
                bteThuongVien3.Tag  = nhanvien;
                bteThuongVien3.Text = nhanvien.HoTen;
            }
            else
            {
                txtMaNhanVien3.Text = "";
                bteThuongVien3.Tag  = null;
                bteThuongVien3.Text = "";
                //bteThuongVien_KeyDown(null, null);
            }
        }
Exemplo n.º 18
0
        private void LoadThuNgan()
        {
            try
            {
                DMNhanVienInfo nv = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(nguoiDung.IdNhanVien);
                if (nv != null)
                {
                    bteThuNgan.Text = nv.HoTen;
                    bteThuNgan.Tag  = nv;
                }
            }
            catch (System.Exception ex)
            {
#if DEBUG
                MessageBox.Show("Lỗi ngoại lệ: " + ex.ToString(), Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#else
                MessageBox.Show("Lỗi ngoại lệ: " + ex.Message, Declare.titleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
#endif
            }
        }
        public void TestNhanVien05_InsertSuccess()
        {
            frmDM_NhanVien frm = new frmDM_NhanVien();

            frm.Oid   = 0;
            frm.isAdd = true;
            frmChiTiet_NhanVien frmChiTietNhanVien = new frmChiTiet_NhanVien(frm);

            frmChiTietNhanVien.SetInput("Bùi Đức Hạnh", "TA111", "04/02/1988", "abcdef", "12345678", "*****@*****.**", "UnitsTest Nhan Vien", 1, 42, 1);
            frmChiTietNhanVien.TestSave();
            List <DMNhanVienInfo> list = DmNhanVienDataProvider.GetListDmNhanVienInfor();
            //todo : HanhBD xem lại store search
            //List<DMNhanVienInfo> listMatch = list.FindAll(delegate(DMNhanVienInfo match)
            //{
            //    return match.MaNhanVien == "TA111";
            //});
            //List<DmNhanVienGridInfo> listMatch = DmNhanVienDataProvider.Search(new DmNhanVienGridInfo() { MaNhanVien = "111" });

            //Assert.AreEqual(1, listMatch.Count);
        }
Exemplo n.º 20
0
        private void frmHT_AddNguoiDung_Load(object sender, EventArgs e)
        {
            LoadNhomNguoiDung();
            if (objNguoiDung != null)
            {
                txtUserName.ReadOnly       = true;
                txtPassword.ReadOnly       = true;
                txtRetypePassword.ReadOnly = true;

                txtFullName.Text       = objNguoiDung.TenDayDu;
                txtUserName.Text       = objNguoiDung.TenDangNhap;
                txtPassword.Text       = objNguoiDung.MatKhau;
                txtRetypePassword.Text = objNguoiDung.MatKhau;
                chkSuDung.Checked      = objNguoiDung.SuDung;// (objNguoiDung.SuDung == 1 ? true : false);
                chkSuperUser.Checked   = Common.Int2Bool(objNguoiDung.SupperUser);
                DMNhanVienInfo nv = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(objNguoiDung.IdNhanVien);
                bteThuongVien.Text     = nv.HoTen;
                bteThuongVien.Tag      = nv;
                cboGroup.SelectedValue = objNguoiDung.IdNhomNguoiDung;

                if (objNguoiDung.ThoiGianApDung == -1)
                {
                    chkNeverExpired.Checked         = true;
                    chkForceChangeOnExpired.Checked = false;
                    chkForceChangeOnExpired.Enabled = false;
                    txtExpiredIn.Enabled            = false;
                    txtExpiredIn.Text = "30";
                }
                else
                {
                    chkNeverExpired.Checked         = false;
                    chkNeverExpired.Enabled         = false;
                    chkForceChangeOnExpired.Checked = true;
                    txtExpiredIn.Enabled            = true;
                    txtExpiredIn.Text = objNguoiDung.ThoiGianApDung == -1 ? "30" :
                                        objNguoiDung.ThoiGianApDung.ToString();
                }

                chkForceChangeAtFirst.Checked = objNguoiDung.ChangeOnNext;
            }
        }
        public frmDmNhanVienTestUnits()
        {
            frmLogin frmLogin = new frmLogin();

            frmLogin.TestLogin("quantri", "quantri");

            //chuẩn bị dữ liệu để test
            List <DMNhanVienInfo> list = DmNhanVienDataProvider.GetListDmNhanVienInfor();

            if (list != null)
            {
                List <DMNhanVienInfo> listMatch = list.FindAll(delegate(DMNhanVienInfo match)
                {
                    return(match.MaNhanVien == "TA111");
                });
                foreach (var dmNhanVienInfor in listMatch)
                {
                    DmNhanVienDataProvider.Delete(dmNhanVienInfor);
                }
            }
        }
Exemplo n.º 22
0
 private void frm_PhieuNhapTieuHao_Load(object sender, EventArgs e)
 {
     business.ListChiTietChungTu = XuatTieuHaoProvidernew.Instance.GetListChiTietChungTuByIdChungTu(OID != 0 ? OID : idChungTuGoc);
     grcList.DataSource          = business.ListChiTietChungTu;
     if (NgayXuat == Convert.ToString(DateTime.MinValue))
     {
         dteNgay.Text = Convert.ToString(CommonProvider.Instance.GetSysDate());
     }
     else
     {
         dteNgay.Text = NgayXuat;
     }
     bteTVDN.Text        = NguoiLap;
     bteTrungTam.Text    = TenTrungTam;
     bteKho.Text         = TenKho;
     txtGhiChu.Text      = GhiChu;
     bteTVX.Text         = NguoiXuat;
     bteTVX.Tag          = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(IdNhanVienGiao);
     txtSoPhieu.Text     = SoChungTu;
     bteTVDN.Enabled     = IsSupperUser();
     bteTrungTam.Enabled = false;
     bteKho.Enabled      = false;
     dteNgay.Enabled     = false;
     if (trangThai == Convert.ToInt32(TrangThaiDuyet.DA_NHAP))
     {
         btnCapNhat.Enabled = false;
         txtGhiChu.Enabled  = false;
         dteNgay.Enabled    = false;
         bteTVX.Enabled     = false;
     }
     else
     {
         //colSoLuong.RealColumnEdit = false;
     }
     LoadChiPhi();
     LoadPhongBan();
     LoadNganh();
 }
        public void TestNhanVien07_DeleteSuccess()
        {
            TestNhanVien05_InsertSuccess();
            List <DMNhanVienInfo> list  = DmNhanVienDataProvider.GetListDmNhanVienInfor();
            DMNhanVienInfo        infor = list.Find(delegate(DMNhanVienInfo match)
            {
                return(match.MaNhanVien == "TA111");
            });

            frmDM_NhanVien frm = new frmDM_NhanVien();

            frm.isAdd = false;
            frm.Oid   = infor.IdNhanVien;
            frmChiTiet_NhanVien frmChiTietNhanVien = new frmChiTiet_NhanVien(frm);

            frmChiTietNhanVien.TestDelete();
            list  = DmNhanVienDataProvider.GetListDmNhanVienInfor();
            infor = list.Find(delegate(DMNhanVienInfo match)
            {
                return(match.MaNhanVien == "TA111");
            });
            Assert.AreEqual(infor, null);
        }
        public void TestNhanVien03_MaNhanVienHasExistedOnUpdate()
        {
            try
            {
                TestNhanVien05_InsertSuccess();
                List <DMNhanVienInfo> list  = DmNhanVienDataProvider.GetListDmNhanVienInfor();
                DMNhanVienInfo        infor = list.Find(delegate(DMNhanVienInfo match)
                {
                    return(match.MaNhanVien == "TA111");
                });

                frmDM_NhanVien frm = new frmDM_NhanVien();
                frm.isAdd = false;
                frm.Oid   = infor.IdNhanVien;
                frmChiTiet_NhanVien frmChiTietNhanVien = new frmChiTiet_NhanVien(frm);
                frmChiTietNhanVien.SetInput("Bùi Đức Hạnh", "TA004", "04/02/1988", "abcdef", "12345678", "*****@*****.**", "UnitsTest Nhan Vien", 1, 42, 1);
                frmChiTietNhanVien.TestSave();
                list = DmNhanVienDataProvider.GetListDmNhanVienInfor();
                List <DMNhanVienInfo> listDuplicate = list.FindAll(delegate(DMNhanVienInfo match)
                {
                    return(match.MaNhanVien == "TA004");
                });
                frmChiTietNhanVien.TestDelete();
                Assert.AreEqual(1, listDuplicate.Count);
            }
            catch (Exception ex)
            {
                if (ex.GetType() != typeof(AssertFailedException))
                {
                    Assert.AreEqual(ex.Message, "Mã nhân viên đã tồn tại trong hệ thống !");
                }
                else
                {
                    throw;
                }
            }
        }
Exemplo n.º 25
0
 protected override void LoadData()
 {
     grcBase.DataSource = DmNhanVienDataProvider.GetListDmNhanVienInfor();
     btnFilter.Text     = Resources.btnSearch;
 }
        private void LoadChungTuHeader()
        {
            Draft       = Business.ChungTu.Draft;
            TrangThai   = Business.ChungTu.TrangThai;
            LoaiChungTu = Business.ChungTu.LoaiChungTu;
            _IdTrungTam = Business.ChungTu.IdTrungTam;

            bteKhoXuat.Tag      = DMKhoDataProvider.GetKhoByIdInfo(Business.ChungTu.IdKho);
            bteKhoXuat.Text     = bteKhoXuat.Tag != null ? ((DMKhoInfo)bteKhoXuat.Tag).TenKho : "";
            txtSoPhieuNhap.Text = Business.ChungTu.SoChungTu;
            txtGhiChu.Text      = Business.ChungTu.GhiChu;
            try
            {
                dteNgayNhap.EditValue = Business.ChungTu.NgayLap;
            }
            catch (Exception)
            {
                dteNgayNhap.EditValue = CommonProvider.Instance.GetSysDate();
            }

            try
            {
                dteNgayXacNhan.EditValue = Business.ChungTu.NgayXuatHang;
            }
            catch (Exception)
            {
                dteNgayXacNhan.EditValue = CommonProvider.Instance.GetSysDate();
            }

            lueLyDo.EditValue = Business.ChungTu.IdLyDoGiaoDich;

            grbChungTuMua.Text = "Thông tin phiếu mua hàng: " +
                                 (String.IsNullOrEmpty(Business.ChungTu.TenTrungTam)
                          ? ""
                          : (Business.ChungTu.TenTrungTam + (String.IsNullOrEmpty(Business.ChungTu.TenKho) ? "" : "(" + Business.ChungTu.TenKho + ")")));
            txtSoGiaoDich.Text  = Business.ChungTu.SoChungTuGoc;
            txtSoPhieuXuat.Text = Business.ChungTu.SoPhieuXuat;
            try
            {
                dteNgayLap.EditValue = Business.ChungTu.NgayHenGiaoHang;
            }
            catch (Exception)
            {
                dteNgayLap.EditValue = CommonProvider.Instance.GetSysDate();
            }
            try
            {
                dteNgayXuat.EditValue = Business.ChungTu.NgayGiaoHang;
            }
            catch (Exception)
            {
                dteNgayXuat.EditValue = CommonProvider.Instance.GetSysDate();
            }
            //cboCaBanHang.SelectedIndex = Business.ChungTu.CaBanHang;
            txtKiHieu.Text            = Business.ChungTu.KyHieu;
            txtSoHoaDon.Text          = Business.ChungTu.SoSeri;
            txtTenDoiTuong.Text       = Business.ChungTu.HoTen;
            txtCongTy.Text            = Business.ChungTu.CongTy;
            cboGioiTinh.SelectedIndex = Business.ChungTu.GioiTinh;
            txtCMND.Text        = Business.ChungTu.SoCMND;
            txtSoDienThoai.Text = Business.ChungTu.DienThoai;
            txtEmail.Text       = Business.ChungTu.Email;
            txtDiaChiHD.Text    = Business.ChungTu.DiaChiHoaDon;
            txtDiaChiGH.Text    = Business.ChungTu.DiaChiGiaoHang;

            if (Business.ChungTu.IdNhanVien != 0)
            {
                DMNhanVienInfo nhanvien = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(Business.ChungTu.IdNhanVien);
                if (nhanvien != null)
                {
                    bteThuongVien.Tag  = nhanvien;
                    bteThuongVien.Text = nhanvien.HoTen;
                }
            }

            if (Business.ChungTu.IdDoiTuong != 0)
            {
                DMDoiTuongInfo doituong = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(Business.ChungTu.IdDoiTuong);
                if (doituong != null)
                {
                    txtKhachHang.Tag  = doituong;
                    txtKhachHang.Text = doituong.TenDoiTuong;
                }
            }

            if (Business.ChungTu.IdKhachLe != 0)
            {
                DMDoiTuongInfo khachle = DmDoiTuongProvider.GetDmDoiTuongInfoFromOid(Business.ChungTu.IdKhachLe);
                if (khachle != null)
                {
                    bteKhachLe.Tag  = khachle;
                    bteKhachLe.Text = khachle.TenDoiTuong;
                }
            }
            txtTongTienTT.Text  = Common.Double2Str(Business.ChungTu.TongTienHang);
            txtTienThucTra.Text = Common.Double2Str(Business.ChungTu.TongTienThanhToan);
            txtTienConNo.Text   = Common.Double2Str(Business.ChungTu.TongTienHang - Business.ChungTu.TongTienThanhToan);

            txtTienTraKhach.Text = Common.Double2Str(Business.ChungTu.TienThanhToanThuc);
            txtTienNoKhach.Text  = Common.Double2Str(Business.ChungTu.TienConNo);
        }
        private void InPhieuGiaoNhan()
        {
            if (LstPhieuPCGN.Count == 0)
            {
                return;
            }
            HoaDonPCGNInfo hd = new HoaDonPCGNInfo();
            double         tongtien = 0, thuctra = 0, tienno = 0;
            string         sochungtu = "";
            string         sohoadon  = "";
            string         ghichu    = "";

            foreach (ChungTuBanHangInfor ct in LstPhieuPCGN)
            {
                sochungtu = sochungtu + ct.SoChungTu + ",";
                sohoadon  = sohoadon + ct.SoSeri + ",";
                ghichu    = ghichu + ct.GhiChu + ",";
                tongtien += ct.TongTienThanhToan;
                thuctra  += ct.TienThanhToanThuc;
                tienno   += ct.TienConNo;
            }
            if (LstPhieuPCGN.Count > 0)
            {
                DMNhanVienInfo nv = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(LstPhieuPCGN[0].IdNhanVien);
                hd.ThuongVien = (nv != null ? nv.HoTen : "");
            }

            hd.SoChungTu      = sochungtu;
            hd.SoHoaDon       = sohoadon;
            hd.NgayLap        = LstPhieuPCGN[0].NgayLap;
            hd.KhachHang      = LstPhieuPCGN[0].TenDoiTuong;
            hd.CongTy         = LstPhieuPCGN[0].CongTy;
            hd.HoTen          = LstPhieuPCGN[0].HoTen;
            hd.DiaChiHoaDon   = LstPhieuPCGN[0].DiaChiHoaDon;
            hd.DiaChiGiaoHang = LstPhieuPCGN[0].DiaChiGiaoHang;
            hd.DienThoai      = LstPhieuPCGN[0].DienThoai;
            DMKhoInfo dmKho = DMKhoDataProvider.GetKhoByIdInfo(LstPhieuPCGN[0].IdKho);

            if (dmKho != null)
            {
                hd.KhoXuat = dmKho.MaKho;
            }

            //hd.HinhThucThanhToan = LstPhieuPCGN[0];
            hd.CachGiaoHang      = LstPhieuPCGN[0].GiaoNhan != 0 ? "Giao tại nhà khách" : "Giao tại công ty";
            hd.TongTienHang      = tongtien;
            hd.TienThanhToanThuc = thuctra;
            hd.TienConNo         = tienno;

            //if (ListIdChungTu.Length > 0)
            //    ListIdChungTu = ListIdChungTu.Substring(0, ListIdChungTu.Length - 1);

            hd.NhanVienKinhDoanh = "";
            foreach (ChungTuGiaoNhanChiTietInfor ct in (BindingList <ChungTuGiaoNhanChiTietInfor>)gPhanCongGiaoNhan.DataSource)
            {
                hd.NhanVienKinhDoanh += String.Format("{0}(Phương tiện: {1})", ct.HoTen, ct.TenPhuongTien) +
                                        (String.IsNullOrEmpty(ct.BienSoXe) ? "" : "/" + ct.BienSoXe) + ";";
            }
            hd.GhiChu = ghichu;
            CommonFuns.Instance.InPhieuGiaoNhan(hd, liHangGiaoNhan, -1);
        }
Exemplo n.º 28
0
 private void frm_PhieuDeNghiNhapTieuHao_Load(object sender, EventArgs e)
 {
     if (OID == 0)
     {
         dteNgay.Text      = Convert.ToString(CommonProvider.Instance.GetSysDate());
         dteNgay.BackColor = Color.White;
         dteNgay.ForeColor = Color.Black;
         //bteTVDN.Text = Declare.UserName;
         txtSoPhieu.Text = CommonProvider.Instance.GetSoPhieu("PNTH");
         IsAdd           = true;
     }
     else
     {
         txtSoPhieu.Text      = SoChungTu;
         txtSoChungTuGoc.Text = SoChungTuGoc;
         DateTime Ngaylap = business.ChungTu.NgayLap;
         dteNgay.Text        = Ngaylap.ToString();
         bteTVDN.Text        = NguoiLap;
         bteNguoiQuanLy.Text = NguoiQuanLy;
         bteTVDN.Tag         = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(IdNhanVien);
         bteNguoiQuanLy.Tag  = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(IdNguoiQuanLy);
         bteTrungTam.Text    = TenTrungTam;
         bteTrungTam.Tag     = DMTrungTamDataProvider.GetTrungTamByIdInfo(IdTrungTam);
         bteKho.Text         = TenKho;
         bteKho.Tag          = DMKhoDataProvider.GetKhoByIdInfo(IdKho);
         txtGhiChu.Text      = GhiChu;
     }
     bdSource = new BindingSource();
     if (business.ListChiTietChungTu != null)
     {
         bdSource.DataSource = new BindingList <DeNghiXuatTieuHaoChiTietInfonew>(business.ListChiTietChungTu);
         bdSource.AddingNew += new AddingNewEventHandler(bdSource_AddingNew);
         grcList.DataSource  = bdSource;
     }
     btnXoaSP.Enabled   = false;
     btnCapNhat.Enabled = false;
     btnInPhieu.Enabled = false;
     dteNgay.Enabled    = false;
     if (trangThai == Convert.ToInt32(TrangThaiDuyet.DA_NHAP) || trangThai == Convert.ToInt32(TrangThaiDuyet.CHUA_NHAP))
     {
         btnInPhieu.Enabled      = true;
         btnThemSP.Enabled       = false;
         btnXoaSP.Enabled        = false;
         btnCapNhat.Enabled      = false;
         btnLoc.Enabled          = false;
         txtGhiChu.Enabled       = false;
         txtSoChungTuGoc.Enabled = false;
         bteTVDN.Enabled         = false;
         bteTrungTam.Enabled     = false;
         bteKho.Enabled          = false;
     }
     else if (LoaiChungTu == Convert.ToInt32(TransactionType.DE_NGHI_NHAP_TIEU_HAO))
     {
         bteKho.Enabled      = false;
         bteTrungTam.Enabled = false;
     }
     else
     {
         btnXoaSP.Enabled   = false;
         btnThemSP.Enabled  = false;
         btnCapNhat.Enabled = true;
     }
     LoadChiPhi();
     LoadPhongBan();
     LoadNganh();
 }
Exemplo n.º 29
0
        protected override void LoadDataInstance()
        {
            //bteKhodi.Enabled = false;
            if (chungTuInfo.IdKhoDieuChuyen != 0)
            {
                DMKhoInfo dmKho = DMKhoDataProvider.GetKhoByIdInfo(chungTuInfo.IdKhoDieuChuyen);
                bteKhoDen.Tag     = dmKho;
                bteKhoDen.Text    = dmKho.TenKho;
                bteKhoDen.Enabled = false;
            }
            else if (chungTuInfo.TenKho != null && chungTuInfo.LoaiChungTu == Convert.ToInt32(TransactionType.DE_NGHI_NHAN_DIEU_CHUYEN) ||
                     chungTuInfo.TenKho != null && chungTuInfo.LoaiChungTu == Convert.ToInt32(TransactionType.NHAN_DIEU_CHUYEN))
            {
                bteKhoDen.Text    = chungTuInfo.TenKho;
                bteKhoDen.Enabled = false;
            }

            if (chungTuInfo.IdKhoNhanCuoi != 0)
            {
                DMKhoInfo dmKho = DMKhoDataProvider.GetKhoByIdInfo(chungTuInfo.IdKhoNhanCuoi);
                bteKhoNhanCuoi.Tag     = dmKho;
                bteKhoNhanCuoi.Text    = dmKho.TenKho;
                bteKhoNhanCuoi.Enabled = false;
            }

            if (SoCTG != null)
            {
                ChungTuXuatDieuChuyenInfo chungTuXuatDieuChuyenInfor =
                    DeNghiNhapDieuChuyenDataProvider.Instance.GetListDNNDCBySoCT(SoCTG);
                if (chungTuXuatDieuChuyenInfor.IdKho != 0)
                {
                    DMKhoInfo dmKho = DMKhoDataProvider.GetKhoByIdInfo(chungTuXuatDieuChuyenInfor.IdKho);
                    bteKhoDi.Text    = dmKho.TenKho;
                    bteKhoDi.Enabled = false;
                }
            }
            else if (chungTuInfo.TenKho != null && chungTuInfo.LoaiChungTu == Convert.ToInt32(TransactionType.DE_NGHI_XUAT_DIEU_CHUYEN) ||
                     chungTuInfo.TenKho != null && chungTuInfo.LoaiChungTu == Convert.ToInt32(TransactionType.XUAT_DIEU_CHUYEN))
            {
                bteKhoDi.Text    = chungTuInfo.TenKho;
                bteKhoDi.Enabled = false;
            }
            else if (chungTuInfo.IdChungTu == 0)
            {
                bteKhoDi.Text = "";
            }

            if (chungTuInfo.GhiChu != null)
            {
                txtGhiChu.Text = chungTuInfo.GhiChu;
            }
            else
            {
                txtGhiChu.Text = "";
            }
            if (chungTuInfo.NguoiLap != null)
            {
                txtNguoiLap.Text = chungTuInfo.NguoiLap;
            }
            else
            {
                txtNguoiLap.Text = Declare.UserName;
            }
            txtHoaDonDC.Text   = chungTuInfo.HoaDonDC;
            txtPhuongtien.Text = chungTuInfo.PhuongTien;
            if (chungTuInfo.IdNguoiVC != 0)
            {
                DMNhanVienInfo dmNv = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(chungTuInfo.IdNguoiVC);
                bteNguoiVanChuyen.Tag  = dmNv;
                bteNguoiVanChuyen.Text = dmNv.HoTen;
            }

            if (chungTuInfo.IdNguoiUyNhiem != 0)
            {
                DMNhanVienInfo dmNv = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(chungTuInfo.IdNguoiUyNhiem);
                bteNguoiUyNhiem.Tag  = dmNv;
                bteNguoiUyNhiem.Text = dmNv.HoTen;
            }
            if (chungTuInfo.IdNguoiKyDuyet != 0)
            {
                DMNhanVienInfo dmNv = DmNhanVienDataProvider.GetListDmNhanVienInfoFromOid(chungTuInfo.IdNguoiKyDuyet);
                bteNguoiKyDuyet.Tag  = dmNv;
                bteNguoiKyDuyet.Text = dmNv.HoTen;
            }

            btnXoaSP.Enabled  = chungTuInfo.IdChungTu == 0;
            btnThemSP.Enabled = chungTuInfo.IdChungTu == 0;
        }
Exemplo n.º 30
0
        private void btnFilter_Click(object sender, EventArgs e)
        {
            #region old
            //            try {
//                string dk = "1=1";
//                if (!String.IsNullOrEmpty(txtFilterMa.Text)) {
//                    dk += String.Format(" and tbl_DM_NhanVien.MaNhanVien like '%{0}%'", txtFilterMa.Text);
//                }

//                if (!String.IsNullOrEmpty(txtFilterTen.Text)) {
//                    dk += String.Format(" and tbl_DM_NhanVien.HoTen like N'%{0}%'", txtFilterTen.Text);
//                }

//                if (cboPhongBanS.SelectedValue != null)
//                {
//                    dk += String.Format(" and tbl_DM_NhanVien.IdPhongBan = {0}", cboPhongBanS.SelectedValue);
//                }
//                if (cboChucDanhS.SelectedValue != null)
//                {
//                    dk += String.Format(" and tbl_DM_NhanVien.IdChucVu = {0}", cboChucDanhS.SelectedValue);
//                }

//                string sql = "SELECT     tbl_DM_NhanVien.IdNhanVien, tbl_DM_NhanVien.MaNhanVien, tbl_DM_NhanVien.HoTen, tbl_DM_NhanVien.NgaySinh, " +
//                            "tbl_DM_NhanVien.GioiTinh, tbl_DM_PhongBan.TenPhongBan, tbl_DM_ChucVu.TenChucVu, tbl_DM_NhanVien.DiaChi, tbl_DM_NhanVien.DienThoai, tbl_DM_NhanVien.SuDung, tbl_DM_NhanVien.Email, tbl_DM_NhanVien.GhiChu " +
//                "FROM         tbl_DM_NhanVien LEFT OUTER JOIN " +
//                            "tbl_DM_PhongBan ON tbl_DM_NhanVien.IdPhongBan = tbl_DM_PhongBan.IdPhongBan LEFT OUTER JOIN " +
//                            "tbl_DM_ChucVu ON tbl_DM_NhanVien.IdChucVu = tbl_DM_ChucVu.IdChucVu where " + dk;
//                DBTools.GridView_LoadData(dgvList, sql, true);
//                int index;
//                if (GridIndex == -1 || GridIndex >= dgvList.Rows.Count)
//                    index = 0;
//                else
//                    index = GridIndex;

//                if (dgvList.Rows.Count > 0) {
//                    dgvList.Rows[index].Selected = true;
//                    txtIdNhanVien.Text = dgvList[1, index].Value.ToString();
//                    txtMaNhanVien.Text = dgvList[2, index].Value.ToString();
//                    txtHoTen.Text = dgvList[3, index].Value.ToString();
//                    txtNgaySinh.Text = dgvList[4, index].Value.ToString();
//                    if (dgvList[5, index].Value.ToString() == "True") {
//                        optNam.Checked = true;
//                        optNu.Checked = false;
//                    }
//                    else {
//                        optNam.Checked = false;
//                        optNu.Checked = true;
//                    }
//                    cboPhongBan.Text = (dgvList[6, index].Value.ToString() == "") ? dgvList[6, index].Value.ToString() : "";
//                    cboChucVu.Text = (dgvList[7, index].Value.ToString() == "") ? dgvList[7, index].Value.ToString() : "";
//                    txtDiaChi.Text = dgvList[8, index].Value.ToString();
//                    txtDienThoai.Text = dgvList[9, index].Value.ToString();
//                    chkSuDung.Checked = Common.BoolValue(dgvList[10, index].Value.ToString());
//                    txtEmail.Text = dgvList[11, index].Value.ToString();
//                    txtGhiChu.Text = dgvList[12, index].Value.ToString();

//                    SetCheckListKho();
//                }
//                else {
//                    txtIdNhanVien.Text = "";
//                    txtMaNhanVien.Text = "";
//                    txtHoTen.Text = "";
//                    txtNgaySinh.Text = "";
//                    txtDiaChi.Text = "";
//                    txtDienThoai.Text = "";
//                    chkSuDung.Checked = false;
//                }
//            }
//            catch (System.Exception ex) {
//#if DEBUG
//                MessageBox.Show(ex.ToString());
//#else
//                MessageBox.Show(ex.Message);
//#endif
            //            }
            #endregion
            DMNhanVienInfo dm = new DMNhanVienInfo();
            dm.HoTen           = txtFilterTen.Text.Trim();
            dm.MaNhanVien      = txtFilterMa.Text.Trim();
            dm.IdChucVu        = Convert.ToInt32(cboChucDanhS.SelectedValue.ToString());
            dm.IdPhongBan      = Convert.ToInt32(cboPhongBanS.SelectedValue.ToString());
            dgvList.DataSource = DmNhanVienDataProvider.Search(dm);
        }