public JsonResultEntity Create([FromBody] UserLoginEntity userloginEntity) { UserLoginBL userloginBL = new UserLoginBL(); JsonResultEntity response = new JsonResultEntity(); try { var result = userloginBL.Create(userloginEntity); if (result.HasWarning()) { response.Message = String.Join(",", result.Warning); return(response); } response.Success = true; response.Data = result.Value; } catch (Exception ex) { response.Message = ex.Message; LoggerHelper.Error(ex); } return(response); }
public bool UserLoginDoctor(UserLoginEntity u) { try { //this.UserFetch("reciptionist"); string sql = "select * from doctor where username ='******' and password = '******'"; var ds = DataAccess.GetDataSet(sql); if (ds.Tables[0].Rows.Count == 1) { return(true); } else { return(false); } } catch (Exception e) { return(false); } return(true); }
public UserLogin CreateUserLogin(UserLoginEntity userLoginEntity) { NullArgumentChecker.CheckIfNull(userLoginEntity, "userLoginEntity"); string hintAnswer = string.Empty; if (!string.IsNullOrEmpty(userLoginEntity.HintAnswer)) { hintAnswer = _cryptographyService.Decrypt(userLoginEntity.HintAnswer); } return(new UserLogin(userLoginEntity.UserLoginId) { UserName = userLoginEntity.UserName, Password = userLoginEntity.Password, Salt = userLoginEntity.Salt, Locked = userLoginEntity.IsLocked, FailedAttempts = (long)userLoginEntity.LoginAttempts, IsSecurityQuestionVerified = userLoginEntity.IsSecurityQuestionVerified, UserVerified = userLoginEntity.UserVerified, HintAnswer = hintAnswer, HintQuestion = userLoginEntity.HintQuestion, LastLogged = userLoginEntity.LastLogged, DateCreated = userLoginEntity.DateCreated, DateModified = userLoginEntity.DateModified, IsActive = userLoginEntity.IsActive, LastPasswordChangeDate = userLoginEntity.LastPasswordChangeDate, IsTwoFactorAuthrequired = userLoginEntity.IsTwoFactorAuthrequired, LastLoginAttemptAt = userLoginEntity.LastLoginAttemptAt }); }
public SecureHash ResetPassword(long userLoginId, string password, bool userVerified = true) { using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter()) { var userLoginEntity = new UserLoginEntity(userLoginId); if (myAdapter.FetchEntity(userLoginEntity)) { userLoginEntity.IsNew = false; var securehash = _oneWayHashingService.CreateHash(password); userLoginEntity.Password = securehash.HashedText; userLoginEntity.Salt = securehash.Salt; userLoginEntity.UserVerified = userVerified; userLoginEntity.LastPasswordChangeDate = DateTime.Now; if (userVerified) { userLoginEntity.ResetPwdQueryString = null; } myAdapter.SaveEntity(userLoginEntity, true); return(securehash); } return(null); } }
/// <summary> Initializes the class members</summary> protected virtual void InitClassMembers() { _userLogin = null; PerformDependencyInjection(); // __LLBLGENPRO_USER_CODE_REGION_START InitClassMembers // __LLBLGENPRO_USER_CODE_REGION_END OnInitClassMembersComplete(); }
/// <summary> setups the sync logic for member _userLogin</summary> /// <param name="relatedEntity">Instance to set as the related entity of type entityType</param> private void SetupSyncUserLogin(IEntity2 relatedEntity) { if (_userLogin != relatedEntity) { DesetupSyncUserLogin(true, true); _userLogin = (UserLoginEntity)relatedEntity; base.PerformSetupSyncRelatedEntity(_userLogin, new PropertyChangedEventHandler(OnUserLoginPropertyChanged), "UserLogin", SafeComputerHistoryEntity.Relations.UserLoginEntityUsingUserLoginId, true, new string[] { }); } }
public UserLoginEntity Create(UserLoginEntity userloginEntity) { var query = @"INSERT INTO ""UserLogin""(""LoginProvider"",""ProviderKey"",""UserProfileID"") VALUES(@LoginProvider,@ProviderKey,@UserProfileID) RETURNING ""ID"";"; int id = DbConnection.Query <int>(query, userloginEntity).Single(); userloginEntity.ID = id; return(userloginEntity); }
private void MbtnLogin_Click(object sender, EventArgs e) { if (this.txtLoginPassword.Text != "" && this.txtLoginId.Text != "") { UserLoginEntity user = new UserLoginEntity(); user.UserId = txtLoginId.Text.Trim(); user.UserPassword = txtLoginPassword.Text; UserLoginRepository emp = new UserLoginRepository(); if (emp.UserLoginValidation(user)) { if (user.UserId.Substring(0, 1) == "A") { MessageBox.Show("Admin"); AdminDashboard admin = new AdminDashboard(this, user.UserId); this.Hide(); admin.Show(); Clear(); } else if (user.UserId.Substring(0, 1) == "W") { MessageBox.Show("Waiter"); Waiter_Dashboard wd = new Waiter_Dashboard(this, user.UserId); this.Hide(); wd.Show(); Clear(); } else if (user.UserId.Substring(0, 1) == "M") { MessageBox.Show("Manager"); Manager_Dashboard md = new Manager_Dashboard(this, user.UserId); this.Hide(); md.Show(); Clear(); } else { MessageBox.Show("Invalid Form Of Id!"); Clear(); } } else { MessageBox.Show("Invalid Id or Password", "Login Failed"); Clear(); } } else { MessageBox.Show("Insert ID or Password", "Login Failed"); Clear(); } }
private void mbtnLogin_Click(object sender, EventArgs e) { if (this.txtUserName.Text != "" && this.txtPassword.Text != "") { var user = new UserLoginEntity(); user.UserName = this.txtUserName.Text.Trim(); user.UserPass = this.txtPassword.Text.Trim(); var userRep = new UserLoginRepo(); if (user.UserName.Substring(0, 1) == "A" || user.UserName.Substring(0, 1) == "a") { if (userRep.UserLoginAdmin(user)) { MessageBox.Show("Welcome Admin"); this.Visible = false; var admin = new AdminDash(txtUserName.Text.Trim()); admin.Visible = true; } else { MessageBox.Show("Invalid Id or Password"); } } else if (user.UserName.Substring(0, 1) == "R" || user.UserName.Substring(0, 1) == "r") { if (userRep.UserLoginReciptionist(user)) { //MessageBox.Show("Hey There"); var reciption = new ReceptionistDash(txtUserName.Text.Trim()); //this.Visible = false; this.Hide(); reciption.Show(); //reciption.Visible = true; } else { MessageBox.Show("Invalid Id or Password"); } } else if (user.UserName.Substring(0, 1) == "D" || user.UserName.Substring(0, 1) == "d") { if (userRep.UserLoginDoctor(user)) { MessageBox.Show("Welcome Doctor"); var doctor = new DoctorDash(txtUserName.Text.Trim()); this.Visible = false; doctor.Visible = true; } else { MessageBox.Show("Invalid Id or Password"); } } } }
public ResultEntity <UserLoginEntity> Create(UserLoginEntity userloginEntity) { var validationResult = new ResultEntity <UserLoginEntity>(); using (var userloginDA = new UserLoginDA()) { validationResult.Value = userloginDA.Create(userloginEntity); } return(validationResult); }
public int Update(UserLoginEntity userloginEntity) { int affectedRows = 0; if (IsHaveId <UserLoginEntity>(userloginEntity) == false) { var query = @"UPDATE ""UserLogin"" SET ""LoginProvider""=@LoginProvider,""ProviderKey""=@ProviderKey,""UserProfileID""=@UserProfileID WHERE ""ID""=@ID"; affectedRows = DbConnection.Execute(query, userloginEntity); } return(affectedRows); }
protected LoginOtpEntity(SerializationInfo info, StreamingContext context) : base(info, context) { if (SerializationHelper.Optimization != SerializationOptimization.Fast) { _userLogin = (UserLoginEntity)info.GetValue("_userLogin", typeof(UserLoginEntity)); if (_userLogin != null) { _userLogin.AfterSave += new EventHandler(OnEntityAfterSave); } base.FixupDeserialization(FieldInfoProviderSingleton.GetInstance()); } // __LLBLGENPRO_USER_CODE_REGION_START DeserializationConstructor // __LLBLGENPRO_USER_CODE_REGION_END }
public bool OverRideIsTwoFactorAuthRequired(long roleId) { using (var myAdapter = PersistenceLayer.GetDataAccessAdapter()) { var entity = new UserLoginEntity() { IsTwoFactorAuthrequired = null }; var bucket = new RelationPredicateBucket(); bucket.Relations.Add(UserLoginEntity.Relations.UserEntityUsingUserLoginId); bucket.PredicateExpression.Add(UserFields.DefaultRoleId == roleId); myAdapter.UpdateEntitiesDirectly(entity, bucket); return(true); } }
public bool SaveSecurityQuestionAnswer(long userLoginId, string question, string answer) { using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter()) { var userLoginEntity = new UserLoginEntity(userLoginId); if (myAdapter.FetchEntity(userLoginEntity)) { userLoginEntity.IsNew = false; userLoginEntity.HintQuestion = question; userLoginEntity.HintAnswer = _cryptographyService.Encrypt(answer); userLoginEntity.IsSecurityQuestionVerified = true; myAdapter.SaveEntity(userLoginEntity, true); return(true); } return(false); } }
public bool UpdateResetPasswordQueryString(long userLoginId, string resetPasswordQueryString) { using (IDataAccessAdapter adapter = PersistenceLayer.GetDataAccessAdapter()) { var userLoginEntity = new UserLoginEntity(userLoginId) { ResetPwdQueryString = resetPasswordQueryString, UserVerified = false }; var bucket = new RelationPredicateBucket(UserLoginFields.UserLoginId == userLoginId); try { return((adapter.UpdateEntitiesDirectly(userLoginEntity, bucket) > 0) ? true : false); } catch (Exception exception) { throw new PersistenceFailureException(exception.Message); } } }
public bool UpdateUserLoginIsActiveStatus(long userLoginId, bool isActive) { using (var adapter = PersistenceLayer.GetDataAccessAdapter()) { var userLoginEntity = new UserLoginEntity(userLoginId) { IsActive = isActive }; var bucket = new RelationPredicateBucket(UserLoginFields.UserLoginId == userLoginId); try { return((adapter.UpdateEntitiesDirectly(userLoginEntity, bucket) > 0) ? true : false); } catch (Exception exception) { throw new PersistenceFailureException(exception.Message); } } }
public ResultEntity <UserLoginEntity> Update(UserLoginEntity userloginEntity) { var validationResult = new ResultEntity <UserLoginEntity>(); using (var userloginDA = new UserLoginDA()) { var resultUpdate = userloginDA.Update(userloginEntity); if (resultUpdate <= 0) { validationResult.Warning.Add("Failed Updating UserLogin!"); return(validationResult); } validationResult.Value = userloginEntity; } return(validationResult); }
public bool AssignUserLoginLock(long userId) { using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter()) { var userLoginEntity = new UserLoginEntity(userId) { IsLocked = true, LastLoginAttemptAt = DateTime.Now, LoginAttempts = 1 }; var bucket = new RelationPredicateBucket(UserLoginFields.UserLoginId == userId); try { return((myAdapter.UpdateEntitiesDirectly(userLoginEntity, bucket) > 0) ? true : false); } catch (Exception exception) { throw new PersistenceFailureException(exception.Message); } } }
public bool ForceUserToChangeQuestion(long userId) { using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter()) { var userLoginEntity = new UserLoginEntity(userId) { IsSecurityQuestionVerified = false }; var bucket = new RelationPredicateBucket(UserLoginFields.UserLoginId == userId); try { return((myAdapter.UpdateEntitiesDirectly(userLoginEntity, bucket) > 0) ? true : false); } catch (Exception exception) { throw new PersistenceFailureException(exception.Message); } } }
public SecureHash ForceChangePassword(long userLoginId, string password, bool forceChangePassword) { var userLoginEntity = new UserLoginEntity(userLoginId); var securehash = _oneWayHashingService.CreateHash(password); using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter()) { if (myAdapter.FetchEntity(userLoginEntity)) { userLoginEntity.IsNew = false; userLoginEntity.Password = securehash.HashedText; userLoginEntity.Salt = securehash.Salt; userLoginEntity.UserVerified = forceChangePassword ? false : true; userLoginEntity.LastPasswordChangeDate = DateTime.Now; myAdapter.SaveEntity(userLoginEntity, false); return(securehash); } } return(null); }
public UserLogin UpdateLoginStatus(long userLoginId, bool isSuccessfulLogin) { using (IDataAccessAdapter myAdapter = PersistenceLayer.GetDataAccessAdapter()) { var userLoginEntity = new UserLoginEntity(userLoginId); if (myAdapter.FetchEntity(userLoginEntity)) { userLoginEntity.IsNew = false; userLoginEntity.LoginAttempts = isSuccessfulLogin ? 0 : ++userLoginEntity.LoginAttempts; userLoginEntity.IsLocked = isSuccessfulLogin ? false : userLoginEntity.LoginAttempts >= 5; userLoginEntity.LastLoginAttemptAt = isSuccessfulLogin ? null : (DateTime?)DateTime.Now; userLoginEntity.LastLogged = isSuccessfulLogin ? DateTime.Now : userLoginEntity.LastLogged; myAdapter.SaveEntity(userLoginEntity, true); return(_userLoginFactory.CreateUserLogin(userLoginEntity)); } return(null); } }
public void UserLoggedIn(User user) { if (user == null) { return; } ISession session = SessionFactory.GetSession(); try { var query = session.QueryOver <UserEntity>(). Where(u => u.UserName == user.UserName).And(u => u.Password == user.Password); IList <UserEntity> users = query.List <UserEntity>(); if (users.Count > 0) { UserEntity loggedUser = users[0]; UserLoginEntity userLogin = new UserLoginEntity() { User = loggedUser, LoginDate = DateTime.Now }; session.SaveOrUpdate(userLogin); } } catch (Exception ex) { Logger.Write(ex); } finally { session.Close(); } }
public bool UserLoginValidation(UserLoginEntity u) { try { string sql = "select * from Login where Id = '" + u.UserId + "' and Password = '******';"; var ds = DataAccess.GetDataSet(sql); //MessageBox.Show(this.Ds.Tables[0].Rows.Count.ToString()); // emp.EmployeeName = ds.Tables[0].Rows[0][1].ToString(); if (ds.Tables[0].Rows.Count == 1) { return(true); } else { return(false); } } catch (Exception ex) { return(false); } }
public long Post([FromBody] UserLoginEntity usersEntity) { return(registerService.RegisterUser(usersEntity)); }
/// <summary> Removes the sync logic for member _userLogin</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param> private void DesetupSyncUserLogin(bool signalRelatedEntity, bool resetFKFields) { base.PerformDesetupSyncRelatedEntity(_userLogin, new PropertyChangedEventHandler(OnUserLoginPropertyChanged), "UserLogin", LoginSettingsEntity.Relations.UserLoginEntityUsingUserLoginId, true, signalRelatedEntity, "LoginSettings", false, new int[] { (int)LoginSettingsFieldIndex.UserLoginId }); _userLogin = null; }
/// <summary> Removes the sync logic for member _userLogin</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param> private void DesetupSyncUserLogin(bool signalRelatedEntity, bool resetFKFields) { base.PerformDesetupSyncRelatedEntity(_userLogin, new PropertyChangedEventHandler(OnUserLoginPropertyChanged), "UserLogin", ForgotPasswordEntity.Relations.UserLoginEntityUsingUserId, true, signalRelatedEntity, "ForgotPassword", resetFKFields, new int[] { (int)ForgotPasswordFieldIndex.UserId }); _userLogin = null; }
public bool DeleteCustomer(long customerId) { using (var adapter = PersistenceLayer.GetDataAccessAdapter()) { var linqMetaData = new LinqMetaData(adapter); var userId = (from oru in linqMetaData.OrganizationRoleUser where oru.OrganizationRoleUserId == customerId select oru.UserId).FirstOrDefault(); var prospectCustomerId = (from pc in linqMetaData.ProspectCustomer where pc.CustomerId == customerId select pc.ProspectCustomerId).ToArray(); { var prospectCustomerCall = new RelationPredicateBucket(ProspectCustomerCallFields.ProspectCustomerId == prospectCustomerId); adapter.DeleteEntitiesDirectly(typeof(ProspectCustomerCallEntity), prospectCustomerCall); var tempCartIds = (from tc in linqMetaData.TempCart where tc.ProspectCustomerId.HasValue && prospectCustomerId.Contains(tc.ProspectCustomerId.Value) select tc.Id).ToArray(); var preQualificationResult = new RelationPredicateBucket(PreQualificationResultFields.TempCartId == tempCartIds); adapter.DeleteEntitiesDirectly(typeof(PreQualificationResultEntity), preQualificationResult); var tempCart = new RelationPredicateBucket(TempCartFields.ProspectCustomerId == prospectCustomerId); adapter.DeleteEntitiesDirectly(typeof(TempCartEntity), tempCart); tempCart = new RelationPredicateBucket(TempCartFields.CustomerId == customerId); adapter.DeleteEntitiesDirectly(typeof(TempCartEntity), tempCart); var prospectCustomer = new RelationPredicateBucket(ProspectCustomerFields.ProspectCustomerId == prospectCustomerId); adapter.DeleteEntitiesDirectly(typeof(ProspectCustomerEntity), prospectCustomer); var customerAccountGlocomNumber = new RelationPredicateBucket(CustomerAccountGlocomNumberFields.CustomerId == customerId); adapter.DeleteEntitiesDirectly(typeof(CustomerAccountGlocomNumberEntity), customerAccountGlocomNumber); var customerProfile = new RelationPredicateBucket(CustomerProfileFields.CustomerId == customerId); adapter.DeleteEntitiesDirectly(typeof(CustomerProfileEntity), customerProfile); } { var notificationId = (from n in linqMetaData.Notification where n.UserId == userId select n.NotificationId).ToArray(); var eventCustomerNotification = new RelationPredicateBucket(EventCustomerNotificationFields.NotificationId == notificationId); adapter.DeleteEntitiesDirectly(typeof(EventCustomerNotificationEntity), eventCustomerNotification); var notificationEmail = new RelationPredicateBucket(NotificationEmailFields.NotificationEmailId == notificationId); adapter.DeleteEntitiesDirectly(typeof(NotificationEmailEntity), notificationEmail); var notificationPhone = new RelationPredicateBucket(NotificationPhoneFields.NotificationPhoneId == notificationId); adapter.DeleteEntitiesDirectly(typeof(NotificationPhoneEntity), notificationPhone); var notification = new RelationPredicateBucket(NotificationFields.UserId == userId); adapter.DeleteEntitiesDirectly(typeof(NotificationEntity), notification); } { var organizationUser = new OrganizationRoleUserEntity { IsActive = false }; var organizationUserBucket = new RelationPredicateBucket(OrganizationRoleUserFields.OrganizationRoleUserId == customerId); adapter.UpdateEntitiesDirectly(organizationUser, organizationUserBucket); var userLogin = new UserLoginEntity { IsActive = false }; var userLoginBucket = new RelationPredicateBucket(UserLoginFields.UserLoginId == userId); adapter.UpdateEntitiesDirectly(userLogin, userLoginBucket); var user = new UserEntity { IsActive = false, Email1 = string.Empty }; var userBucket = new RelationPredicateBucket(UserFields.UserId == userId); adapter.UpdateEntitiesDirectly(user, userBucket); } } return(true); }
/// <summary> Removes the sync logic for member _userLogin</summary> /// <param name="signalRelatedEntity">If set to true, it will call the related entity's UnsetRelatedEntity method</param> /// <param name="resetFKFields">if set to true it will also reset the FK fields pointing to the related entity</param> private void DesetupSyncUserLogin(bool signalRelatedEntity, bool resetFKFields) { base.PerformDesetupSyncRelatedEntity(_userLogin, new PropertyChangedEventHandler(OnUserLoginPropertyChanged), "UserLogin", SafeComputerHistoryEntity.Relations.UserLoginEntityUsingUserLoginId, true, signalRelatedEntity, "SafeComputerHistory", resetFKFields, new int[] { (int)SafeComputerHistoryFieldIndex.UserLoginId }); _userLogin = null; }