Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool work = false;

            label4.Text = "";
            string query = @"select * from Account where username='******' and password='******' and position='site administrator'";

            ds.Clear();
            da.SelectCommand = new SqlCommand(query, db);
            db.Open();
            da.Fill(ds);
            db.Close();
            if (ds.Tables[0].Rows.Count > 0)
            {
                ManageUserAccount mg = new ManageUserAccount();
                this.Hide();
                mg.ShowDialog();
                this.Show();
                textBox1.Text = textBox2.Text = "";
                work          = true;
            }
            else if (work == false)
            {
                query = @"select * from Account where username='******' and password='******' and position='secretary'";
                ds.Clear();
                da.SelectCommand = new SqlCommand(query, db);
                db.Open();
                da.Fill(ds);
                db.Close();
                if (ds.Tables[0].Rows.Count > 0)
                {
                    SecretaryWindow sc = new SecretaryWindow();
                    this.Hide();
                    sc.ShowDialog();
                    this.Show();
                    textBox1.Text = textBox2.Text = "";
                    work          = true;
                }
                else if (work == false)
                {
                    query = @"select * from Account where username='******' and password='******' and position='officer'";
                    ds.Clear();
                    da.SelectCommand = new SqlCommand(query, db);
                    db.Open();
                    da.Fill(ds);
                    db.Close();
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        OfficerWindow of = new OfficerWindow();
                        this.Hide();
                        of.ShowDialog();
                        this.Show();
                        textBox1.Text = textBox2.Text = "";
                        work          = true;
                    }
                    else if (work == false)
                    {
                        query = @"select * from Account where username='******' and password='******' and position='post women'";
                        ds.Clear();
                        da.SelectCommand = new SqlCommand(query, db);
                        db.Open();
                        da.Fill(ds);
                        db.Close();
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            PostwomenWindow pw = new PostwomenWindow();
                            this.Hide();
                            pw.ShowDialog();
                            this.Show();
                            textBox1.Text = textBox2.Text = "";
                            work          = true;
                        }
                        else
                        {
                            label4.Text = "warning : wrong user name or password";
                        }
                    }
                }
            }
        }
Пример #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            ManageUserAccount mg = new ManageUserAccount();

            mg.Show();
        }