示例#1
0
        private void CompanyMapper_OnLoaded(object sender, RoutedEventArgs e)
        {
            FileError.Content = string.Empty;
            if (CompanyMappers == null)
            {
                CompanyMappers = new ObservableCollection <CompanyMapperDto>();
            }

            DataContext         = this;
            TheCompanyMapperDto = new CompanyMapperDto();
        }
示例#2
0
        public void ChargeCompanyMapper(string selectedPath)
        {
            List <IsoluctionParameterDto> dataParametersRetrieved;

            using (var streamReader = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + @"\LicenseParametersRequired.json"))
            {
                var jsonLicenseParameters = streamReader.ReadToEnd();
                dataParametersRetrieved =
                    JsonConvert.DeserializeObject <List <IsoluctionParameterDto> >(jsonLicenseParameters);
            }
            try
            {
                var dataRetrieved = _parameterService.GetIsolucionParameterValues(dataParametersRetrieved, selectedPath);
                _dataBaseProvider =
                    dataRetrieved.FirstOrDefault(x => x.Key == LicenseParameter.DataBaseEngine).Value.ToUpper() == "ORACLE"
                    ? DataBaseProvider.Oracle
                    : DataBaseProvider.SqlServer;
                _connectionString = dataRetrieved.FirstOrDefault(
                    x => x.Key == LicenseParameter.ConnectionStringSf).Value;

                using (var streamReader = new StreamReader(AppDomain.CurrentDomain.BaseDirectory + @"\IsolucionParameter.json"))
                {
                    var jsonLicenseParameters = streamReader.ReadToEnd();
                    dataParametersRetrieved =
                        JsonConvert.DeserializeObject <List <IsoluctionParameterDto> >(jsonLicenseParameters);
                }

                var dataCompany = new Dictionary <ParameterIsolucion, string>();
                _dataParametersNotExisting = new Dictionary <ParameterIsolucion, ParameterStatus>();

                foreach (var item in dataParametersRetrieved)
                {
                    var data = _dataBaseProviderService.GetParameterValue(item, _dataBaseProvider, _connectionString, out var existParameter);

                    dataCompany.Add(item.ParameterIsolucion, data);
                    _dataParametersNotExisting.Add(item.ParameterIsolucion, existParameter);

                    switch (item.ParameterIsolucion)
                    {
                    case ParameterIsolucion.RutaAnexo:
                        BancoAnexo.CreateParameterAndFillItValue = existParameter == ParameterStatus.DoesNotExist;
                        BancoAnexo.FillParameterValue            = existParameter == ParameterStatus.NullOrEmpty;
                        break;

                    case ParameterIsolucion.RutaWebSite:
                        Web.CreateParameterAndFillItValue = existParameter == ParameterStatus.DoesNotExist;
                        Web.FillParameterValue            = existParameter == ParameterStatus.NullOrEmpty;
                        break;

                    case ParameterIsolucion.RutaArticulo:
                        BancoConocimiento.CreateParameterAndFillItValue = existParameter == ParameterStatus.DoesNotExist;
                        BancoConocimiento.FillParameterValue            = existParameter == ParameterStatus.NullOrEmpty;
                        break;

                    case ParameterIsolucion.RutaLibreria:
                        Libreria.CreateParameterAndFillItValue = existParameter == ParameterStatus.DoesNotExist;
                        Libreria.FillParameterValue            = existParameter == ParameterStatus.NullOrEmpty;
                        break;

                    case ParameterIsolucion.RutaHttpServicios:
                        IsolucionServicio.CreateParameterAndFillItValue = existParameter == ParameterStatus.DoesNotExist;
                        IsolucionServicio.FillParameterValue            = existParameter == ParameterStatus.NullOrEmpty;
                        break;

                    case ParameterIsolucion.RutaBaseCacheDatos:
                        Template.CreateParameterAndFillItValue = existParameter == ParameterStatus.DoesNotExist;
                        Template.FillParameterValue            = existParameter == ParameterStatus.NullOrEmpty;
                        break;

                    case ParameterIsolucion.AppRutaServicioWebSf:
                        SmartFlow.CreateParameterAndFillItValue = existParameter == ParameterStatus.DoesNotExist;
                        SmartFlow.FillParameterValue            = existParameter == ParameterStatus.NullOrEmpty;
                        break;

                    case ParameterIsolucion.WebSite:
                        SmartFlow.CreateParameterAndFillItValue = existParameter == ParameterStatus.DoesNotExist;
                        SmartFlow.FillParameterValue            = existParameter == ParameterStatus.NullOrEmpty;
                        break;

                    case ParameterIsolucion.GenericHandler:
                        SmartFlow.CreateParameterAndFillItValue = existParameter == ParameterStatus.DoesNotExist;
                        SmartFlow.FillParameterValue            = existParameter == ParameterStatus.NullOrEmpty;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }

                TheCompanyMapperDto = new CompanyMapperDto
                {
                    Name                  = dataCompany[ParameterIsolucion.WebSite],
                    SmartFlowPath         = dataCompany[ParameterIsolucion.AppRutaServicioWebSf],
                    IsolucionServicioPath = dataCompany[ParameterIsolucion.RutaHttpServicios],
                    NewsLetterPath        = string.Empty,
                    Id                    = Guid.NewGuid(),
                    BancoAnexoPath        = dataCompany[ParameterIsolucion.RutaAnexo],
                    BancoConocimientoPath = dataCompany[ParameterIsolucion.RutaArticulo],
                    LibreriaPath          = dataCompany[ParameterIsolucion.RutaLibreria],
                    LicencePath           = selectedPath,
                    TemplatePath          = dataCompany[ParameterIsolucion.RutaBaseCacheDatos],
                    WebPath               = dataCompany[ParameterIsolucion.RutaWebSite],
                    RootPath              = selectedPath,
                    GenericHandlerPath    = dataCompany[ParameterIsolucion.GenericHandler],
                };

                PathData.Visibility  = Visibility.Visible;
                PanelGrid.Visibility = PanelClose.Visibility = LicenseView.Visibility = Visibility.Visible;
            }
            catch (Exception ex)
            {
                SetContentControlMessage(Error, $"La ruta seleccionada no es correcta");
                Log.Instance.Error($"Se presentó un error al obtener la lista con la ruta seleccionada en el equipo {ex.Message}");
            }
        }