Esempio n. 1
0
 // Event btnLogin in loginform
 private void btnLogin_Click(object sender, EventArgs e)
 {
     // check conditition
     if ((!this.childForm.txtUser.Text.Split().Equals("")) &&
         (!this.childForm.txtPass.Text.Split().Equals("")))
     {
         //Call BUS
         UserBUS BUS = new UserBUS();
         // CheckLogin
         if (BUS.CheckLogin(this.childForm.txtUser.Text, this.childForm.txtPass.Text))
         {
             //Check ID
             int i = BUS.CheckLogID(this.childForm.txtUser.Text, this.childForm.txtPass.Text);
             //If  is admin
             if (i == 1)
             {
                 //start adminform
                 childForm5 = new FormAdmin(this.childForm.txtUser.Text);
                 // creat childform in parent
                 childForm5.MdiParent = this;
                 childForm5.Dock      = DockStyle.Fill;
                 childForm5.Show();
                 childForm5.btnBack.Click += BtnBack_Click;
             }
             else
             {
                 //start userform
                 childForm2 = new FormLogin(i, this.childForm.txtUser.Text);
                 // creat childform in parent
                 childForm2.MdiParent = this;
                 childForm2.Dock      = DockStyle.Fill;
                 childForm2.Show();
                 childForm2.btnBack.Click += BtnBack_Click;
             }
         }
         else
         {
             MessageBox.Show("Username or Password not correct!");
         }
     }
 }