/************************************* * Created by: dandy boy * Created on: july 26, 2017 * Function: GetUserAccesses * Purpose: GetUserAccesses * Inputs: accessInd * Returns: UserAccessResponse *************************************/ public UserAccessResponse GetUserAccesses(string accessInd) { Logger.Info("Invoking GetUserAccesses function"); var response = new UserAccessResponse() { Status = ResponseStatus.Failure, }; try { using (var scope = Container.BeginLifetimeScope()) { var userAccessDAO = scope.Resolve <IUserAccessDAO>(); var results = userAccessDAO.GetUserAccessList(accessInd); if (results.Count() > 0) { response.userAccesses = Mapper.Map <IList <UserAccessListDTO>, IList <UserAccess> >(results); } } response.Status = ResponseStatus.Success; } catch (Exception ex) { string msg = string.Format("Error in GetUserAccesses: detail:{0}", ex.Message); Logger.Error(msg, ex); response.Status = ResponseStatus.Exception; response.Message = msg; } return(response); }
public async Task <UserAccessResponse> GetUserTitleList() { Logger.Info("Invoking GetUserTitleList fuction use EF to call SP"); var response = new UserAccessResponse() { Status = ResponseStatus.Failure, }; try { using (var scope = Container.BeginLifetimeScope()) { var userAccessDAO = scope.Resolve <IUserAccessDAO>(); var results = await userAccessDAO.GetUserTitles(); response.userTitles = results; } response.Status = ResponseStatus.Success; } catch (Exception ex) { string msg = string.Format("Error in GetUserTitleList: detail:{0}", ex.Message); Logger.Error(msg, ex); response.Status = ResponseStatus.Exception; response.Message = msg; } return(response); }
/************************************* * Created by: dandy boy * Created on: Feb 8, 2017 * Function: GetUserAccessDetail * Purpose: GetUserAccessDetail * Inputs: accessInd,userId * Returns: UserAccessResponse *************************************/ public UserAccessResponse GetUserAccessDetail(string accessInd, string userId) { Logger.Info("Invoking GetUserAccessDetail function"); var response = new UserAccessResponse() { Status = ResponseStatus.Failure, }; try { using (var scope = Container.BeginLifetimeScope()) { var userAccessDAO = scope.Resolve <IUserAccessDAO>(); var result = userAccessDAO.GetUserAccessDetail(accessInd, userId); if (result != null) { response.userAccess = Mapper.Map <UserAccessDTO, UserAccess>(result); } } response.Status = ResponseStatus.Success; } catch (Exception ex) { string msg = string.Format("Error in GetUserAccessDetail: detail:{0}", ex.Message); Logger.Error(msg, ex); response.Status = ResponseStatus.Exception; response.Message = msg; } return(response); }