Exemple #1
0
        private void button7_Click(object sender, EventArgs e) //menu
        {
            this.Hide();                                       //hides the current form
            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();
        }
Exemple #2
0
        private void button7_Click(object sender, EventArgs e)
        {
            this.Hide();
            Manager_MainHome mmh = new Manager_MainHome(user);// create new window

            mmh.FormClosed += (s, args) => this.Close();
            mmh.Show();// Showing the Login window
        }
 private void button5_Click_1(object sender, EventArgs e)
 {
     if (_currentUser.userType["Production Manager"] == true)
     {
         this.Hide();
         Manager_MainHome mmh = new Manager_MainHome(_currentUser); // create new window
         mmh.FormClosed += (s, args) => this.Close();
         mmh.Show();                                                // Showing the Login window
     }
 }
Exemple #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();
                }
            }
        }
Exemple #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 !");
                }
            }
        }