/// <summary> /// /// </summary> /// <param name="userName"></param> /// <param name="currentUserName"></param> /// <param name="appID"></param> /// <param name="overrideID"></param> /// <param name="code"></param> /// <param name="dataRepository"></param> /// <param name="uow"></param> /// <returns></returns> public StaffAttributeVMDC GetStaffAttribute(string userName, string currentUserName, string appID, string overrideID, string code, IUnitOfWork uow, IRepository <StaffAttribute> dataRepository , IRepository <Staff> staffRepository , IRepository <Application> applicationRepository , IRepository <ApplicationAttribute> applicationAttributeRepository ) { try { using (uow) { // Convert code to Guid Guid codeGuid = Guid.Parse(code); // Retrieve specific StaffAttribute StaffAttribute dataEntity = dataRepository.Single(x => x.Code == codeGuid); // Convert to data contract for passing through service interface StaffAttributeDC destination = Mapper.Map <StaffAttribute, StaffAttributeDC>(dataEntity); IEnumerable <Staff> staffList = staffRepository.GetAll(); IEnumerable <Application> applicationList = applicationRepository.GetAll(); IEnumerable <ApplicationAttribute> applicationAttributeList = applicationAttributeRepository.GetAll(); List <StaffDC> staffDestinationList = Mapper.Map <List <StaffDC> >(staffList); List <ApplicationDC> applicationDestinationList = Mapper.Map <List <ApplicationDC> >(applicationList); List <ApplicationAttributeDC> applicationAttributeDestinationList = Mapper.Map <List <ApplicationAttributeDC> >(applicationAttributeList); // Create aggregate contract StaffAttributeVMDC message = new StaffAttributeVMDC(); message.StaffAttributeItem = destination; message.StaffList = staffDestinationList; message.ApplicationList = applicationDestinationList; message.ApplicationAttributeList = applicationAttributeDestinationList; return(message); } } catch (Exception e) { //Prevent exception from propogating across the service interface ExceptionManager.ShieldException(e); return(null); } }
/// <summary> /// /// </summary> /// <param name="userName"></param> /// <param name="currentUserName"></param> /// <param name="appID"></param> /// <param name="overrideID"></param> /// <param name="dc"></param> /// <param name="dataRepository"></param> /// <param name="uow"></param> public void CreateStaffAttribute(string userName, string currentUserName, string appID, string overrideID, StaffAttributeDC dc, IRepository <StaffAttribute> dataRepository, IUnitOfWork uow) { try { using (uow) { StaffAttribute destination = Mapper.Map <StaffAttributeDC, StaffAttribute>(dc); dataRepository.Add(destination); uow.Commit(); } } catch (Exception e) { //Prevent exception from propogating across the service interface ExceptionManager.ShieldException(e); } }
/// <summary> /// /// </summary> /// <param name="userName"></param> /// <param name="currentUserName"></param> /// <param name="appID"></param> /// <param name="overrideID"></param> /// <param name="code"></param> /// <param name="lockID"></param> /// <param name="dataRepository"></param> /// <param name="uow"></param> public void DeleteStaffAttribute(string userName, string currentUserName, string appID, string overrideID, string code, string lockID, IRepository <StaffAttribute> dataRepository, IUnitOfWork uow) { try { using (uow) { Guid codeGuid = Guid.Parse(code); StaffAttribute dataEntity = dataRepository.Single(x => x.Code == codeGuid); dataRepository.Delete(dataEntity); uow.Commit(); } } catch (Exception e) { //Prevent exception from propogating across the service interface ExceptionManager.ShieldException(e); } }
public static StaffAttribute WithStaff(this StaffAttribute staffAttribute, Staff staff) { staffAttribute.Staff = staff; return(staffAttribute); }
public static StaffAttribute WithApplication(this StaffAttribute staffAttribute, Application application) { staffAttribute.Application = application; return(staffAttribute); }
public static StaffAttribute WithLookupValue(this StaffAttribute staffAttribute, String lookupValue) { staffAttribute.LookupValue = lookupValue; return(staffAttribute); }
public static StaffAttribute WithLookupKey(this StaffAttribute staffAttribute, String lookupKey) { staffAttribute.LookupKey = lookupKey; return(staffAttribute); }
public static StaffAttribute WithApplicationCode(this StaffAttribute staffAttribute, Guid applicationCode) { staffAttribute.ApplicationCode = applicationCode; return(staffAttribute); }
public static StaffAttribute WithStaffCode(this StaffAttribute staffAttribute, Guid staffCode) { staffAttribute.StaffCode = staffCode; return(staffAttribute); }
public static StaffAttribute WithCode(this StaffAttribute staffAttribute, Guid code) { staffAttribute.Code = code; return(staffAttribute); }