private void newAccountToolStripMenuItem_Click(object sender, EventArgs e)
        {
            User_Account op4 = new User_Account();

            op4.ShowDialog();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            un = ""; ut = "";

            if (txt_AD_UserN.Text != "" && txt_AD_Pass.Text != "")
            {
                if (txt_AD_UserN.Text == own_un && txt_AD_Pass.Text == own_pw)
                {
                    Login loo = new Login();
                    Log_main.plod.Controls.Clear();
                    loo.TopLevel = false;
                    loo.Visible  = true;
                    Log_main.plod.Controls.Add(loo);
                    User_Account nhome = new User_Account();
                    nhome.ShowDialog();

                    //this.Close();
                }
                else
                {
                    SqlDataReader accdr = op2.select(txt_AD_UserN.Text, txt_AD_Pass.Text);
                    if (accdr.Read())
                    {
                        ut = accdr["User_Type"].ToString();
                        if (ut == "Administrator")
                        {
                            Log_main.plod.Controls.Clear();
                            Login loo = new Login();
                            loo.TopLevel = false;
                            loo.Visible  = true;
                            Log_main.plod.Controls.Add(loo);
                            User_Account nhome = new User_Account();
                            nhome.ShowDialog();



                            // this.Close();
                        }
                        else
                        {
                            toolTip1.Show("Thia Details not an Administrator ", button1, 1500);
                        }
                    }
                    else
                    {
                        if (MessageBox.Show("The username or password you entered is incorrect", "Sharp Creation", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK)
                        {
                            txt_AD_Pass.Clear();
                            txt_AD_UserN.Clear();
                            check++;

                            if (check == 6)
                            {
                                Application.Exit();
                            }
                        }
                    }
                }
            }
            else
            {
                if (txt_AD_UserN.Text == "")
                {
                    toolTip1.Show("Enter User Name", txt_AD_UserN, 1000);
                }
                if (txt_AD_Pass.Text == "")
                {
                    toolTip2.Show("Enter Passward", txt_AD_Pass, 1000);
                }
            }
        }