Beispiel #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Window back = new SMWindow(employee);

            back.Show();
            this.Close();
        }
Beispiel #2
0
        private void submit(object sender, RoutedEventArgs e)
        {
            string itemid = itemtxt.Text;

            dt = new DataTable();
            dt = connect.executeQuery("select * from item where itemid = '" + itemid + "' limit 1");

            if (dt.Rows.Count == 0)
            {
                label.Content = "Invalid item!";
                return;
            }
            else
            {
                data = dt.Rows[0];
                string emp = data["employee"].ToString();
                if (data["itemstatus"].ToString() == "Broken")
                {
                    label.Content = "Item is already reported!";
                    return;
                }
                else
                {
                    MessageBox.Show("Success Reporting Item");

                    if (emp[0] == 'T')
                    {
                        connect.executeUpdate("insert into schedule values ('" + itemid + "', 'Teller " + data["itemname"].ToString() + "', CURRENT_DATE + (SELECT((COUNT(*) + 1) / 3) + 1 from item where itemstatus = 'Broken'),'Not Fixed')");
                    }
                    else
                    {
                        connect.executeUpdate("insert into schedule values ('" + itemid + "', '" + data["itemname"].ToString() + "', CURRENT_DATE + (SELECT((COUNT(*) + 1) / 3) + 1 from item where itemstatus = 'Broken'),'Not Fixed')");
                    }

                    connect.executeUpdate("update item set itemstatus = 'Broken' where itemid = '" + itemid + "'");

                    Window back = new SMWindow(employee);
                    back.Show();
                    this.Close();
                }
            }
        }
Beispiel #3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            int cost = Int32.Parse(costtxt.Text);

            if (cost < 0)
            {
                MessageBox.Show("Invalid Cost!");
                return;
            }
            else
            {
                connect.executeUpdate("insert into banktransaction values ('" + item.itemid + "', 'Repair Cost', " + cost + ",'Security & Maintenance Team', current_Date)");
                connect.executeQuery("insert into financenotif values ('Security & Maintenance', '" + employee.id + "', 'Repair Cost'," + Int32.Parse(costtxt.Text.ToString()) + ")");
                connect.executeUpdate("update item set itemstatus = 'OK' where itemid = '" + item.itemid + "'");

                connect.executeUpdate("delete from schedule where itemid = '" + item.itemid + "'");

                MessageBox.Show("Success!");
                Window main = new SMWindow(employee);
                main.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();
                }
            }
        }