コード例 #1
0
        private void btnHome_Click(object sender, EventArgs e)
        {
            DashboardView dashboardView = new DashboardView(loggedInUser);

            this.Hide();
            dashboardView.ShowDialog();
            this.Close();
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (ValidateChildren(ValidationConstraints.Enabled))
            {
                try
                {
                    string username = logUsernametxt.Text;
                    string password = logPasswordtxt.Text;

                    UserModelManager userModelManager = new UserModelManager();
                    Boolean          status           = userModelManager.loginUser(username, password);

                    if (status)
                    {
                        MessageBox.Show("User login Success");



                        UserModelManager userModelManager1 = new UserModelManager();
                        UserModel        loginuser         = userModelManager1.getUser(username);

                        this.Hide();

                        DashboardView dashboardView = new DashboardView(loginuser);
                        dashboardView.ShowDialog();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("ERROR" + "Password Mismatch");
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show("ERROR" + err);
                }
            }
        }