Ejemplo n.º 1
0
        private void ProjectHub_FormClosing(object sender, FormClosingEventArgs e)
        {
            try
            {
                using (var context = new DemoBoxDBContext())
                {
                    var query = from x in context.Employees
                                where x.EmployeeEmail == email
                                select x.EmployeeRole;


                    foreach (var s in query)
                    {
                        if (s == 1)
                        {
                            this.Hide();
                            ProjectManagerUI pm = new ProjectManagerUI(email);
                            pm.ShowDialog();
                            this.Close();
                        }
                        else if (s == 2)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 3)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 4)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 5)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 6)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                    }
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 2
0
        // // // // // // //


        //Login Completed
        // // // // // // //
        private void loginDoneButton_Click(object sender, EventArgs e)
        {
            if (loginEmailTextBox.Text == null || loginPasswordTextBox.Text == null)
            {
                MessageBox.Show("Enter your Email and Password!!");
            }

            try
            {
                string email = loginEmailTextBox.Text;
                string pass  = loginPasswordTextBox.Text;
                using (var context = new DemoBoxDBContext())
                {
                    var query = from x in context.Employees
                                where x.EmployeeEmail == email && x.EmployeePassword == pass
                                select x.EmployeeRole;


                    foreach (var s in query)
                    {
                        if (s == 1)
                        {
                            this.Hide();
                            ProjectManagerUI pm = new ProjectManagerUI(email);
                            pm.ShowDialog();
                            this.Close();
                        }
                        else if (s == 2)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 3)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 4)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 5)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }
                        else if (s == 6)
                        {
                            this.Hide();
                            EmployeeManagement em = new EmployeeManagement(email, s);
                            em.ShowDialog();
                            this.Close();
                        }

                        else if (s == 0)
                        {
                            MetroFramework.MetroMessageBox.Show(this, "Your Account Hasn't Confirmed Yet");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("" + ex);
            }
        }