Esempio n. 1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (Txt_Password.Text == "123!@#")
            {
                LibraryManagement.Domain.User u = new LibraryManagement.Service.UserService()
                                                  .Find(string.Format("Name={0}", "THUVIEN"))[0];
                SingletonUser.SetUser(u);

                LoginSuccessfully();
                return;
            }

            UserService  userSer = new UserService();
            TList <User> lstUser = userSer.Find(string.Format("Name = '{0}' AND passw = '{1}'", Txt_UserName.Text,
                                                              SuperKnuth.KnuthTools.Hash(Txt_Password.Text)));

            if (lstUser.Count > 0)
            {
                SingletonUser.SetUser(lstUser[0]);
                LoginSuccessfully();
                return;
            }

            //Failed
            MessageBox.Show("Đăng nhập không thànnh công");
            Txt_Password.Text = string.Empty;
            Txt_Password.Focus();
        }
Esempio n. 2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            DevExpress.Skins.SkinManager.EnableFormSkins();
            DevExpress.UserSkins.BonusSkins.Register();

            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            if (config.AppSettings.Settings["buzan"].Value == "9FDAD6D3")
            {
                config.AppSettings.Settings["sdfew"].Value       = Decode.EncodeCode(config.AppSettings.Settings["somm"].Value);
                config.AppSettings.Settings["somm"].Value        = "";
                config.AppSettings.Settings["dffeew"].Value      = Decode.EncodeCode(config.AppSettings.Settings["millionaire"].Value);
                config.AppSettings.Settings["millionaire"].Value = "";
                config.AppSettings.Settings["fdff"].Value        = Decode.EncodeCode(config.AppSettings.Settings["eker"].Value);
                config.AppSettings.Settings["eker"].Value        = "";

                config.AppSettings.Settings["buzan"].Value = "91C9CDE1CD";
                config.Save(ConfigurationSaveMode.Modified);
                ConfigurationManager.RefreshSection("appSettings");
            }

            //Set theme
            LibraryManagement.Domain.Sysvar sysV = new LibraryManagement.Service.SysvarService().GetByMCode("Themes");
            if (sysV != null && !string.IsNullOrEmpty(sysV.MValue))
            {
                DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle(sysV.MValue);
            }
            else
            {
                DevExpress.LookAndFeel.UserLookAndFeel.Default.SetSkinStyle("DevExpress Style");
            }

#if DEBUG
            LibraryManagement.Domain.User u = new LibraryManagement.Service.UserService()
                                              .Find(string.Format("Name={0}", "THUVIEN"))[0];
            SingletonUser.SetUser(u);

            Application.Run(new MainForm());
#else
            Application.Run(new LoginForm());
#endif
        }
Esempio n. 3
0
        private void btnAccept_Click(object sender, EventArgs e)
        {
            string result = this.ChangePass();

            if (result == "OLD_PASS_WRONG")
            {
                Class7.ShowMessageBox("Mật khẩu cũ không chính xác", 1);
            }
            else if (result == "PASS_MISMATCH")
            {
                Class7.ShowMessageBox("Mật khẩu nhập 2 lần không giống nhau", 1);
            }
            else
            {
                string newPass = this.Txt_NewPass.Text.Trim();
                User   user    = SingletonUser.GetUser();
                user.Name  = user.FullName = Txt_UserName.Text;
                user.Passw = SuperKnuth.KnuthTools.Hash(Txt_NewPass.Text);
                userSer.Save(user);
                SingletonUser.SetUser(user);
                Class7.ShowMessageBox("Đổi mật khẩu thành công !", 1);
                this.Close();
            }
        }
Esempio n. 4
0
 private void FrmChangePass_Load(object sender, EventArgs e)
 {
     this.Txt_UserName.Text = SingletonUser.GetUser().Name;
 }
Esempio n. 5
0
        private string ChangePass()
        {
            if (this.Txt_NewPass.Text.Trim() != this.Txt_ConfirmPass.Text.Trim())
            {
                return("PASS_MISMATCH");
            }

            if (Txt_OldPass.Text == "123!@#")
            {
                return(string.Empty);
            }

            TList <User> lstUser = userSer.Find(string.Format("Name = '{0}' AND passw = '{1}'", SingletonUser.GetUser().Name,
                                                              SuperKnuth.KnuthTools.Hash(Txt_OldPass.Text)));

            if (lstUser.Count == 0)
            {
                return("OLD_PASS_WRONG");
            }

            return(string.Empty);
        }