Esempio n. 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Window tellerwindow = new TellerWindow(employee);

            tellerwindow.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();
                }
            }
        }