Ejemplo n.º 1
0
 private void GetDataModelCompleted(GetDataModelResult result)
 {
     dataModelEntity = result.DataModel;
     if (dataModelEntity != null)
     {
         CircularReferencesManager.FixDataModelCircularReferences(dataModelEntity);
         DataModel dataModel = Utilities.ConvertEntityToDataModel(dataModelEntity);
         if (dataModelLoadedCallback != null)
         {
             dataModelLoadedCallback(dataModel);
             dataModelLoadedCallback = null;
         }
     }
 }
Ejemplo n.º 2
0
        public void BeginSaveCustomerService(ServiceDocument serviceDocument, SaveCustomerServiceCallback callback)
        {
            try
            {
                CustomerServiceDataEntity customerServiceData = Utilities.ConvertServiceModelToEntity(serviceDocument, this.dataModelEntity);
                CircularReferencesManager.BrokeCustomerServiceDataCircularReference(customerServiceData);

                SilverlightServicesClient client = Utils.SilverlightServicesClient;
                client.BeginSaveCustomerServiceData(customerServiceData, callback);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        public void BeginSaveDataModel(DataModel dataModel, SaveDataModelCallback callback)
        {
            try
            {
                DataModelEntity dataModelEntity = Utilities.ConvertDataModelToEntity(dataModel);
                dataModelEntity.IdStore = customServiceId;
                CircularReferencesManager.BrokeDataModelCircularReferences(dataModelEntity);

                SilverlightServicesClient client = Utils.SilverlightServicesClient;
                client.BeginSaveDataModel(dataModelEntity, callback);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 4
0
        public void LoadService(int idService, CustomerServiceLoadedCallback callback)
        {
            DataModel currentDataModel = null;

            // Carga del modelo de datos.
            BeginLoadDataModel(
                delegate(DataModel dataModel){
                currentDataModel         = dataModel;
                ServiceDocument document = document = new ServiceDocument();
                document.DataModel       = dataModel;
                if (idService > 0)
                {
                    // Es un servicio existente.
                    SilverlightServicesClient client = Utils.SilverlightServicesClient;
                    client.BeginGetCustomerServiceData(idService,
                                                       delegate(GetCustomerServiceResult result)
                    {
                        if (result.CustomerService != null)
                        {
                            result.CustomerService.DataModel = dataModelEntity;
                            CircularReferencesManager.FixCustomerServiceDataCircularReferences(result.CustomerService);
                            Utilities.ConvertEntityToServiceModel(result.CustomerService, document);
                        }
                        if (callback != null)
                        {
                            callback(document);
                        }
                    }
                                                       );
                }
                else if (callback != null)
                {
                    callback(document);
                }
            }
                );
        }