public OperationResult <IUserDTO> UpdateProfile(IUserDTO userDTO) { OperationResult <IUserDTO> updateProfileReturnValue = null; try { EmployeePortalValidationResult validationResult = Validator <UserValidator, IUserDTO> .Validate(userDTO, ValidationConstants.CommomUservalidations); if (!validationResult.IsValid) { updateProfileReturnValue = OperationResult <IUserDTO> .CreateFailureResult(validationResult); } else { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserManagerDAC); IUserDTO returnedUserDTO = userDAC.UpdateProfile(userDTO); if (returnedUserDTO != null) { updateProfileReturnValue = OperationResult <IUserDTO> .CreateSuccessResult(returnedUserDTO, "Profile updated successfully"); } } } catch (DACException dacEx) { updateProfileReturnValue = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); updateProfileReturnValue = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(updateProfileReturnValue); }
public OperationResult <IList <IEmployeeDTO> > SearchEmployeeByRawQuery(ISearchEmployeeDTO employeeDTO, bool checkTerminationDate) { OperationResult <IList <IEmployeeDTO> > searchEmployee = null; try { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserManagerDAC); IList <IEmployeeDTO> userDTOList = userDAC.SearchEmployeeByRawQuery(employeeDTO, checkTerminationDate); if (userDTOList != null) { searchEmployee = OperationResult <IList <IEmployeeDTO> > .CreateSuccessResult(userDTOList); } else { searchEmployee = OperationResult <IList <IEmployeeDTO> > .CreateFailureResult("SearchEmployeeByRawQuery Method Failed"); } } catch (DACException dacEx) { searchEmployee = OperationResult <IList <IEmployeeDTO> > .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); searchEmployee = OperationResult <IList <IEmployeeDTO> > .CreateErrorResult(ex.Message, ex.StackTrace); } return(searchEmployee); }
public OperationResult <IList <IUserDTO> > GetAdmins() { OperationResult <IList <IUserDTO> > getUserReturnValue = null; try { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserManagerDAC); IList <IUserDTO> userDTOList = userDAC.GetAdmins(); if (userDTOList != null) { getUserReturnValue = OperationResult <IList <IUserDTO> > .CreateSuccessResult(userDTOList); } else { getUserReturnValue = OperationResult <IList <IUserDTO> > .CreateFailureResult("Get Admins method failed."); } } catch (DACException dacEx) { getUserReturnValue = OperationResult <IList <IUserDTO> > .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); getUserReturnValue = OperationResult <IList <IUserDTO> > .CreateErrorResult(ex.Message, ex.StackTrace); } return(getUserReturnValue); }
/// <summary> /// Method to register user /// </summary> /// <param name="userDTO"></param> /// <returns></returns> public OperationResult <IUserDTO> Register(IUserDTO userDTO) { OperationResult <IUserDTO> retVal = null; try { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); IUserDTO resultDTO = userDAC.Register(userDTO); if (resultDTO != null) { retVal = OperationResult <IUserDTO> .CreateSuccessResult(resultDTO); } else { retVal = OperationResult <IUserDTO> .CreateFailureResult("Email Id already exist!"); } } catch (DACException dacEx) { retVal = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); retVal = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(retVal); }
public OperationResult <IList <IUserDTO> > SearchUser(string nameSearch, string contactSearch, string emailSearch) { OperationResult <IList <IUserDTO> > updateReturnValue = null; IUserDAC userDAC = null; IList <IUserDTO> returnedUserDTO = null; try { userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); returnedUserDTO = userDAC.SearchUser(nameSearch, contactSearch, emailSearch); if (returnedUserDTO != null) { updateReturnValue = OperationResult <IList <IUserDTO> > .CreateSuccessResult(returnedUserDTO, "User Searched successfully"); } else { updateReturnValue = OperationResult <IList <IUserDTO> > .CreateFailureResult("User Searching failed!"); } } catch (DACException dacEx) { updateReturnValue = OperationResult <IList <IUserDTO> > .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); updateReturnValue = OperationResult <IList <IUserDTO> > .CreateErrorResult(ex.Message, ex.StackTrace); } return(updateReturnValue); }
private bool IsUniqueEmail(string arg) { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); IUserDTO userDTO = userDAC.GetUserByEmail(arg); return(userDTO == null); }
public OperationResult <IUserDTO> GetUserByEmailId(string emailId) { OperationResult <IUserDTO> getUserReturnValue = null; try { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserManagerDAC); IUserDTO userDTO = userDAC.GetUserByEmailId(emailId); if (userDTO != null) { getUserReturnValue = OperationResult <IUserDTO> .CreateSuccessResult(userDTO); } else { getUserReturnValue = OperationResult <IUserDTO> .CreateFailureResult("Get User By Email Id Method Failed"); } } catch (DACException dacEx) { getUserReturnValue = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); getUserReturnValue = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(getUserReturnValue); }
private bool UniqueEmployeeEmailForUpdate(string email) { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserManagerDAC); IUserDTO userDTO = userDAC.GetUserByEmailId(email); return(userDTO == null || userDTO.EmployeeDTO.Email.Equals(email)); }
public OperationResult <IList <IUserDTO> > GetAllUsers() { OperationResult <IList <IUserDTO> > retVal = null; try { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); IList <IUserDTO> list = userDAC.GetAllUsers(); retVal = OperationResult <IList <IUserDTO> > .CreateSuccessResult(list); } catch (DACException dacEx) { retVal = OperationResult <IList <IUserDTO> > .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); retVal = OperationResult <IList <IUserDTO> > .CreateErrorResult(ex.Message, ex.StackTrace); } return(retVal); }
public OperationResult <IUserDTO> ModifyAmount(string uniqueId, decimal factor) { OperationResult <IUserDTO> retVal = null; try { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); IUserDTO userDTO = userDAC.ModifyAmount(uniqueId, factor); retVal = OperationResult <IUserDTO> .CreateSuccessResult(userDTO); } catch (DACException dacEx) { retVal = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); retVal = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(retVal); }
public OperationResult <IList <IUserDTO> > GetFilteredUsers(string userName, string userContact, string userEmail) { OperationResult <IList <IUserDTO> > retVal = null; try { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); IList <IUserDTO> filteredList = userDAC.GetFilteredUsers(userName, userContact, userEmail); retVal = OperationResult <IList <IUserDTO> > .CreateSuccessResult(filteredList); } catch (DACException dacEx) { retVal = OperationResult <IList <IUserDTO> > .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); retVal = OperationResult <IList <IUserDTO> > .CreateErrorResult(ex.Message, ex.StackTrace); } return(retVal); }
public OperationResult <IUserDTO> CreateUser(IUserDTO userDTO) { OperationResult <IUserDTO> retVal = null; try { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); IUserDTO userDTOs = userDAC.CreateUser(userDTO); retVal = OperationResult <IUserDTO> .CreateSuccessResult(userDTOs); } catch (DACException dacEx) { retVal = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); retVal = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(retVal); }
public OperationResult <IList <IUserDTO> > SearchCustomer(string name, string email, string contact) { OperationResult <IList <IUserDTO> > retVal = null; try { IUserDAC usersDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); IList <IUserDTO> list = usersDAC.SearchCustomer(name, email, contact); retVal = OperationResult <IList <IUserDTO> > .CreateSuccessResult(list); } catch (DACException dacEx) { retVal = OperationResult <IList <IUserDTO> > .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); retVal = OperationResult <IList <IUserDTO> > .CreateErrorResult(ex.Message, ex.StackTrace); } return(retVal); }
public OperationResult <IUserDTO> UpdateBlockedAmount(string emailid, int amt) { OperationResult <IUserDTO> retVal = null; try { IUserDAC usersDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); IUserDTO list = usersDAC.UpdateBlockedAmount(emailid, amt); retVal = OperationResult <IUserDTO> .CreateSuccessResult(list); } catch (DACException dacEx) { retVal = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); retVal = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(retVal); }
public OperationResult <IUserDTO> RechargeAmount(int id, decimal rechargeAmount) { OperationResult <IUserDTO> retVal = null; try { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); IUserDTO userDTO = userDAC.RechargeAmount(id, rechargeAmount); retVal = OperationResult <IUserDTO> .CreateSuccessResult(userDTO); } catch (DACException dacEx) { retVal = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); retVal = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(retVal); //throw new NotImplementedException(); }
public OperationResult <IUserDTO> CreateAUser(IUserDTO userDTO) { OperationResult <IUserDTO> createUserReturnValue = null; IUserDAC userDAC = null; IUserDTO UserDTO = null; try { AdminPortalValidationResult validationResult = Validator <UserValidator, IUserDTO> .Validate(userDTO, "CreateUserEmail"); if (!validationResult.IsValid) { createUserReturnValue = OperationResult <IUserDTO> .CreateFailureResult(validationResult); } else { userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); UserDTO = userDAC.CreateAUser(userDTO); if (UserDTO != null) { createUserReturnValue = OperationResult <IUserDTO> .CreateSuccessResult(UserDTO, "User Creation Successfull"); } else { createUserReturnValue = OperationResult <IUserDTO> .CreateFailureResult("Error! Cannot create a customer"); } } } catch (DACException dacEx) { createUserReturnValue = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); createUserReturnValue = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(createUserReturnValue); }
public OperationResult <IUserDTO> CreateUser(IUserDTO userDTO) { OperationResult <IUserDTO> retVal = null; try { CasinoAppValidationResult validationResult = Validator <UserValidator, IUserDTO> .Validate(userDTO, Constants.UserMessage.CreateUserEmail); if (!validationResult.IsValid) { retVal = OperationResult <IUserDTO> .CreateFailureResult(validationResult); } else { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); IUserDTO list = userDAC.CreateUser(userDTO); if (list != null) { retVal = OperationResult <IUserDTO> .CreateSuccessResult(list, Constants.UserMessage.Usercreatedsuccessfully); } else { retVal = OperationResult <IUserDTO> .CreateFailureResult(Constants.UserMessage.InsertionFialed); } } } catch (DACException dacEx) { retVal = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); retVal = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(retVal); //throw new NotImplementedException(); }
public OperationResult <IUserDTO> GetUserByEmailId(string emailId) { OperationResult <IUserDTO> retVal = null; IUserDAC userDAC = null; IUserDTO all = null; try { userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); all = userDAC.GetUserByEmailId(emailId); retVal = OperationResult <IUserDTO> .CreateSuccessResult(all); } catch (DACException dacEx) { retVal = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); retVal = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(retVal); }
public OperationResult <IUserDTO> AddWinningPrize(string emailId, decimal betAmount, decimal multiplyFactor) { OperationResult <IUserDTO> retVal = null; IUserDAC userDAC = null; IUserDTO all = null; try { userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserDAC); all = userDAC.AddWinningPrize(emailId, betAmount, multiplyFactor); retVal = OperationResult <IUserDTO> .CreateSuccessResult(all); } catch (DACException dacEx) { retVal = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); retVal = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(retVal); }
public OperationResult <IUserDTO> CreateEmployeeBySProc(IUserDTO userDTO) { OperationResult <IUserDTO> getUserReturnValue = null; try { EmployeePortalValidationResult validationResult = Validator <UserValidator, IUserDTO> .Validate(userDTO, ValidationConstants.CreateEmployee + "," + ValidationConstants.CommomUservalidations + "," + ValidationConstants.UpdateCreateUser); if (!validationResult.IsValid) { getUserReturnValue = OperationResult <IUserDTO> .CreateFailureResult(validationResult); } else { IUserDAC userDAC = (IUserDAC)DACFactory.Instance.Create(DACType.UserManagerDAC); userDTO = userDAC.CreateEmployeeBySProc(userDTO); if (userDTO != null) { getUserReturnValue = OperationResult <IUserDTO> .CreateSuccessResult(userDTO); } else { getUserReturnValue = OperationResult <IUserDTO> .CreateFailureResult("creation Failed"); } } } catch (DACException dacEx) { getUserReturnValue = OperationResult <IUserDTO> .CreateErrorResult(dacEx.Message, dacEx.StackTrace); } catch (Exception ex) { ExceptionManager.HandleException(ex); getUserReturnValue = OperationResult <IUserDTO> .CreateErrorResult(ex.Message, ex.StackTrace); } return(getUserReturnValue); }
public UserBAL(IUserDAC _userDAC) { this.userDAC = _userDAC; }