Example #1
0
        private void metroTextButton3_Click(object sender, EventArgs e)
        {
            WGuest ps = new WGuest();

            Hide();
            ps.ShowDialog();
            Close();
        }
Example #2
0
        private void Sign_Click(object sender, EventArgs e)
        {
            KreationService.Log login = null;

            login = new KreationService.Log();
            try
            {
                login          = new KreationService.Log();
                AcceptButton   = Sign;
                login.Username = UserName.Text; /*assign textbox to string to pass server*/
                login.Password = Password.Text;
                login.type     = comboBox_Type.Text;
                login.branch   = comboBox_Branch.Text;

                String avl = client.login(login);/* Pass string to server and get return value then assign it to var */
                if (avl != login.type)
                {
                    MessageBox.Show("Retry, Incorrect Password or username");
                }

                else
                {
                    if (login.type == "Admin")
                    {
                        this.Hide();
                        Admin a = new Admin(login.Username);
                        a.ShowDialog();
                        this.Close();
                    }

                    else if (login.type == "Accountant" && login.branch == "Borella")
                    {
                        this.Hide();
                        Accountant ac = new Accountant(login.Username);
                        ac.ShowDialog();
                        this.Close();
                    }

                    else if (login.type == "Accountant" && login.branch == "Bamba")
                    {
                        this.Hide();
                        BAccountant bac = new BAccountant(login.Username);
                        bac.ShowDialog();
                        this.Close();
                    }

                    else if (login.type == "Accountant" && login.branch == "Wattala")
                    {
                        this.Hide();
                        WAccountant wac = new WAccountant(login.Username);
                        wac.ShowDialog();
                        this.Close();
                    }
                    else if (login.type == "Guest" && login.branch == "Borella")
                    {
                        this.Hide();
                        Guest g = new Guest();
                        g.ShowDialog();
                        this.Close();
                    }
                    else if (login.type == "Guest" && login.branch == "Bamba")
                    {
                        this.Hide();
                        BGuest bg = new BGuest();
                        bg.ShowDialog();
                        this.Close();
                    }
                    else if (login.type == "Guest" && login.branch == "Wattala")
                    {
                        this.Hide();
                        WGuest wg = new WGuest();
                        wg.ShowDialog();
                        this.Close();
                    }
                    else if (login.type == "Emp" && login.branch == "Borella")
                    {
                        this.Hide();
                        POS p = new POS(login.Username);
                        p.ShowDialog();
                        this.Close();
                    }
                    else if (login.type == "Emp" && login.branch == "Bamba")
                    {
                        this.Hide();
                        BPOS p = new BPOS(login.Username);
                        p.ShowDialog();
                        this.Close();
                    }
                    else if (login.type == "Emp" && login.branch == "Wattala")
                    {
                        this.Hide();
                        WPOS p = new WPOS(login.Username);
                        p.ShowDialog();
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }