예제 #1
0
        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);
            }
        }
예제 #2
0
        /// <summary>
        /// Get an specific customerServiceDataEntity
        /// </summary>
        /// <param name="id">id of the CustomerServiceDataEntity to load</param>
        /// <param name="loadRelation">true to load the relations</param>
        /// <param name="session">User's session identifier.</param>
        /// <returns>A CustomerServiceDataEntity</returns>
        /// <exception cref="ArgumentNullException">
        /// if <paramref name="customerServiceDataEntity"/> is null.
        /// </exception>
        /// <exception cref="UtnEmallBusinessLogicException">
        /// If an UtnEmallDataAccessException occurs in DataModel.
        /// </exception>
        public CustomerServiceDataEntity GetCustomerServiceData(int id, bool loadRelation, string session)
        {
            bool permited = ValidationService.Instance.ValidatePermission(session, "read", "CustomerServiceData");

            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(customerservicedataDataAccess.Load(id, loadRelation));
            }
            catch (UtnEmallDataAccessException utnEmallDataAccessException)
            {
                throw new UtnEmall.Server.BusinessLogic.UtnEmallBusinessLogicException(utnEmallDataAccessException.Message, utnEmallDataAccessException);
            }
        }