public BusquedaCategoriaViewModel()
        {
            _ramoComercialRepository = new RamoComercialRepository();
            _enteComercialRepository = new EnteComercialRepository();

            ShowCategoriasByLetterCommand = new DelegateCommand <string>(this.ShowCategoriasByLetter);
            ShowEnteComercialsCommand     = new DelegateCommand <object>(this.ShowEnteComercials);

            ListOfCategoriasRequested = new ObservableCollection <Categoria>();
        }
Example #2
0
        private void UpdateRamosComerciales(ListOfRamoComercialDTO listOfRamosComerciales)
        {
            if (listOfRamosComerciales == null)
            {
                return;
            }

            //Repositorios
            using (var repository = new RamoComercialRepository())
            {
                foreach (var item in listOfRamosComerciales.Ramos_Comerciales)
                {
                    repository.AddOrUpdate(item);
                }
            }

            //Imagenes
            foreach (var item in listOfRamosComerciales.Ramos_Comerciales)
            {
                if (String.IsNullOrEmpty(item.ImagenURL.image.url))
                {
                    continue;
                }
                Uri webpath = new Uri("file://localhost" + item.ImagenURL.image.url);
                if (webpath.IsFile)
                {
                    string filename      = System.IO.Path.GetFileName(webpath.LocalPath);
                    string inputfilepath = AppDomain.CurrentDomain.BaseDirectory + "media\\" + filename;
                    if (!System.IO.File.Exists(inputfilepath))
                    {
                        //descargo
                        DownloadFileFTP(item.ImagenURL.image.url, inputfilepath);
                    }
                }
            }
        }