Ejemplo n.º 1
0
 private void LoginFunction()
 {
     if (ValidateTextBoxes())
     {
         BOUser _bousr = _bausr.SelectUserDetail("GetUserDetail", txtEmailid.Text, Encryptdata(txtPassword.Password));
         if (_bousr != null)
         {
             if (_bousr.EndDate >= DateTime.Now)
             {
                 if (_bousr.ValidTimeTo >= DateTime.Now)
                 {
                     if (!string.IsNullOrEmpty(_bousr.AccessOption))
                     {
                         string[] accessoption = _bousr.AccessOption.Split(',');
                         exists = accessoption.Contains("3");
                     }
                     else if (!string.IsNullOrEmpty(_bousr.UGAccessOption))
                     {
                         string[] accessoption = _bousr.UGAccessOption.Split(',');
                         exists = accessoption.Contains("3");
                     }
                     if (exists)
                     {
                         Application.Current.Properties["Bouser"] = _bousr;
                         if (txtPassword.Password == Decryptdata(_bousr.AccessPassword))
                         {
                             this.Hide();
                             MainWindow _mainWindow = new ExamSimulator.MainWindow();
                             _mainWindow.ShowDialog();
                         }
                         else
                         {
                             MessageBox.Show("Email Id or Password Invalid", "Message", MessageBoxButton.OK, MessageBoxImage.Warning);
                             txtEmailid.Text = txtPassword.Password = "";
                             txtEmailid.Focus();
                         }
                     }
                     else
                     {
                         MessageBox.Show("You are not authorized to Offline Exam");
                     }
                 }
                 else
                 {
                     MessageBox.Show("Your account is expired. contact to merchant");
                 }
             }
             else
             {
                 MessageBox.Show("Your account has been expired, please contact your merchant");
             }
         }
         else
         {
             MessageBox.Show("Email Id or Password Invalid");
         }
     }
 }
Ejemplo n.º 2
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         if (!string.IsNullOrEmpty(txtEmailId.Text) && !string.IsNullOrEmpty(txtPassword.Text))
         {
             BOUser _bousr = _bausr.SelectUserDetail("GetUserDetail", txtEmailId.Text, Encryptdata(txtPassword.Text));
             if (_bousr != null)
             {
                 if (_bousr.EndDate >= DateTime.Now)
                 {
                     if (_bousr.ValidTimeTo >= DateTime.Now)
                     {
                         if (txtPassword.Text == Decryptdata(_bousr.AccessPassword))
                         {
                             Session["Userid"]     = _bousr.UserId;
                             Session["UserDetail"] = _bousr;
                             if (Session["Userid"] != null)
                             {
                                 Response.Redirect("UserLogin.aspx", false);
                             }
                         }
                         else
                         {
                             lblerror.InnerText = "Password invalid";
                             lblerror.Attributes.Add("Style", "display: block;color: #D8000C;");
                             txtPassword.Focus();
                         }
                     }
                     else
                     {
                         lblerror.InnerText = "Your account is expired. contact to merchant";
                         lblerror.Attributes.Add("Style", "display: block;color: #D8000C;");
                     }
                 }
                 else
                 {
                     lblerror.InnerText = "Your account has been expired, please contact your merchant";
                     lblerror.Attributes.Add("Style", "display: block;color: #D8000C;");
                 }
             }
             else
             {
                 lblerror.InnerText = "Email Id or Password invalid";
                 lblerror.Attributes.Add("Style", "display: block;color: #D8000C;");
                 txtEmailId.Focus();
             }
         }
         else
         {
             lblerror.InnerText = "Please Enter Correct Email Id/Password";
             lblerror.Attributes.Add("Style", "display: block;color: #D8000C;");
             txtEmailId.Focus();
         }
     }
     catch (Exception ex)
     {
         Common.LogError(ex);
         lblerror.InnerText = "Server not respond";
         lblerror.Attributes.Add("Style", "display: block;color: #D8000C;");
     }
 }