public ActionResult Register(UserMasterBO user) { bool isSuccess = false; if (ModelState.IsValid) { //isSuccess = UserBusinessInstance.SubmitUser(user) > 0 ? true : false; } else { ViewBag.Message = "Model Validation error"; } int myuser; if (isSuccess) { myuser = user.UserID; ModelState.Clear(); ViewBag.Message = "Success!"; } else { ViewBag.Message = "Fail"; } return(View()); }
public JsonResponse <UserMasterBO> Login(string email, string password) { JsonResponse <UserMasterBO> response = new JsonResponse <UserMasterBO>(); UserMasterBO user = UserBusinessInstance.UserLogin(email, password); //.Where(x => x.cemailaddress == email && x.cpassword == password).FirstOrDefault(); response.SingleResult = user; return(response); }
public UserMasterBO UserLogin(string email, string password) { UserMasterBO user = new UserMasterBO(); UserMaster result = UserRepository.UserLogin(email, password); user = mapper.Map <UserMasterBO>(result); ObjectMapper.Map(UserRepository.UserLogin(email, password), user); return(mapper.Map <UserMasterBO>(UserRepository.UserLogin(email, password))); }
public int SubmitNewEmployee(UserMasterBO model, string sessionID) { UserMaster userMaster = new UserMaster(); model.Mobile = EncryptionEngine.EncryptString(model.Mobile); model.Phone = EncryptionEngine.EncryptString(model.Phone); model.Email = EncryptionEngine.EncryptString(model.Email); model.LoginName = EncryptionEngine.EncryptString(model.LoginName); model.Password = EncryptionEngine.EncryptString(model.Password); ObjectMapper.Map(model, userMaster); return(UserRepository.SubmitNewEmployee(userMaster, sessionID)); }
public ActionResult Register(string identifier) { UserMasterBO user = new UserMasterBO(); identifier = identifier.Replace(' ', '+'); // Decoding URL into actual encrypted string. try { if (identifier != null) { ViewBag.IsRegistered = true; string decrypt = EncryptionEngine.Decrypt(identifier); user.UserID = Convert.ToInt32(decrypt.Split(',')[0]); user.FirstName = decrypt.Split(',')[1].ToString(); user.LastName = decrypt.Split(',')[2].ToString(); user.LoginName = decrypt.Split(',')[3].ToString(); ViewBag.TemplateName = decrypt.Split(',')[4].ToString(); var status = UserBusinessInstance.GetUserByLoginName(user.LoginName).AccountStatus; if (status == (int)AspectEnums.UserAccountStatus.Pending) { return(View(user)); } else { ViewBag.Message = "User already exist. Please login in with your email address."; ViewBag.IsSuccess = false; ViewBag.ShowPopup = true; return(View()); } } else { ViewBag.Message = "Invalid registration url. Contact administrator."; ViewBag.IsSuccess = false; ViewBag.ShowPopup = true; return(View()); } } catch (Exception ex) { ViewBag.Message = "Something went wrong. Contact administrator."; ViewBag.IsSuccess = false; ViewBag.ShowPopup = true; return(View()); } }
public ActionResult Login(string email, string password) { UserMasterBO user = UserBusinessInstance.UserLogin(email, password); //.Where(x => x.cemailaddress == email && x.cpassword == password).FirstOrDefault(); if (user != null) { ViewBag.LoginMessage = "User Logged In successfully!"; USERPROFILE = user; WelcomeUser(user.UserID); return(RedirectToAction("Index", "Home")); } else { ViewBag.Message = "You are not authorized to login, please contact your administrator"; Response.Redirect("~/Account/UnAuthorizedUser", true); return(View("UnAuthorizedUser", "Account")); } }
public UserMasterController(UserMasterBO UserMasterBO) : base(UserMasterBO) { this.UserMasterBO = UserMasterBO; }
public ActionResult Register(UserMasterBO model, string sessionID) { List <string> ErrorMessage = new List <string>(); string newPassword = model.Password; var userinfo = new UserProfileBO(); if (model.Password != model.ConfirmPassword) { ViewBag.Message = "New Password & Confirm Password did not match. Try again."; ViewBag.IsSuccess = false; return(View(model)); } newPassword.IsComplexPassword(ref ErrorMessage); if (ErrorMessage.Count > 0) { ViewBag.Message = ErrorMessage.Select(k => k).Aggregate((a, b) => a + "\n" + b); ViewBag.IsSuccess = false; return(View(model)); } try { userinfo = UserBusinessInstance.GetUserByLoginName(model.LoginName); bool IfUserExists = userinfo.UserID > 0 ? true : false; #region Old registration code //else //{ // // if (!IfUserExists) // { // model.CreatedBy = 0; // model.JoiningDate = DateTime.Now; // model.Email = model.LoginName; // model.isDeleted = false; // model.isActive = true; // model.IsEmployee = false; // model.AccountStatus = (int)AspectEnums.UserLoginStatus.Active; // sessionID = HttpContext.Session.SessionID.ToString(); // int registerEmp = UserBusinessInstance.SubmitNewEmployee(model, sessionID); // ViewBag.IsSuccess = true; // ViewBag.ShowPopup = true; // ViewBag.Message = "Congratulations for being a part of Dream Wedds family."; // return View(); // } #endregion if (IfUserExists && userinfo.AccountStatus == (int)AspectEnums.UserAccountStatus.Pending) { userinfo.AccountStatus = (int)AspectEnums.UserLoginStatus.Active; sessionID = HttpContext.Session.SessionID.ToString(); userinfo.Password = model.Password; bool isUpdated = UserBusinessInstance.UpdateUserProfile(userinfo); if (isUpdated) { ViewBag.IsSuccess = true; ViewBag.ShowPopup = true; ViewBag.Message = "You have created your password. Login now."; return(View("Login")); } else { ViewBag.IsSuccess = true; ViewBag.ShowPopup = true; ViewBag.Message = "Something went wrong. Try again later."; } return(View(model)); } else { ViewBag.Message = "User with this email address already exists. Please with your email address."; ViewBag.IsSuccess = false; return(View(model)); } } catch (DbEntityValidationException ex) { ViewBag.IsSuccess = false; var newException = new FormattedDbEntityValidationException(ex); ViewBag.Message = "Error: " + ex; } catch (Exception e) { ViewBag.IsSuccess = false; ViewBag.Message = "Error: " + e; } return(View(model)); }
public UserMasterBO verifyLogin(string strUserName, string strPassword, ref string strResult) { List <ProcParameterBO> objList = new List <ProcParameterBO>(); ProcParameterBO objDbParameter = null; UserMasterBO objUserMasterBO = null; DataSet objDataSet = null; try { objDbParameter = new ProcParameterBO(); objDbParameter.Direction = ParameterDirection.Input; objDbParameter.ParameterName = "@strUserName"; objDbParameter.dbType = DbType.String; objDbParameter.ParameterValue = strUserName; objList.Add(objDbParameter); objDbParameter = new ProcParameterBO(); objDbParameter.Direction = ParameterDirection.Input; objDbParameter.ParameterName = "@strPassword"; objDbParameter.dbType = DbType.String; objDbParameter.ParameterValue = strPassword; objList.Add(objDbParameter); objDbParameter = new ProcParameterBO(); objDbParameter.Direction = ParameterDirection.Output; objDbParameter.ParameterName = "@strStatus"; objDbParameter.dbType = DbType.String; objDbParameter.Size = 100; objList.Add(objDbParameter); objDataSet = objDbAccess.execuitDataSet("usp_SCH_VerifyLogin", ref objList); for (int i = 0; i < objList.Count; i++) { if (objList[i].Direction == ParameterDirection.Output) { strResult = objList[i].ParameterValue.ToString(); } } if (strResult == "SUCCESS") { if (objDataSet != null && objDataSet.Tables.Count > 0) { for (int i = 0; i < objDataSet.Tables[0].Rows.Count; i++) { objUserMasterBO = new UserMasterBO(); objUserMasterBO.UserId = objDataSet.Tables[0].Rows[i][0].ToString(); objUserMasterBO.FirstName = objDataSet.Tables[0].Rows[i][1].ToString(); objUserMasterBO.LastName = objDataSet.Tables[0].Rows[i][2].ToString(); objUserMasterBO.UserName = objDataSet.Tables[0].Rows[i][3].ToString(); objUserMasterBO.EmailId = objDataSet.Tables[0].Rows[i][4].ToString(); objUserMasterBO.Gender = objDataSet.Tables[0].Rows[i][5].ToString(); objUserMasterBO.Address = objDataSet.Tables[0].Rows[i][6].ToString(); objUserMasterBO.PhoneNo = objDataSet.Tables[0].Rows[i][7].ToString(); objUserMasterBO.IsActive = Convert.ToBoolean(objDataSet.Tables[0].Rows[i][8].ToString()); objUserMasterBO.RoleId = Convert.ToInt32(objDataSet.Tables[0].Rows[i][9].ToString()); objUserMasterBO.RoleName = objDataSet.Tables[0].Rows[i][10].ToString(); objUserMasterBO.EmployeeId = Convert.ToInt32(objDataSet.Tables[0].Rows[i][11].ToString()); } } } } catch (Exception ex) { ExceptionError.Error_Log(ex, "verifyLogin"); strResult = "FAILED"; throw ex; } return(objUserMasterBO); }