Example #1
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            string password;
            IUserLayer LayerUser = new UserLayer();
            lstUser = LayerUser.GetAllUsers();
            if (txt_userID.Text == "" || Txt_Password.Text == "")
            {
                clsWin.WarningMessage("Please fill the login required!!", "Oops");
                txt_userID.Focus();
                return;
            }

            var query = (from a in lstUser where a.UserID == txt_userID.Text select a).ToList();

            if (query.Count == 0)
            {
                clsWin.WarningMessage("User ID is not register!", "Oops");
                txt_userID.Focus();
                return;
            }

            password = crypto.Decrypt(query[0].Password.ToString(), true);

            if (password != Txt_Password.Text.ToString())
            {
                clsWin.WarningMessage("User ID Or Password is incorrect", "Oops");
                clsWin.ClearWindowsObJect(panelEx1);
                txt_userID.Focus();
                return;
            }
            _frmMain.toolUser.Text = txt_userID.Text;
            _frmMain.bubbleBar1.Visible = true;
            _frmMain.activeuser = txt_userID.Text;
            _frmMain.userID = LayerUser.GetGUID(txt_userID.Text);
              //  gen.UserActive = txt_userID.Text.ToString();
            this.Close();
        }
Example #2
0
        private void Frm_Login_Load(object sender, EventArgs e)
        {
            try
            {
                IUserLayer LayerUser = new UserLayer();
                lstUser = LayerUser.GetAllUsers();
            }
            catch (Exception)
            {

                if (clsWin.QuestionMessage("Connection to database failed, are you want to sett the connection?", "Lost Connection"))
                {

                    frm_connection connect = new frm_connection();
                    // Find_Part.MdiParent = Frm_Menu;
                    connect.StartPosition = FormStartPosition.CenterScreen;
                    connect.ShowDialog();
                    this.Refresh();
                }
                else
                {
                    Application.Exit();
                }

            }
        }