private void getAcademicYear(int OrgID) { try { EWA_Login objEWA = new EWA_Login(); BL_Login objBL = new BL_Login(); objEWA.OrgId = Convert.ToString(OrgID); DataSet ds = objBL.BL_GetAcademicYear(objEWA); if (ds.Tables[0].Rows.Count > 0) { CurrentAcademicYearId = ds.Tables[0].Rows[0]["AcademicYearId"].ToString(); CurrentAcademicYear = ds.Tables[0].Rows[0]["AcademicYear"].ToString(); Session["AcademicYearId"] = CurrentAcademicYearId; Session["AcademicYear"] = CurrentAcademicYear; } if (OrgID == 0 && CurrentAcademicYear == "") { // Response.Redirect("~/CMSHome.aspx"); } } catch (Exception exp) { // GeneralErr(exp.Message.ToString()); } }
public DataSet CheckUserLogin() { try { if (Session["OrgId"] == null) { Session["OrgId"] = Convert.ToInt32(DDL_SelectCollege.SelectedValue); } EWA_Login objEWA = new EWA_Login(); BL_Login objBL = new BL_Login(); string UserType = "0";// DDL_SelectAuthority.SelectedItem.ToString(); objEWA.UserType = UserType; objEWA.UserName = txtUserName.Text.Trim().ToString(); objEWA.Password = txtPassword.Text.Trim().ToString(); objEWA.OrgId = Convert.ToString(DDL_SelectCollege.SelectedValue); DataSet ds = objBL.CheckValidUser_BL(objEWA); return(ds); } catch (Exception exp) { // GeneralErr(exp.Message.ToString()); return(null); } }
public HttpResponseMessage Login(HttpRequestMessage req, DL_Login login) { if (!String.IsNullOrEmpty(login.Mobile) && !String.IsNullOrEmpty(login.Pass)) { BL_Login blLogin = new BL_Login(); List <DL_LoginReturn> dlLoginRet = blLogin.CheckLogin(login); //Validate Login if (blLogin._IsSuccess) { return(req.CreateResponse <List <DL_LoginReturn> >(HttpStatusCode.OK, dlLoginRet)); } else { return(req.CreateErrorResponse(HttpStatusCode.InternalServerError, "ServerError")); } } return(req.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad Request")); }
public HttpResponseMessage GetUserBalance(HttpRequestMessage req, int userId) { if (userId > 0) { User user = new User() { UserId = userId.ToString() }; BL_Login userBal = new BL_Login(); DL_UserBalanceReturn userBalanceReturn = userBal.GetUserBalace(user); if (userBal._IsSuccess) { return(req.CreateResponse <DL_UserBalanceReturn>(HttpStatusCode.OK, userBalanceReturn)); } return(req.CreateErrorResponse(HttpStatusCode.Unauthorized, "Unauthorized")); } return(req.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad Request")); } //
private DataSet CheckUserLogin() { DataSet ds = null; try { EWA_Login objEWA = new EWA_Login(); BL_Login objBL = new BL_Login(); objEWA.UserName = txtUserName.Text.Trim().ToString(); objEWA.Password = TxtPassword.Text.Trim().ToString(); objEWA.UserType = "SuperAdmin"; ds = objBL.CheckValidUser_BL(objEWA); } catch (Exception exp) { // Response.Redirect("~/CMSHome.aspx"); //throw exp; } return(ds); }
public HttpResponseMessage GetBankDetails(HttpRequestMessage req, User user) { // Logger.WriteLog(LogLevelL4N.INFO, "Called ForgotPassword api"); if (user != null && !String.IsNullOrEmpty(user.UserId) && !String.IsNullOrEmpty(user.Password)) { Validation.UserCheck(user); if (Validation._IsSuccess) { BL_Login account = new BL_Login(); List <DL_BankDetailsReturn> accountDetailsReturn = account.GetBankDetails(user); if (account._IsSuccess) { return(req.CreateResponse <List <DL_BankDetailsReturn> >(HttpStatusCode.OK, accountDetailsReturn)); } return(req.CreateErrorResponse(HttpStatusCode.InternalServerError, "ServerError")); } return(req.CreateErrorResponse(HttpStatusCode.Unauthorized, "Unauthorized")); } return(req.CreateErrorResponse(HttpStatusCode.BadRequest, "Bad Request")); }
protected void Login_Click(object sender, EventArgs e) { if (txtUsuario.Text != "") { if (txtContraseña.Text != "") { BL_Login User = new BL_Login(); var validlogin = User.LoginUser(txtUsuario.Text, GenerarMD5.crearMD5(txtContraseña.Text)); if (validlogin == true) { /* * Audit L = new Audit(); * L.Action = "El usuario " + txtUsuario.Text + " inició sesión en la aplicación"; * L.ActionDate = DateTime.Now; * L.Id = LoginCache.Id; * L.WriteLog(L); */ Session["usuarioNick"] = LoginCache.Nick; Session["usuarioNombre"] = LoginCache.Nombre; Session["usuarioApellido"] = LoginCache.Apellido; Response.Redirect("~/Inicio.aspx"); } else { Errormsg("Usuario/Contraseña inválido"); } } else { Errormsg("Ingrese su contraseña"); } } else { Errormsg("Ingrese su nombre de usuario"); } }
private void Login_Click(object sender, RoutedEventArgs e) { try { if (_Validation()) { PR_USERS oprUsers = new PR_USERS(); BL_Login oLogin = new BL_Login(); OperationResult opResult = new OperationResult(); AOS_ENCRYPTION oEncrypt = new AOS_ENCRYPTION(); oprUsers.USERNAME = txtUserName.Text.ToString(); oprUsers.PASSWORD = oEncrypt.Encrypt_data(txtPassword.Password.ToString()).ToString(); opResult = oLogin.ValidateLogin(oprUsers); if (txtUserName.Text == "admin" && txtPassword.Password == "bcil") { AOS_COMMON.UserName = txtUserName.Text; HOME oHome = new HOME(); oHome.Show(); this.Close(); opResult = OperationResult.ActiveUsers; } if (opResult == OperationResult.ActiveUsers) { opResult = oLogin.ValidateUserRights(oprUsers); if (opResult == OperationResult.Invalid) { AOS_COMMON.ShowErrorMsg("Application Version Changed,Pls Update,Contact Your IT Persion", MsgType.Error); txtUserName.Focus(); return; } AOS_COMMON.UserName = txtUserName.Text; HOME oHome = new HOME(); oHome.Show(); this.Close(); } else if (opResult == OperationResult.InActiveUsers) { AOS_COMMON.ShowErrorMsg("In-Active User", MsgType.Error); txtUserName.Focus(); } else if (opResult == OperationResult.Invalid) { AOS_COMMON.ShowErrorMsg("Invalid UserName Or Password", MsgType.Error); txtUserName.Text = string.Empty; txtPassword.Password = string.Empty; txtUserName.Focus(); } } } catch (Exception ex) { this.Cursor = Cursors.Arrow; AOS_COMMON.mAppLog.LogMessage(EventNotice.EventTypes.evtError, MethodBase.GetCurrentMethod().Name, ex.ToString()); AOS_COMMON.ShowErrorMsg(ex.ToString(), MsgType.Error); } }
private static string LoginCoreJSON(string UserName, string Password, string loginMode) { //List<JSONReturn> returnObj = new List<JSONReturn>(); LoginResponse returnObj = new LoginResponse(); if (new AiGrow.Business.BL_User().doesUserExist(UserName)) { string saltFromDb = new AiGrow.Business.BL_User().getUserSalt(new ML_User() { username = UserName }).Rows[0][0].ToString(); string userRole = new AiGrow.Business.BL_User().getUserRole(new ML_User() { username = UserName }); string[] encPassword = new CustomCryptography().encryptPassword(Password, saltFromDb); string password = encPassword[0]; string salt = encPassword[1]; DataTable loginTable = new AiGrow.Business.BL_User().checkLoginSecure(new ML_User() { password = password, username = UserName, salt = salt }); if (loginTable.Rows.Count == 1) { //User is active. Proceed with login. string tokenString = Encryption.createSHA1(loginMode + DateTime.Now.ToString() + UserName + Password); string userIDString = loginTable.Rows[0]["id_user"].ToString(); int loginID = new BL_Login().insert(new ML_Login() { login_mode = loginMode, login_token = tokenString, id_user = userIDString.ToInt() }); returnObj.credentials = UniversalProperties.VALID; returnObj.token = tokenString; returnObj.success = true; returnObj.loginID = loginID.ToString(); returnObj.userName = UserName; returnObj.userID = userIDString; returnObj.userRole = userRole; } else { returnObj.credentials = UniversalProperties.INVALID; returnObj.success = false; returnObj.errorMessage = UniversalProperties.userPassInvalid; returnObj.errorCode = UniversalProperties.EC_UserPassInvalid; } } else { returnObj.credentials = UniversalProperties.INVALID; returnObj.success = false; returnObj.errorMessage = UniversalProperties.noSuchUserFound; returnObj.errorCode = UniversalProperties.EC_NoSuchUserFound; } return(new JavaScriptSerializer().Serialize(returnObj)); }