/// <summary>
        /// Update a OrganisationTypeGroup
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></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 DeleteOrganisationTypeGroup(string currentUser, string user, string appID, string overrideID, string code, string lockID, IRepository <OrganisationTypeGroup> dataRepository, IUnitOfWork uow)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (string.IsNullOrEmpty(code))
                {
                    throw new ArgumentOutOfRangeException("code");
                }
                if (string.IsNullOrEmpty(lockID))
                {
                    throw new ArgumentOutOfRangeException("lockID");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }

                #endregion

                using (uow)
                {
                    // Convert string to guid
                    Guid codeGuid = Guid.Parse(code);

                    // Find item based on ID
                    OrganisationTypeGroup dataEntity = dataRepository.Single(x => x.Code == codeGuid);

                    // Delete the item
                    dataRepository.Delete(dataEntity);

                    // Commit unit of work
                    uow.Commit();
                }
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                ExceptionManager.ShieldException(e);
            }
        }
        /// <summary>
        ///  Create a OrganisationTypeGroup
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="dc"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        public OrganisationTypeGroupVMDC CreateOrganisationTypeGroup(string currentUser, string user, string appID, string overrideID, OrganisationTypeGroupDC dc, IRepository <OrganisationTypeGroup> dataRepository, IUnitOfWork uow, IExceptionManager exceptionManager, IMappingService mappingService)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (null == dc)
                {
                    throw new ArgumentOutOfRangeException("dc");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }
                if (null == exceptionManager)
                {
                    throw new ArgumentOutOfRangeException("exceptionManager");
                }
                if (null == mappingService)
                {
                    throw new ArgumentOutOfRangeException("mappingService");
                }

                #endregion

                using (uow)
                {
                    // Create a new ID for the OrganisationTypeGroup item
                    dc.Code = Guid.NewGuid();

                    // Map data contract to model
                    OrganisationTypeGroup destination = mappingService.Map <OrganisationTypeGroupDC, OrganisationTypeGroup>(dc);

                    // Add the new item
                    dataRepository.Add(destination);

                    // Commit unit of work
                    uow.Commit();

                    // Map model back to data contract to return new row id.
                    dc = mappingService.Map <OrganisationTypeGroup, OrganisationTypeGroupDC>(destination);
                }

                // Create aggregate data contract
                OrganisationTypeGroupVMDC returnObject = new OrganisationTypeGroupVMDC();

                // Add new item to aggregate
                returnObject.OrganisationTypeGroupItem = dc;

                return(returnObject);
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                exceptionManager.ShieldException(e);

                return(null);
            }
        }
        /// <summary>
        /// Retrieve a OrganisationTypeGroup with associated lookups
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="code"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        /// <returns></returns>
        public OrganisationTypeGroupVMDC GetOrganisationTypeGroup(string currentUser, string user, string appID, string overrideID, string code, IUnitOfWork uow, IRepository <OrganisationTypeGroup> dataRepository
                                                                  , IExceptionManager exceptionManager, IMappingService mappingService)

        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }
                if (null == exceptionManager)
                {
                    throw new ArgumentOutOfRangeException("exceptionManager");
                }
                if (null == mappingService)
                {
                    throw new ArgumentOutOfRangeException("mappingService");
                }

                #endregion

                using (uow)
                {
                    OrganisationTypeGroupDC destination = null;

                    // If code is null then just return supporting lists
                    if (!string.IsNullOrEmpty(code))
                    {
                        // Convert code to Guid
                        Guid codeGuid = Guid.Parse(code);

                        // Retrieve specific OrganisationTypeGroup
                        OrganisationTypeGroup dataEntity = dataRepository.Single(x => x.Code == codeGuid);

                        // Convert to data contract for passing through service interface
                        destination = mappingService.Map <OrganisationTypeGroup, OrganisationTypeGroupDC>(dataEntity);
                    }



                    // Create aggregate contract
                    OrganisationTypeGroupVMDC returnObject = new OrganisationTypeGroupVMDC();

                    returnObject.OrganisationTypeGroupItem = destination;

                    return(returnObject);
                }
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                exceptionManager.ShieldException(e);

                return(null);
            }
        }
Ejemplo n.º 4
0
 public static OrganisationTypeGroup WithOrganisationType(this OrganisationTypeGroup organisationTypeGroup, ICollection <OrganisationType> organisationType)
 {
     organisationTypeGroup.OrganisationType = organisationType;
     return(organisationTypeGroup);
 }
Ejemplo n.º 5
0
 public static OrganisationTypeGroup WithApplicationOrganisationTypeGroup(this OrganisationTypeGroup organisationTypeGroup, ICollection <ApplicationOrganisationTypeGroup> applicationOrganisationTypeGroup)
 {
     organisationTypeGroup.ApplicationOrganisationTypeGroup = applicationOrganisationTypeGroup;
     return(organisationTypeGroup);
 }
Ejemplo n.º 6
0
 public static OrganisationTypeGroup WithIsActive(this OrganisationTypeGroup organisationTypeGroup, Boolean isActive)
 {
     organisationTypeGroup.IsActive = isActive;
     return(organisationTypeGroup);
 }
Ejemplo n.º 7
0
 public static OrganisationTypeGroup WithName(this OrganisationTypeGroup organisationTypeGroup, String name)
 {
     organisationTypeGroup.Name = name;
     return(organisationTypeGroup);
 }
Ejemplo n.º 8
0
 public static OrganisationTypeGroup WithCode(this OrganisationTypeGroup organisationTypeGroup, Guid code)
 {
     organisationTypeGroup.Code = code;
     return(organisationTypeGroup);
 }
Ejemplo n.º 9
0
 public static ApplicationOrganisationTypeGroup WithOrganisationTypeGroup(this ApplicationOrganisationTypeGroup applicationOrganisationTypeGroup, OrganisationTypeGroup organisationTypeGroup)
 {
     applicationOrganisationTypeGroup.OrganisationTypeGroup = organisationTypeGroup;
     return(applicationOrganisationTypeGroup);
 }
        /// <summary>
        /// Update a OrganisationTypeGroup
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="dc"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        public OrganisationTypeGroupVMDC UpdateOrganisationTypeGroup(string currentUser, string user, string appID, string overrideID, OrganisationTypeGroupDC dc, IRepository <OrganisationTypeGroup> dataRepository, IUnitOfWork uow)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (null == dc)
                {
                    throw new ArgumentOutOfRangeException("dc");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }

                #endregion

                using (uow)
                {
                    // Map data contract to model
                    OrganisationTypeGroup destination = Mapper.Map <OrganisationTypeGroupDC, OrganisationTypeGroup>(dc);

                    // Add the new item
                    dataRepository.Update(destination);

                    // Commit unit of work
                    uow.Commit();

                    dc = Mapper.Map <OrganisationTypeGroup, OrganisationTypeGroupDC>(destination);
                }

                // Create new data contract to return
                OrganisationTypeGroupVMDC returnObject = new OrganisationTypeGroupVMDC();

                // Add new item to datacontract
                returnObject.OrganisationTypeGroupItem = dc;

                // Commit unit of work
                return(returnObject);
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                ExceptionManager.ShieldException(e);

                return(null);
            }
        }
 public static OrganisationType WithOrganisationTypeGroup(this OrganisationType organisationType, OrganisationTypeGroup organisationTypeGroup)
 {
     organisationType.OrganisationTypeGroup = organisationTypeGroup;
     return(organisationType);
 }