Example #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     UsersDAL user = new UsersDAL();
     UserDTO dto = new UserDTO();
     //----------------
     UserDTO dto1 = new UserDTO();
     dto1 = user.GetUserByLogin(login_txt.Text);
     //--------------
     if (checkIsEmptyField())
     {
         MessageBox.Show("Fill in the blank fields!");
     }
     else if (dto1.login == null)
     {
         dto.first_name = firstn_txt.Text;
         dto.last_name = lastn_txt.Text;
         dto.email = email_txt.Text;
         dto.phone_number = number_txt.Text;
         dto.login = login_txt.Text;
         dto.password = password_txt.Text;
         dto.id_role = 1;
         user.insertUser(dto);
         MagorPage m = new MagorPage();
         m.Show();
         clear_fun();
     }
     else 
     {
         MessageBox.Show("Input another login!");
     }
 }
 private void login_btn_Click(object sender, EventArgs e)
 {
     UsersDAL user = new UsersDAL();
     UserDTO dto1 = new UserDTO();
     dto1 = user.GetUserByLogin(login_txt.Text);
     UserDTO dto2 = new UserDTO();
     dto2 = user.GetUserByPassword(password_txt.Text);
     if ((dto1!=null)&&(dto2!=null))
     {
         if (dto1.id_user == dto2.id_user)
         {
             MagorPage m = new MagorPage();
             m.Show();
         }
     }
     else
         MessageBox.Show("Enter correct Login or Password! ");
 }