Example #1
0
        private void lblCashier_Click(object sender, EventArgs e)
        {
            FAdminCashier fac = new FAdminCashier();

            fac.Show();
            this.Hide();
        }
 private void pbAdd_Click(object sender, EventArgs e)
 {
     if (txtUser.Text == "" || txtCoPass.Text == "")
     {
         MessageBox.Show("Please fill in the data");
     }
     else
     {
         if (txtIdCashier.Text == "full")
         {
             MessageBox.Show("account cashier has been full");
             FAdminCashier fac = new FAdminCashier();
             fac.Show();
             this.Hide();
         }
         else
         {
             if (txtPass.Text == txtCoPass.Text)
             {
                 if (txtUser.Text.Length < 5)
                 {
                     MessageBox.Show("Please enter username more than 5");
                 }
                 else if (txtUser.Text.Length > 15)
                 {
                     MessageBox.Show("username is too long, a maximum 15 characters");
                 }
                 else if (txtPass.Text.Length < 5)
                 {
                     MessageBox.Show("Please enter password more than 5");
                 }
                 else if (txtPass.Text.Length > 15)
                 {
                     MessageBox.Show("Password is too long, a maximum 15 characters");
                 }
                 else
                 {
                     string       lgnkasr = txtIdCashier.Text + "#" + txtUser.Text + "#" + txtPass.Text + "#";
                     StreamWriter sw      = new StreamWriter(@"Data\\cashierlogin.txt", true);
                     sw.WriteLine(lgnkasr);
                     sw.Close();
                     MessageBox.Show("account cashier has been added");
                     txtIdCashier.Clear();
                     txtPass.Clear();
                     txtCoPass.Clear();
                     txtUser.Clear();
                     txtUser.Focus();
                     txtIdCashier.Text = agcashier();
                 }
             }
             else
             {
                 MessageBox.Show("your password dosen't matched!");
                 txtCoPass.Clear();
             }
         }
     }
 }