Пример #1
0
        private void button7_Click(object sender, EventArgs e)
        {
            this.Hide();
            var MainHome = new MainHome(_currentUser);// create new window

            MainHome.FormClosed += (s, args) => this.Close();
            MainHome.Show();// Showing the Login window
        }
Пример #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            this.Hide();                                //hides the current form
            MainHome mh = new MainHome(user);           // maybe send the userType with it

            mh.FormClosed += (s, args) => this.Close(); // close the login Form
            mh.Show();
        }
Пример #3
0
        private void button7_Click(object sender, EventArgs e) //mainhome button
        {
            this.Hide();                                       // Hiding the Explorerbike Window
            var mainHome = new MainHome(_currentUser);         // create new window

            mainHome.FormClosed += (s, args) => this.Close();
            mainHome.Show();// Showing the Login window
        }
Пример #4
0
        private void signin_Click(object sender, EventArgs e) // login button
        {
            //NOT OPTIMAL
            //if Assembler : select which one (id, name)?
            //elif representative
            //elif Product manager
            string userType = comboBox1.Text;
            string userName = textBox1.Text;

            Console.WriteLine("user List prob : " + app.getUserList().Count);;
            bool isExisting = app.getUserList().Any(login => login.login == userName);

            if (!isExisting)
            {
                MessageBox.Show("The Username or password is incorrect, please try again or create a new user!");
            }
            else
            {
                if (userType == "Representative")
                {
                    int index = app.getUserList().FindIndex(a => a.login == userName);
                    this.Hide();                                          //hides the current form
                    MainHome mh = new MainHome(app.getUserList()[index]); // maybe send the userType with it
                    mh.FormClosed += (s, args) => this.Close();           // close the login Form
                    mh.Show();
                }
                if (userType == "Assembler")
                {
                    int index = app.getUserList().FindIndex(a => a.login == userName);
                    this.Hide();                                                               //hides the current form
                    Assembler_MainHome amh = new Assembler_MainHome(app.getUserList()[index]); // maybe send the userType with it
                    amh.FormClosed += (s, args) => this.Close();                               // close the login Form
                    amh.Show();
                }
                if (userType == "Production Manager")
                {
                    int index = app.getUserList().FindIndex(a => a.login == userName);
                    this.Hide();                                                           //hides the current form
                    Manager_MainHome mmh = new Manager_MainHome(app.getUserList()[index]); // maybe send the userType with it
                    mmh.FormClosed += (s, args) => this.Close();                           // close the login Form
                    mmh.Show();
                }
            }
        }
Пример #5
0
        private void signin_Click(object sender, EventArgs e) // login button
        {
            string userType   = comboBox1.Text;
            string userName   = textBox1.Text;
            bool   isExisting = app.userList.Any(login => login.login == userName);

            if (!isExisting)
            {
                MessageBox.Show("The Username or password is incorrect, please try again !");
            }
            else
            {
                var user = app.userList.FirstOrDefault(x => x.login == userName);
                var type = user.userType.FirstOrDefault(x => x.Value == true).Key;
                if (type == userType)
                {
                    this.Hide(); //hides the current form
                    switch (type)
                    {
                    case "Representative":
                        MainHome mh = new MainHome(user);           // maybe send the userType with it
                        mh.FormClosed += (s, args) => this.Close(); // close the login Form
                        mh.Show();
                        break;

                    case "Assembler":
                        Assembler_MainHome amh = new Assembler_MainHome(user); // maybe send the userType with it
                        amh.FormClosed += (s, args) => this.Close();           // close the login Form
                        amh.Show();
                        break;

                    case "Production Manager":
                        Manager_MainHome mmh = new Manager_MainHome(user); // maybe send the userType with it
                        mmh.FormClosed += (s, args) => this.Close();       // close the login Form
                        mmh.Show();
                        break;
                    }
                }
                else
                {
                    MessageBox.Show("You didn't chose the correct userType !");
                }
            }
        }