/// <summary> /// This method validates admin password while transaction operation /// </summary> /// <param name="userEmail">userEmail</param> /// <param name="password">password</param> /// <param name="organizationID">organizationID</param> /// <returns></returns> public bool ValidateAdmin(string userEmail, string password, int organizationID) { try { using (var unitOfWork = new EFUnitOfWork()) { var currentDeskSecurity = new CurrentDeskSecurity(); var userRepo = new UserRepository(new EFRepository <User>(), unitOfWork); ObjectSet <User> userObjSet = ((CurrentDeskClientsEntities)userRepo.Repository.UnitOfWork.Context).Users; var selectedUser = userObjSet.Where( usr => usr.UserEmailID == userEmail && usr.FK_OrganizationID == organizationID) .FirstOrDefault(); if (selectedUser != null) { return(currentDeskSecurity.GetPassDecrypted(selectedUser.Password) == password ? true : false); } return(false); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// This method validates user during login /// </summary> /// <param name="userName">userName</param> /// <param name="password">password</param> /// <param name="userID">userID</param> /// <param name="userType">userType</param> /// <param name="accountType">accountType</param> /// <param name="accountCode">accountCode</param> /// <param name="userDisplayName">userDisplayName</param> /// <returns></returns> public bool ValidateUser(string userName, string password, int organizationID, ref int userID, ref int userType, ref int accountType, ref int accountCode, ref string userDisplayName) { var currentDeskSecurity = new CurrentDeskSecurity(); try { using (var unitOfWork = new EFUnitOfWork()) { var userRepo = new UserRepository(new EFRepository <User>(), unitOfWork); ObjectSet <User> userObjSet = ((CurrentDeskClientsEntities)userRepo.Repository.UnitOfWork.Context).Users; //Get The Selected client and check for the //organization and than assign its Properties. var selectedUsers = userObjSet.Where(usr => usr.UserEmailID == userName && usr.FK_OrganizationID == organizationID).FirstOrDefault(); if (selectedUsers != null) { if (currentDeskSecurity.GetPassDecrypted(selectedUsers.Password) == password) { userID = selectedUsers.PK_UserID; userType = (int)selectedUsers.FK_UserTypeID; if (selectedUsers.FK_UserTypeID == Constants.K_BROKER_LIVE) { var clientBO = new ClientBO(); return(clientBO.GetClientAccountInformation(selectedUsers.PK_UserID, ref accountType, ref accountCode, ref userDisplayName)); } else if (selectedUsers.FK_UserTypeID == Constants.K_BROKER_PARTNER) { var introducingBrokerBO = new IntroducingBrokerBO(); return(introducingBrokerBO.GetClientAccountInformation(selectedUsers.PK_UserID, ref accountType, ref accountCode, ref userDisplayName)); } else if (selectedUsers.FK_UserTypeID == Constants.K_BROKER_ADMIN) { accountCode = Constants.K_ACCTCODE_SUPERADMIN; return(true); } } } return(false); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }
/// <summary> /// This function will Provide IB information /// depending Upon FK_UserID /// </summary> /// <param name="userID"></param> /// <returns></returns> public IntroducingBroker GetClientInformation(int userID) { var currentDeskSecurity = new CurrentDeskSecurity(); try { using (var unitOfWork = new EFUnitOfWork()) { var introducingBrokerRepo = new IntroducingBrokerRepository(new EFRepository <IntroducingBroker>(), unitOfWork); ObjectSet <IntroducingBroker> introducingBrokerObjSet = ((CurrentDeskClientsEntities)introducingBrokerRepo.Repository.UnitOfWork.Context).IntroducingBrokers; //Get The Selected tunning and assign its Properties. return(introducingBrokerObjSet.Where(ib => ib.FK_UserID == userID).FirstOrDefault()); } } catch (Exception ex) { CommonErrorLogger.CommonErrorLog(ex, System.Reflection.MethodBase.GetCurrentMethod().Name); throw; } }