/// <summary> /// Obtiene una colección de serviceEntity /// </summary> /// <param name="loadRelation">true si desea guardar las relaciones</param> /// <param name="session">Identificador de sesion.</param> /// <returns>Collection de ServiceEntity</returns> /// <exception cref="UtnEmallBusinessLogicException"> /// Si una excepción UtnEmallDataAccessException ocurre en el data model. /// </exception> public Collection <ServiceEntity> GetAllService(bool loadRelation) { try { return(serviceDataAccess.LoadAll(loadRelation)); } catch (UtnEmallDataAccessException utnEmallDataAccessException) { throw new UtnEmallBusinessLogicException(utnEmallDataAccessException.Message, utnEmallDataAccessException); } }
private void InitCustomServices() { try { // Cargar los modelos de datos y verificar los ensamblados ServiceDataAccess serviceDataAccess = new ServiceDataAccess(); Collection <ServiceEntity> services = serviceDataAccess.LoadAll(true); foreach (ServiceEntity service in services) { string assemblyFileName = service.PathAssemblyServer; if (assemblyFileName != null) { if (File.Exists(Path.Combine(ServiceBuilder.AssembliesFolder, assemblyFileName))) { Type[] servicesTypes = ServiceBuilder.GetCustomServiceTypes(assemblyFileName); Binding serviceBinding = new BasicHttpBinding(); if (PublishCustomService(servicesTypes[0], servicesTypes[1], serviceBinding)) { Debug.WriteLine("SUCCESS : custom service published."); } else { Debug.WriteLine("FAILURE : trying to publish custom service."); } } else { CustomerServiceDataDataAccess customerServiceData = new CustomerServiceDataDataAccess(); CustomerServiceDataEntity customerService = customerServiceData.Load(service.IdCustomerServiceData, true); ServiceBuilder builder = new ServiceBuilder(); service.Deployed = false; customerService.Service = service; builder.BuildAndImplementCustomService(customerService, serverSession); } } } } catch (DataException dataError) { Debug.WriteLine("ERROR : Data exception running infrastructure services. MESSAGE : " + dataError.Message); } catch (IOException ioError) { Debug.WriteLine("ERROR : IO error running infrastructure services. MESSAGE : " + ioError.Message); } }
/// <summary> /// Get collection of all serviceEntity /// </summary> /// <param name="loadRelation">true to load the relations</param> /// <param name="session">User's session identifier.</param> /// <returns>Collection of all ServiceEntity</returns> /// <exception cref="UtnEmallBusinessLogicException"> /// If an UtnEmallDataAccessException occurs in DataModel. /// </exception> public Collection <ServiceEntity> GetAllService(bool loadRelation, string session) { bool permited = ValidationService.Instance.ValidatePermission(session, "read", "Service"); if (!permited) { ExceptionDetail detail = new ExceptionDetail(new UtnEmall.Server.BusinessLogic.UtnEmallPermissionException("The user hasn't permissions to read an entity")); throw new FaultException <ExceptionDetail>(detail); } try { return(serviceDataAccess.LoadAll(loadRelation)); } catch (UtnEmallDataAccessException utnEmallDataAccessException) { throw new UtnEmall.Server.BusinessLogic.UtnEmallBusinessLogicException(utnEmallDataAccessException.Message, utnEmallDataAccessException); } }