public SYS_tblPermissionDRO UpdatePermission(string Username, string LanguageID, bool IsUser, List<SYS_tblPermissionDCO> permissionList) { SYS_tblPermissionDRO result = new SYS_tblPermissionDRO(); try { using (var scope = Container.BeginLifetimeScope()) { string temp = ""; var db = scope.Resolve<ISYS_tblPermissionDAO>(); var permissions = Mapper.Map<List<SYS_tblPermissionDTO>>(permissionList); temp = db.UpdatePermission(Username, LanguageID, permissions, IsUser); result.ResponseItem = new DCO.ResponseItem { Result = string.IsNullOrEmpty(temp) ? true : false, Status = string.IsNullOrEmpty(temp) ? DCO.ResponseStatus.Success : DCO.ResponseStatus.Failure, Message = string.IsNullOrEmpty(temp) ? string.Empty : temp, RequestUser = Username, TotalItemCount = string.IsNullOrEmpty(temp) ? 1 : 0 }; } } catch (Exception ex) { result.ResponseItem = new DCO.ResponseItem { Result = false, Status = DCO.ResponseStatus.Exception, Message = "Update permission failed because: " + ex.Message, RequestUser = Username, TotalItemCount = 0 }; logger.Error(ex); } return result; }
public SYS_tblPermissionDRO GetPermissionItem(string Username, string LanguageID, string FunctionID) { SYS_tblPermissionDRO result = new SYS_tblPermissionDRO(); try { using (var scope = Container.BeginLifetimeScope()) { SYS_tblPermissionDTO temp = new SYS_tblPermissionDTO(); var db = scope.Resolve<ISYS_tblPermissionDAO>(); temp = db.GetPermissionItem(Username, LanguageID, FunctionID); if (temp != null) { result.PermissionItem = Mapper.Map<SYS_tblPermissionDCO>(temp); result.ResponseItem = new DCO.ResponseItem { Result = true, Status = DCO.ResponseStatus.Success, Message = "", RequestUser = Username, TotalItemCount = 1 }; } } } catch (Exception ex) { result.PermissionItem = Mapper.Map<SYS_tblPermissionDCO>(new SYS_tblPermissionDTO()); result.ResponseItem = new DCO.ResponseItem { Result = false, Status = DCO.ResponseStatus.Exception, Message = "Load permission failed: " + ex.Message, RequestUser = Username, TotalItemCount = 0 }; logger.Error(ex); } return result; }