コード例 #1
0
        private void Loginbtn_Click(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("aaaaa");
            try
            {
                Console.WriteLine("validation start");
                string user = null;
                if ((bool)rbtnEmployee.IsChecked)
                {
                    user = "******";
                    Console.WriteLine("Is Employee");
                }
                else if ((bool)rbtnAdmin.IsChecked)
                {
                    user = "******";
                    Console.WriteLine("Is Admin");
                }

                int    userId   = Convert.ToInt32(txtUserId.Text);
                string password = txtPassword.Password.ToString();

                bool validateLogin = loginBLL.ValidateLoginBLL(userId, password, user);

                if (validateLogin)
                {
                    LoginEntity.UserID = userId;

                    loginEntity.UserPassword = password;


                    if (user == "Employee")
                    {
                        bool isManager = loginBLL.IsManagerBLL(userId);

                        bool addEmployeeDetails = AddEmployeeDetails(userId);

                        /*  // this is only for checking purpose that employee details added on class
                         * if(addEmployeeDetails)
                         * {
                         * ///MessageBox.Show("Employee details added success");
                         * Console.WriteLine("emp add details");
                         * Console.WriteLine(EmployeeEntity.ProjectID);
                         * Console.WriteLine(EmployeeEntity.EmployeeStatus);
                         * Console.WriteLine(EmployeeEntity.EmployeeName);
                         * Console.WriteLine(EmployeeEntity.EmployeeEmail);
                         * }
                         * else
                         * {
                         * MessageBox.Show("employee details not fatched");
                         * }*/

                        if (isManager)
                        {
                            ManagerHomePage managerHomePage = new ManagerHomePage();
                            this.Close();
                            managerHomePage.Show();
                        }
                        else
                        {
                            EmployeeHomePage employeeHomePage = new EmployeeHomePage();
                            this.Close();
                            employeeHomePage.Show();
                        }
                    }
                    else if (user == "Admin")
                    {
                        bool          addAdminDetails = AddAdminDetails(userId);
                        AdminHomePage adminHomePage   = new AdminHomePage();
                        this.Close();
                        adminHomePage.Show();
                    }
                    else
                    {
                        MessageBox.Show("something went wrong");
                    }
                }
                else
                {
                    MessageBox.Show("Please enter valid values...");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong....please try again ");
            }
        }
コード例 #2
0
        private void Loginbtn_Click(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("aaaaa");
            try
            {
                Console.WriteLine("validation start");
                string user = null;
                if ((bool)rbtnEmployee.IsChecked)
                {
                    user = "******";
                    Console.WriteLine("Is Employee");
                }
                else if ((bool)rbtnAdmin.IsChecked)
                {
                    user = "******";
                    Console.WriteLine("Is Admin");
                }

                int    userId   = Convert.ToInt32(txtUserId.Text);
                string password = txtPassword.Password.ToString();

                bool validateLogin = loginBLL.ValidateLoginBLL(userId, password, user);

                if (validateLogin)
                {
                    if (user == "Employee")
                    {
                        bool isManager = loginBLL.IsManagerBLL(userId);

                        if (isManager)
                        {
                            ManagerHomePage managerHomePage = new ManagerHomePage();
                            this.Close();
                            managerHomePage.Show();
                        }
                        else
                        {
                            EmployeeHomePage employeeHomePage = new EmployeeHomePage();
                            this.Close();
                            employeeHomePage.Show();
                        }
                    }
                    else if (user == "Admin")
                    {
                        AdminHomePage adminHomePage = new AdminHomePage();
                        this.Close();
                        adminHomePage.Show();
                    }
                    else
                    {
                        MessageBox.Show("something went wrong");
                    }
                }
                else
                {
                    MessageBox.Show("Please enter valid values...");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong....please try again ");
            }
        }