Ejemplo n.º 1
0
        private void btn_Register_Click(object sender, EventArgs e)
        {
            if (Txt_FirstName.Text == "" || txt_LastName.Text == "" || txt_Email.Text == "" || Txt_Password.Text == "" || txt_CNIC.Text == "" || txt_Contact.Text == "")
            {
                MessageBox.Show("invalied entries in text boxes the cant be empty :(");
                return;
            }
            Server.Service1 server = new Server.Service1();
            bool            isregister;
            bool            ispassed;

            server.SRegisterAdmin(Txt_FirstName.Text, txt_LastName.Text, Txt_Password.Text, txt_Email.Text, txt_CNIC.Text, txt_Contact.Text, out isregister, out ispassed);
            if (ispassed)
            {
                if (isregister)
                {
                    MessageBox.Show("yayyyyy! u r registered from now u are an admin of or sunao");
                }
                else
                {
                    MessageBox.Show("oops there is already an admin here!");
                }
            }
            Txt_FirstName.Clear();
            txt_LastName.Clear();
            txt_Email.Clear();
            txt_Contact.Clear();
            Txt_Password.Clear();
            txt_CNIC.Clear();
        }
 private void Btn_LogIn_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(Txt_UserName.Text) || string.IsNullOrEmpty(Txt_Password.Text))
     {
         MetroMessageBox.Show(this, "User Name can not be Blank Or Password can not be Blank ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         Txt_UserName.Clear(); Txt_Password.Clear();
     }
     else
     {
         int count = log.LogIn(Txt_UserName.Text, Txt_Password.Text);
         if (count == 0)
         {
             count += 1;
             MetroMessageBox.Show(this, " Check User Name Or Password ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             Txt_Password.Clear();
         }
         else
         {
             string designation = log.GetDesignation(Txt_UserName.Text, Txt_Password.Text);
             if (designation == "Manager")
             {
                 Manager_Home_Form MHome = new Manager_Home_Form();
                 MHome.Show();
                 this.Hide();
             }
             else
             {
                 Employee_Registration_Form ER = new Employee_Registration_Form();
                 ER.Show();
             }
         }
     }
 }
Ejemplo n.º 3
0
        private void Btn_Login_Click(object sender, EventArgs e)
        {
            if (MaxAttempts == 0)
            {
                Close();
            }
            else
            {
                while (attempt <= MaxAttempts)
                {
                    if (Txt_Username.Text != username)
                    {
                        // username is incorrect
                        MessageBox.Show("Invalid username, " + (MaxAttempts - attempt) + " attempts remaining");
                        attempt++;
                        Txt_Username.Clear();
                        Txt_Password.Clear();
                        return;
                    }
                    else
                    {   // username is correct
                        // so check password
                        if (Txt_Password.Text != password)
                        {
                            // Incorrect password
                            attempt++;
                            MessageBox.Show("Incorrect password," + (MaxAttempts - attempt) + " attempts remaining");
                            Txt_Username.Clear();
                            Txt_Password.Clear();
                            return;
                        }
                        else
                        {
                            //Both are correct
                            attempt = 0; // reset the number of attempts
                            MessageBox.Show("Login successful");



                            Btn_Login.Text = "Logout";
                            Txt_Username.Clear();
                            Txt_Password.Clear();
                            // this.Width = 1600;
                            break; // come out of while loop
                        }//endif
                    }//endif
                }//end while
            }
        }
Ejemplo n.º 4
0
 private void Btn_Aceptar_Click(object sender, EventArgs e)
 {
     if (this.Validar())
     {
         Roles roles = new Roles(_idUsuario);
         if (roles.rol_name.Equals("") == true)
         {
             roles.ShowDialog();
         }
         else
         {
             Txt_Password.Clear();
             MenuInicial menu = new MenuInicial(_idUsuario);
             menu.LevantarRol(roles.rol_name);
             menu.ShowDialog();
         }
     }
 }
Ejemplo n.º 5
0
 public void Clear()
 {
     Txt_FirstName.Clear(); Txt_LastName.Clear(); Txt_UserName.Clear(); Txt_Password.Clear(); Txt_ConfirmPassword.Clear();
 }