Esempio n. 1
0
        private void backbutton(object sender, RoutedEventArgs e)
        {
            Window a = new ManagerWindow(employee);

            a.Show();
            this.Close();
        }
Esempio n. 2
0
        private void fire(object sender, RoutedEventArgs e)
        {
            if (action.Equals("request"))
            {
                DataTable dt3 = new DataTable();
                dt3 = connect.executeQuery("select * from fire where employeeid = '" + view.id + "' and acceptedby = 'Manager'");
                if (dt3.Rows.Count == 0)
                {
                    connect.executeUpdate("insert into fire values ('" + view.id + "', 'Pending', 'HRM')");
                }
                else
                {
                    DataTable dt4 = new DataTable();
                    dt4 = connect.executeQuery("select * from fire where employeeid = '" + view.id + "' and status = 'Accepted' and acceptedby = 'Manager'");
                    if (dt4.Rows.Count == 0)
                    {
                        connect.executeUpdate("update fire set status ='Accepted' where employeeid = '" + view.id + "' and acceptedby = 'Manager'");
                        connect.executeUpdate("update employee set status = 'Inactive' where id = '" + view.id + "'");
                        MessageBox.Show("Done Firing!");
                        Window b = new ManagerWindow(employee);
                        b.Show();
                        this.Close();
                        return;
                    }
                    else
                    {
                        MessageBox.Show("You have accepted this fire request!");
                        Window b = new ManagerWindow(employee);
                        b.Show();
                        this.Close();
                        return;
                    }
                }
            }
            else
            {
                connect.executeQuery("update fire set status ='Accepted' where employeeid = '" + view.id + "' and acceptedby = 'Manager'");
                connect.executeQuery("update employee set status ='Inactive' where id = '" + view.id + "'");
            }
            MessageBox.Show("Done!");
            Window a = new ManagerWindow(employee);

            a.Show();
            this.Close();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (username.Text == "")
            {
                MessageBox.Show("USERNAME MUST NOT BE EMPTY!");
                return;
            }
            if (password.Password == "")
            {
                MessageBox.Show("PASSWORD MUST NOT BE EMPTY!");
                return;
            }

            string id   = username.Text;
            string pass = password.Password;


            DataTable dt = new DataTable();

            dt = connect.executeQuery("select * from employee where id = '" + id + "' and password = '******' and status = 'Active' limit 1");

            if (dt.Rows.Count == 0)
            {
                MessageBox.Show("Invalid Username/Password!");
                return;
            }
            else
            {
                DataRow  data = dt.Rows[0];
                Employee emp  = new Employee(data["id"].ToString(), data["name"].ToString(), data["password"].ToString(), Int32.Parse(data["salary"].ToString()), float.Parse(data["rating"].ToString()), Int32.Parse(data["ratecount"].ToString()));
                MessageBox.Show("Success!");
                if (id[0] == 'T')
                {
                    Window tellerwindow = new TellerWindow(emp);
                    tellerwindow.Show();
                    this.Close();
                }
                else if (id[0] == 'C')
                {
                    Window cswindow = new CustomerService.CSWindow(emp);
                    cswindow.Show();
                    this.Close();
                }
                else if (id[0] == 'S')
                {
                    Window swindow = new Security_and_Maintenance_Team.SMWindow(emp);
                    swindow.Show();
                    this.Close();
                }
                else if (id[0] == 'M')
                {
                    Window mwindow = new Manager.ManagerWindow(emp);
                    mwindow.Show();
                    this.Close();
                }
                else if (id[0] == 'H')
                {
                    Window hwindow = new Human_Resource_Management_Team.HRMWindow(emp);
                    hwindow.Show();
                    this.Close();
                }
                else if (id[0] == 'F')
                {
                    Window fwindow = new Finance.FinanceWindow(emp);
                    fwindow.Show();
                    this.Close();
                }
            }
        }