public List <UserRoleRights> GetUserModuleMenu(string UserID, int MainMenuID, string _commandText) { List <UserRoleRights> ObjMenu = new List <UserRoleRights>(); LoginBL Bl = new LoginBL(); ObjMenu = Bl.GetUserModuleMenu(UserID, MainMenuID, _commandText); return(ObjMenu); }
public void TestGetCurrentUser() { Assert.AreEqual(LoginBL.SetCurrentUser("@gmail234"), false); Assert.AreEqual(LoginBL.SetCurrentUser("@gmail"), true); LoginBL.SetCurrentUser("@gmail"); Assert.AreEqual(true, LoginBL.ChekPasswordForCurrentUser("1234")); Assert.AreEqual(false, LoginBL.ChekPasswordForCurrentUser("12349898")); }
public static List <Roles_Model> Userpagedetails(string username, string User_type) { LoginBL log = new LoginBL(); List <Roles_Model> logdetails = log.GetPagebyroles(username, User_type); return(logdetails); }
//Authenticate User public bool AuthenticateUser(Credentials credential, out string error, out string ReturnURL) { Exception exError; LoginBL Bl = new LoginBL(); bool val = Bl.AuthenticateByADS(credential, out exError, out ReturnURL); error = exError == null ? "" : exError.Message; return(val); }
protected void Page_Load(object sender, EventArgs e) { loginBl = new LoginBL(); lblRole.Text = (string)Session["UserRole"]; lblUserName.Text = (string)Session["UserName"]; lblContactNo.Text = (string)Session["ContactNo"]; lblEmail.Text = (string)Session["Email"]; }
public string GetUserID(string UserName) { Credentials cred = new Credentials(); cred.UserName = UserName; LoginBL Bl = new LoginBL(); return(Bl.GetUser(cred)); }
//User Logs public string InsertUpdateEmployeeLogs(EmployeeLogs EmployeeLogsBO, out string error) { Exception exError; LoginBL Bl = new LoginBL(); string val = Bl.InsertUpdateEmployeeLogs(EmployeeLogsBO, out exError); error = exError == null ? "" : exError.Message; return(val); }
//Reset Password public bool ResetPassword(Credentials credential, out string error) { Exception exError; LoginBL Bl = new LoginBL(); bool val = Bl.ResetPassword(credential, out exError); error = exError == null ? "" : exError.Message; return(val); }
//Forget password public bool ForgetPassword(string username, string email, out string error) { Exception exError; LoginBL Bl = new LoginBL(); bool val = Bl.ForgetPassword(username, email, out exError); error = exError == null ? "" : exError.Message; return(val); }
private void btnIngresar_Click(object sender, EventArgs e) { DataTable dataTable = new DataTable(); LoginBE loginBE = new LoginBE(); LoginBL loginBL = new LoginBL(); loginBE.user1 = txtUser.Text.Trim(); loginBE.pass = txtPassword.Text.Trim(); dataTable = loginBL.IngresarUsuario(loginBE.user1, loginBE.pass); if (txtUser.Text.Trim() != "" & txtPassword.Text.Trim() != "") { if (dataTable.Rows.Count == 1) { loginBE.user1 = dataTable.Rows[0][0].ToString(); loginBE.pass = dataTable.Rows[0][1].ToString(); this.Hide(); timer1.Enabled = false; MDIPrincipal mdi = new MDIPrincipal(); mdi.ShowDialog(); this.Visible = true; tiempo = 20; txtUser.Text = String.Empty; txtPassword.Text = String.Empty; txtUser.Focus(); timer1.Enabled = true; } else { MessageBox.Show("Wrong username or password", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); intentos += 1; if (intentos == 3) { this.Close(); } } } else { MessageBox.Show("Username or Password required", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); intentos += 1; } if (intentos == 3) { MessageBox.Show("We're sorry, number of attemps exceeded", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } }
public ActionResult Index(LoginModel obj) { Session["LoginSuccesFull"] = null; if (ModelState.IsValid) { if (obj.UserName == "admin" && obj.Password == "admin123") { LoginModel _login = new LoginModel(); _login.Name = "Admin"; _login.RathoreDetailId = 0; _login.Role = 99; Session["LoginSuccesFull"] = _login; return(RedirectToAction("Index", "Home", new { area = "Admin" })); } else { LoginBL _loginBL = new LoginBL(); //Session["LoginSuccesFull"] = null; LoginModel result = _loginBL.CheckLoginDetail(obj); ViewBag.Saved = true; if (result != null && result.Name != string.Empty) { _loginBL.UpdateLoginInfoDetail(result); Session["LoginSuccesFull"] = result; return(RedirectToAction("Index", "Home", new { area = "Admin" })); } else { @ViewBag.Message = "Please provide valid username and password."; return(View(obj)); } } //LoginBL _loginBL = new LoginBL(); //Session["LoginSuccesFull"] = null; //LoginModel result = _loginBL.CheckLoginDetail(obj); //ViewBag.Saved = true; //if (result != null && result.Name != string.Empty) //{ // _loginBL.UpdateLoginInfoDetail(result); // Session["LoginSuccesFull"] = result; // return RedirectToAction("Index", "Home", new { area = "Admin" }); //} //else //{ // @ViewBag.Message = "तकनिकी खराबी की वजह से आपका सन्देश नहीं मिला , कृपया दुबारा भेजे. "; //} } return(View(obj)); }
private void Page_Loaded(object sender, RoutedEventArgs e) { cboDepart.ItemsSource = LoginBL.GetInstance().GetDepartmentsList(); cboDepart.DisplayMemberPath = "DepartName"; cboPaysheetMode.ItemsSource = LoginBL.GetInstance().GetPaysheetModeList(); cboPaysheetMode.DisplayMemberPath = "PaysheetModeName"; cboEmployee.ItemsSource = LoginBL.GetInstance().GetEmployeeList(); cboEmployee.DisplayMemberPath = "Name"; cboEmployeeP.ItemsSource = LoginBL.GetInstance().GetEmployeeList(); cboEmployeeP.DisplayMemberPath = "Name"; }
void ExportarExcel(string filename) { Excel._Application xlApp; Excel._Workbook xlLibro; Excel._Worksheet xlHoja; Excel.Sheets xlHojas; xlApp = new Excel.Application(); filename = Path.Combine(Directory.GetCurrentDirectory(), "Excel\\Login.xlsx"); xlLibro = xlApp.Workbooks.Open(filename, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); xlHojas = xlLibro.Sheets; xlHoja = (Excel._Worksheet)xlHojas[1]; Cursor.Current = Cursors.WaitCursor; try { int Row = 6; int Secuencia = 1; List <LoginBE> lstLogin = null; lstLogin = new LoginBL().ListaTodosActivo(); if (lstLogin.Count > 0) { xlHoja.Shapes.AddPicture(Path.Combine(Directory.GetCurrentDirectory(), "Logo.jpg"), Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue, 1, 1, 100, 60); foreach (var item in lstLogin) { xlHoja.Cells[Row, 1] = item.IdLogin; xlHoja.Cells[Row, 2] = item.NameProfile; xlHoja.Cells[Row, 3] = item.Login; xlHoja.Cells[Row, 4] = item.NameLogin; Row = Row + 1; Secuencia = Secuencia + 1; } } xlLibro.SaveAs("C:\\Excel\\Login.xlsx", Excel.XlFileFormat.xlWorkbookDefault, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Excel.XlSaveAsAccessMode.xlExclusive, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); xlLibro.Close(true, Missing.Value, Missing.Value); xlApp.Quit(); Cursor.Current = Cursors.Default; BSUtils.OpenExcel("C:\\Excel\\Login.xlsx"); //XtraMessageBox.Show("It was imported correctly \n The file was generated C:\\Excel\\Login.xlsx", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { xlLibro.Close(false, Missing.Value, Missing.Value); xlApp.Quit(); Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public FormPrincipal(int idUsuario, int idrol) { InitializeComponent(); timer1.Enabled = true; this.idUsuario = idUsuario; this.idRol = idrol; loginBL = new LoginBL(); consultarDatosUsuario(idUsuario); }
public ActionResult UserLogin(LoginModel loginObj, string returnUrl) { try { LoginBL loginBl = new LoginBL(); // UserRolesDetail rol = new UserRolesDetail(); LoginEntity loginEntity = new LoginEntity(); LoginEntity newloginEntity = new LoginEntity(); Roles_Model rm = new Roles_Model(); LoginModel loginmodel = new LoginModel(); int i = 0; // string UserType = ""; if (ModelState.IsValid) { loginEntity.UserName = loginObj.UserName; loginEntity.Password = loginObj.Password; i = loginBl.UserLoginCheck(loginEntity); if (i == 1) { newloginEntity = loginBl.GetUserDetails(loginEntity); Session["Username"] = newloginEntity.UserName; Session["UserType"] = newloginEntity.UserType; Session["Password"] = newloginEntity.Password; Session["UserPage"] = newloginEntity.Userpage; Session["Controler_Name"] = newloginEntity.ActionName; FormsAuthentication.SetAuthCookie(Session["Username"].ToString(), false); Username = Session["Username"].ToString(); // int IsAuth=loginBl.UserPageAuth(Session["Username"].ToString(), Session["UserType"].ToString()); var Toppage = loginBl.GetTopPageMenu(Session["Username"].ToString()); return(Redirect(returnUrl ?? Url.Action(Toppage.Userpage, Toppage.ActionName))); // return RedirectToAction(Toppage.Userpage.ToString(), Toppage.Controller_Name.ToString()); } ModelState.AddModelError("", "Incorrect Username and Password"); Session["Username"] = ""; Session["Password"] = ""; Session["UserType"] = ""; Session["UserId"] = ""; } } catch (Exception ex) { } return(View("LoginPage")); }
private void btnOk_Click(object sender, EventArgs e) { if (IsNewUser) { LoginBL.CurrentUser = new UserDTO(); } LoginBL.CurrentUser.Mail = tbLogin.Text; LoginBL.CurrentUser.FirstName = tbFirstName.Text; LoginBL.CurrentUser.LastName = tbLastName.Text; LoginBL.CurrentUser.RoleId = 4; if (rbMale.Checked) { LoginBL.CurrentUser.Gender = "Male"; } else { LoginBL.CurrentUser.Gender = "Female"; } LoginBL.CurrentUser.Address = tbAdress.Text; LoginBL.CurrentUser.Tel = tbTel.Text; LoginBL.CurrentUser.BankCard = tbBankCard.Text; SecurityDTO sd = new SecurityDTO(); sd.KeyWord = tbKeyWord.Text; sd.UserId = LoginBL.CurrentUser.Id; if (tbPassword.Text != tbReenterPassword.Text) { MessageBox.Show("Paswwords not equel!"); return; } sd.Password = tbPassword.Text; if (IsNewUser == false) { LoginBL.UpdateUser(LoginBL.CurrentUser, sd, pbImage.ImageLocation); } else { LoginBL.CreateNewUser(LoginBL.CurrentUser, sd, pbImage.ImageLocation); } Close(); }
private void btnUpdateUser_Click(object sender, RoutedEventArgs e) { var editUser = new Login_FT { Id = cboUser.SelectedIndex + 1, Login_name = txtUserUpdate.Text, Login_pass = txtPassUpdate.Password, Question = txtQuestUpdate.Text, Answer = txtAmwserUpdate.Password, IsActive = cboStatusAccUpdate.SelectedIndex + 1, Roles = cboRolesUpdate.SelectedIndex + 1, Id_employee = idEmployeeUpdate }; try { if (txtPassUpdate.Password == txtPass2Update.Password) { LoginBL.GetInstance().UpdateUser(editUser); cboUser.SelectedIndex = -1; cboStatusAccUpdate.SelectedIndex = -1; cboRolesUpdate.SelectedIndex = -1; txtUserUpdate.Clear(); txtPassUpdate.Clear(); txtPass2Update.Clear(); txtQuestUpdate.Clear(); txtAmwserUpdate.Clear(); MessageBoxRM.Show("Usuario actualizado correctamente!", "Actualizacion Usuario", MessageBoxButtonRM.OK, MessageBoxIconRM.Information); } else { ToolTip toolTip = new ToolTip(); toolTip.PlacementTarget = txtPass2Update; txtPass2Update.ToolTip = toolTip; toolTip.Content = "La contraseña no coinciden"; ToolTipService.SetShowDuration(txtPass2Update, 4000); ToolTipService.SetPlacement(txtPass2Update, System.Windows.Controls.Primitives.PlacementMode.Bottom); txtPass2Update.BorderBrush = Brushes.Red; txtPass2Update.BorderThickness = new Thickness(1, 1, 1, 1); bdrValidation.Visibility = Visibility.Visible; validationIcon = bdrValidationIcon.Pass; timer.Start(); } } catch (Exception ex) { MessageBoxRM.Show(ex.InnerException.Message, "Erro al actualizar usuario", MessageBoxButtonRM.OK, MessageBoxIconRM.Error); } }
// [Authorize] public ActionResult UserLogin(LoginModel loginObj, string returnUrl) { try { LoginBL loginBl = new LoginBL(); LoginEntity loginEntity = new LoginEntity(); LoginEntity newloginEntity = new LoginEntity(); Roles_Model rm = new Roles_Model(); LoginModel loginmodel = new LoginModel(); int i = 0; if (ModelState.IsValid) { loginEntity.UserName = loginObj.UserName; loginEntity.Password = loginObj.Password; i = loginBl.UserLoginCheck(loginEntity); if (i == 1) { newloginEntity = loginBl.GetUserDetails(loginEntity); Session["Username"] = newloginEntity.UserName; Session["UserType"] = newloginEntity.UserType; Session["Password"] = newloginEntity.Password; Session["UserPage"] = newloginEntity.Userpage; Session["Controler_Name"] = newloginEntity.ActionName; Session["UserID"] = Convert.ToString(newloginEntity.UserId); string Loginame = Request.Form["UserName"].ToString(); Username = Session["Username"].ToString(); Password = Session["Password"].ToString(); if (Loginame.ToUpper() == Username.ToUpper()) { FormsAuthentication.SetAuthCookie(Session["Username"].ToString(), true); var Toppage = loginBl.GetTopPageMenu(Session["Username"].ToString()); return(Redirect(returnUrl ?? Url.Action(Toppage.Userpage, Toppage.ActionName))); } } ModelState.AddModelError("", "Incorrect Username and Password"); Session["Username"] = ""; Session["Password"] = ""; Session["UserType"] = ""; Session["UserId"] = ""; FormsAuthentication.SignOut(); Session.Abandon(); } } catch (Exception ex) { } return(View("LoginPage")); }
public bool UserAuthentication() { bool validUser = false; if (HttpContext.Current.Session["UserRole"] != null) { validUser = true; } else { LoginBL loginBL = new LoginBL(); DataTable dtUserInfo = new DataTable(); string sUser = WebUtility.HtmlDecode(System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString()); dtUserInfo = loginBL.UserAuthentication(sUser, out iErrorId, out sErrorMsg); if (dtUserInfo.Rows.Count > 0) { HttpContext.Current.Session["UserCode"] = dtUserInfo.Rows[0]["user_code"].ToString(); HttpContext.Current.Session["UserRole"] = dtUserInfo.Rows[0]["role_desc"].ToString(); HttpContext.Current.Session["UserRoleId"] = dtUserInfo.Rows[0]["role_id"].ToString(); HttpContext.Current.Session["UserPaymentRoleId"] = dtUserInfo.Rows[0]["payment_role_id"].ToString(); validUser = true; } else { //WUIN-1082 string WARSSupportUserList = ConfigurationManager.AppSettings["WARSSupportUserList"].ToString(); if (Array.IndexOf(WARSSupportUserList.ToLower().Split(','), sUser.ToLower()) >= 0) { sUser = ConfigurationManager.AppSettings["WARSSupportUserId"].ToString(); } dtUserInfo = loginBL.UserAuthentication(sUser, out iErrorId, out sErrorMsg); if (dtUserInfo.Rows.Count > 0) { HttpContext.Current.Session["UserCode"] = dtUserInfo.Rows[0]["user_code"].ToString(); HttpContext.Current.Session["UserRole"] = dtUserInfo.Rows[0]["role_desc"].ToString(); HttpContext.Current.Session["UserRoleId"] = dtUserInfo.Rows[0]["role_id"].ToString(); HttpContext.Current.Session["UserPaymentRoleId"] = dtUserInfo.Rows[0]["payment_role_id"].ToString(); validUser = true; } } loginBL = null; } return(validUser); }
/// <summary> /// Called on btn login click. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnLogin_Click(object sender, EventArgs e) { // If login is valid if (valForm.IsValid) { // Create an instance of the Login business logic. LoginBL loginBL = new LoginBL(); // Retrieve and store the user ID in session. Context.Session["UserID"] = loginBL.GetUserID(txtUsername.Text, txtPassword.Text); // Redirect to requested page or default page. FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, true); } }
protected void Button1_Click(object sender, EventArgs e) { List <Admin> _LoginUser = new List <Admin>(); List <Student> _StudentUser = new List <Student>(); _LoginBL = new LoginBL(); _studentBL = new StudentBL(); if (rdolibrary.Checked == true) { try { _LoginUser = _LoginBL.BL_LoginAuthentication(txtuname.Text, txtupass.Text); if (_LoginUser.Count > 0) { Session["aid"] = _LoginUser[0].AID.ToString(); Session["email"] = _LoginUser[0].UserName.ToString(); Session["name"] = _LoginUser[0].NAME.ToString(); Response.Redirect("Home.aspx", false); } else { lbl.Text = "Invalid Credential"; } } catch (Exception ex) { Response.Redirect("The Error is " + ex); } finally { } } else { _StudentUser = _studentBL.BL_StudentAuthentication(txtuname.Text, txtupass.Text); if (_StudentUser.Count > 0) { Session["sid"] = _StudentUser[0].SID.ToString(); Session["email"] = txtuname.Text; Response.Redirect("Student_Page/Default.aspx"); } else { lbl.Text = "Invalid Credential"; } } }
public ActionResult <LoginResponseModel> Login([FromBody] LoginInputModel data) { try { LoginBL loginBL = new LoginBL(DbContext); return(loginBL.Login(data.UserName, data.Password)); } catch (Exception ex) { LoginResponseModel logres = new LoginResponseModel(); logres.Message = ex.Message; logres.Response = false; return(logres); } }
private void btnPurchase_Click(object sender, RoutedEventArgs e) { try { var supplQuery = new Supplier { Supplier1 = cboSuppl.SelectedValue.ToString() }; var merchQuery = new Merchandise { Name = cboMerch.SelectedValue.ToString() }; int IdMerch = MerLogic.GetInstance().GetMerchId(merchQuery); int IdSuppl = MerLogic.GetInstance().GetIdSuppl(supplQuery); int AmountP = Convert.ToInt32(txtCostPur.Text); int Qty = Convert.ToInt32(txtCant.Text); int IdUser = LoginBL.GetInstance().IdUser; var purchase = new purchase_of_merchandise { Detail = txtDetail.Text, Amount = AmountP, Date_purchase = DateTime.Now, Quantity = Qty, Id_merchandise = IdMerch, Id_supplier = IdSuppl, Id_user = IdUser }; var updateMerch = new Merchandise() { Id = IdMerch, Stock = Qty, Name = cboMerch.SelectedValue.ToString() }; MerLogic.GetInstance().RegisterPofMerch(purchase, updateMerch); MessageBoxRM.Show("Compra registrada correctamente!", "Registro de compras", MessageBoxButtonRM.OK, MessageBoxIconRM.Information); txtDetail.Clear(); txtCant.Clear(); txtCostPur.Clear(); cboMerch.SelectedIndex = -1; cboSuppl.SelectedIndex = -1; RechargeAllCboS(); } catch (Exception ex) { MessageBoxRM.Show(ex.Message, "Ha ocurrido un error :(", MessageBoxButtonRM.OK, MessageBoxIconRM.Error); } }
private void btnGrabar_Click(object sender, EventArgs e) { try { Cursor = Cursors.WaitCursor; if (!ValidarIngreso()) { Encrypt objCrypto = new Encrypt(Encrypt.CryptoProvider.Rijndael); objCrypto.Key = Parametros.Key; objCrypto.IV = Parametros.IV; string Password = ""; Password = objCrypto.CifrarCadena(this.txtPassword.Text.Trim()); LoginBL objBL_Login = new LoginBL(); LoginBE objLogin = new LoginBE(); objLogin.IdCompany = int.Parse(cboEmpresa.EditValue.ToString()); objLogin.IdProfile = int.Parse(cboPerfil.EditValue.ToString()); objLogin.IdEmployee = intIdEmployee; objLogin.NameLogin = txtPersona.Text.Trim(); objLogin.Login = txtUsuario.Text.Trim(); objLogin.Password = Password; objLogin.FlagMaster = chkMaster.Checked; objLogin.FlagState = chkEstado.Checked; objLogin.LoginCrea = Parametros.strUsuarioLogin; objLogin.Machine = WindowsIdentity.GetCurrent().Name.ToString(); objLogin.IdCompany = Parametros.intEmpresaId; if (pOperacion == Operacion.Nuevo) { objBL_Login.Inserta(objLogin, pListaAccesoUsuario, pListaLoginClientDepartment); } else if (pOperacion == Operacion.Modificar) { objLogin.IdLogin = pLoginBE.IdLogin; objBL_Login.Actualiza(objLogin, pListaAccesoUsuario, pListaLoginClientDepartment); } this.Close(); } } catch (Exception ex) { Cursor = Cursors.Default; XtraMessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ActionResult Login(LoginVM loginVM, string ReturnUrl) { LoginBL loginBL = new LoginBL(); if (loginBL.isValidUser(loginVM)) { FormsAuthentication.SetAuthCookie(loginVM.username, false); if (ReturnUrl == null) { return(RedirectToAction("Index", "Discussion")); } return(Redirect(ReturnUrl)); } ModelState.AddModelError("CreditentialError", "Creditential Error"); return(View("Login")); }
//User Logs when Logs Out public void InsertUpdateEmployeeLogs(int LoginUserID, int EmployeeLogID, int StatusID) { Exception exError; LoginBL Bl = new LoginBL(); EmployeeLogs EmployeeLogsBO = new EmployeeLogs(); EmployeeLogsBO.StatusID = StatusID; EmployeeLogsBO.LoggedOutTime = DateTime.Now; EmployeeLogsBO.LastAccessedTime = DateTime.Now; EmployeeLogsBO.UserLogin = ""; EmployeeLogsBO.EmployeeID = LoginUserID; EmployeeLogsBO.EmployeeLogID = EmployeeLogID; string val = Bl.InsertUpdateEmployeeLogs(EmployeeLogsBO, out exError); val = exError == null ? val : exError.Message; }
protected void Page_Load(object sender, EventArgs e) { Guid key; if (Guid.TryParse(Request.QueryString["id"], out key)) { LoginBL logBl = new LoginBL(key); if (!logBl.ResetLinkExpired) { hdUserID.Value = logBl.ResetUserID; } else { divExpired.Visible = true; } } }
protected void btnok_Click(object sender, EventArgs e) { HttpCookie PPRCookie = Request.Cookies.Get("PPRCookie"); if (PPRCookie != null) { PPRCookie.Expires = DateTime.Now.AddDays(-20D); Response.Cookies.Add(PPRCookie); PPRCookie.Values.Add("Rolls", null); PPRCookie.Values.Add("LoginId", null); PPRCookie.Values.Add("UserId", null); PPRCookie.Values.Add("passwordSaltedHash", null); PPRCookie.Values.Add("passwordSalt", null); } if (Session["IsLoggedIn"] != null && IsAuthenticationTokenMatching()) { Session["IsLoggedIn"] = null; LoginBL obj = new LoginBL(); obj.LogEntryBL("User Logs Out", ""); Session["IsLoggedIn"] = null; Session.Clear(); Session.Abandon(); Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", "") { HttpOnly = true }); if (Request.Cookies[".GISAUTH"] != null) { HttpCookie authCookie = new HttpCookie(".GISAUTH", "nothing"); authCookie.HttpOnly = true; authCookie.Expires = DateTime.Now.AddDays(-20D); Response.Cookies.Add(authCookie); Response.Cookies.Add(new HttpCookie(".GISAUTH", "") { HttpOnly = true }); } Session["LoggedOut"] = "true"; Response.Redirect("~/login.aspx"); } else { } }
public void TestMethod1() { var CountEF = LoginBL.GetInstance().GetDepartmentsList().Count; Assert.IsNotNull(CountEF); var CountEF2 = LoginBL.GetInstance().GetRoleList().Count; Assert.IsNotNull(CountEF2); var CountEF3 = LoginBL.GetInstance().GetPaysheetModeList().Count; Assert.IsNotNull(CountEF3); var CountEF4 = LoginBL.GetInstance().GetStatusAccList().Count; Assert.IsNotNull(CountEF4); }
private void btnEntrar_Click(object sender, EventArgs e) { string validate = LoginBL.ValidatedUsuario(txtUsuario.Text, txtClave.Text); if (validate.Length > 0) { guardaRango = validate; this.Hide(); PrincipalForm abril = new PrincipalForm(); abril.ShowDialog(); Application.Exit(); } else { MessageBox.Show("Clave de acceso Errada", "Error de login", MessageBoxButtons.OK, MessageBoxIcon.Error); txtClave.Text = ""; txtUsuario.Focus(); } }