Ejemplo n.º 1
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if(txtname.Text == "")
     {
         MessageBox.Show("Please provide username");
     }
     else if (txtpass.Password == "")
     {
         MessageBox.Show("Please provide password");
     }
     else
     {
         ErrorLog elog = new ErrorLog();
         LoggedUser objUser = new LoggedUser();
  
         objUser.USERNAME = txtname.Text.ToLower();
         objUser.PASSWORD = txtpass.Password;
         ManagementServices objServices = new ManagementServices();
         DataSet dsUser = objServices.VerfiyingUserServices(objUser, ref elog);
         DataRow drow = dsUser.Tables[0].Rows[0];
         objUser.ROLEID = Convert.ToInt32(drow["user_role"].ToString());
         objUser.FULLNAME = drow["user_fullname"].ToString();
         objUser.USERID =Convert.ToInt32( drow["user_id"].ToString());
         if (dsUser != null && dsUser.Tables[0].Rows.Count > 0)
         {
             if(objUser.ROLEID==1)
             {
                 frmBookingDashboard obj = new frmBookingDashboard(objUser);
                 this.ShowInTaskbar = false;
                 obj.Show();
                 this.Close();
                 this.ShowInTaskbar = true;
             }
         }
         else
         {
             MessageBox.Show("You have entered invalid credentials");
         }
     }
 }
 public frmBookingDashboard(LoggedUser User)
 {
     MobjUser = User;
     InitializeComponent();
     this.Title = "Hello, "+MobjUser.FULLNAME;
 }
 public DataSet VerfiyingUserServices(LoggedUser user, ref ErrorLog elog)
 {
     VerifyingUser obj = new VerifyingUser();
     return obj.UserAttentication(ref elog, user.USERNAME, user.PASSWORD);
 }