コード例 #1
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            List <KiemTra> kiemTras = new List <KiemTra>()
            {
                new KiemTra()
                {
                    _Control = txtMatKhauCu, _ChoQuaThang = TMD5.TMd5Hash(txtMatKhauCu.Text) == DuLieuTaoSan.NV.MatKhauCty, _ThongBao2 = "Mật khẩu sai"
                },
                new KiemTra()
                {
                    _Control = txtMatKhauMoi
                },
                new KiemTra()
                {
                    _Control = iMatKhauCty, _ChoQuaThang = iMatKhauCty.Text == txtMatKhauMoi.Text, _ThongBao2 = "Mật khẩu mới không khớp"
                }
            };

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic.Add("MatKhauCty", TMD5.TMd5Hash(iMatKhauCty.Text));

            if (XuLyGiaoDien.ThongBao(Text, new D_DAILY().CapNhat(dic, DuLieuTaoSan.NV.ID) > 0))
            {
                Close();
            }
        }
コード例 #2
0
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            List <KiemTra> kiemTras = new List <KiemTra>();

            kiemTras.Add(new KiemTra()
            {
                _Control = iTenDangNhapCty, _Tu = 5, _Den = 30, _ChoQua = !_DaiLyD.DaTonTai("TenDangNhapCty", iTenDangNhapCty.Text, _KhachHangO.ID), _ThongBao2 = "Đã tồn tại"
            });
            kiemTras.Add(new KiemTra()
            {
                _Control = txtMatKhauCty, _Tu = 5, _Den = 30, _ChoQuaThang = !txtMatKhauCty.Enabled
            });

            XuLyGiaoDien.KiemTra(kiemTras, dxValidationProvider1);
            if (!dxValidationProvider1.Validate())
            {
                XuLyGiaoDien.Alert("Thông tin không hợp lệ", Form_Alert.enmType.Warning);
                return;
            }

            Dictionary <string, object> dic = new Dictionary <string, object>();

            dic = XuLyDuLieu.FormToDictionary(this, dic);
            dic.Add("Ten", iTenDangNhapCty.Text);
            if (txtMatKhauCty.Enabled)
            {
                dic.Add("MatKhauCty", TMD5.TMd5Hash(txtMatKhauCty.Text));
            }
            dic.Add("LoaiKhachHang", 0);
            NguoiThanKhach(false);
            dic.Add("ThongTinLienLac", _HoHang);
            long a = (_KhachHangO.ID > 0) ? _DaiLyD.CapNhat(dic, _KhachHangO.ID) : _DaiLyD.ThemMoi(dic, true);

            if (XuLyGiaoDien.ThongBao(Text, a > 0))
            {
                if (_KhachHangO.ID < 1)
                {
                    List <Dictionary <string, object> > lstDicS = new List <Dictionary <string, object> >();
                    for (int i = 0; i < 90; i++)
                    {
                        dic = new Dictionary <string, object>();
                        dic.Add("LoaiKhachHangSD", _KhachHangO.LoaiKhachHang);
                        dic.Add("ChinhSachID", iChinhSach.EditValue);
                        dic.Add("DaiLyID", a);
                        dic.Add("Ngay", "getdate() - " + i);
                        lstDicS.Add(dic);
                    }
                    new D_SODU_DAILY().ThemNhieu1Ban(lstDicS);
                }
                (Owner.ActiveMdiChild as frmNhanVien).DuLieu();
                Close();
            }
        }
コード例 #3
0
        void isLogin()
        {
            D_NHOMQUYEN    nqb = new D_NHOMQUYEN();
            D_DAILY        nvb = new D_DAILY();
            List <O_DAILY> nvo = nvb.NhanVien(txtUserName.Text, TMD5.TMd5Hash(txtPassword.Text));

            if (nvo.Count == 1)
            {
                if (!nvo[0].Nghi)
                {
                    RegistryKey key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\THCRM", true);
                    if (key == null)
                    {
                        key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\THCRM");
                    }

                    if (chk.Checked)
                    {
                        key.SetValue("cmra", txtUserName.Text);
                        key.SetValue("cmrp", txtPassword.Text);
                    }
                    else
                    {
                        key.SetValue("cmra", string.Empty);
                        key.SetValue("cmrp", string.Empty);
                    }
                    key.Close();

                    DuLieuTaoSan.NV = nvo[0];
                    DuLieuTaoSan.Q  = (nvo[0].TenDangNhapCty.ToLower().Equals("itadmin")) ? nqb.QuyenAdmin() : nqb.LayQuyenNhanVien(nvo[0].ChinhSach);
                    frmChinh f = new frmChinh();
                    XuLyGiaoDien.SplashScreen(f);
                    TopMost = false;
                    Hide();
                    f.Show(this);
                }

                else
                {
                    XtraMessageBox.Show("Tài khoản đã bị khóa vui lòng liên hệ ban quản lý...", "T-CMR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                XtraMessageBox.Show("Sai tên đăng nhập hoặc mật khẩu...", "T-CMR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }