private void DoOnPromocionAprobada() { if (PromocionCupon.SmsSent) { this.MensajeMovil = "Tu cupón ya fue enviado a tu móvil."; if (OnPromocionAprobada != null) { OnPromocionAprobada(this, true); } return; } SmsService.EnviarSmsToCliente(PromocionCupon, UsuarioValidado, PromocionSelected). ContinueWith((t) => { if (t.Result) { using (var repositoryPostSms = new EnteComercialRepository()) { repositoryPostSms.UpdatePromocionCuponBySmsSent(PromocionCupon.Id); this.MensajeMovil = "Tu cupón fue enviado a tu móvil con éxito."; } } else { this.MensajeMovil = "Tu cupón no pudo ser enviado a tu móvil."; } }, CancellationToken.None, TaskContinuationOptions.NotOnFaulted, TaskScheduler.FromCurrentSynchronizationContext()); if (OnPromocionAprobada != null) { OnPromocionAprobada(this, true); } }
public NuestrosClientesViewModel() { this._enteComercialRepository = new EnteComercialRepository(); this._randomObj = new Random(DateTime.Now.Millisecond); this.ListOfPromocionesActivas = new List <Promocion>(); this.ShowEnteComercialsCommand = new DelegateCommand <object>(this.ShowEnteComercials); }
private void ReclamarCupon(Usuario usuarioKiosko) { if (usuarioKiosko == null) { return; } //Validar Usuario using (var usuarioRepository = new UsuariosRepository()) { usuarioRepository.AddOrUpdate(usuarioKiosko); UsuarioValidado = usuarioKiosko; }; ///Promocion using (var repository = new EnteComercialRepository()) { try { PromocionCupon = null; PromocionCupon = repository.ProcesarPromocionCupon(PromocionSelected, UsuarioValidado); DoOnPromocionAprobada(); } catch (InvalidOperationException ex) { if (OnPromocionNoAprobada != null) { OnPromocionNoAprobada(this, ex.Message); } } } }
public BusquedaCategoriaViewModel() { _ramoComercialRepository = new RamoComercialRepository(); _enteComercialRepository = new EnteComercialRepository(); ShowCategoriasByLetterCommand = new DelegateCommand <string>(this.ShowCategoriasByLetter); ShowEnteComercialsCommand = new DelegateCommand <object>(this.ShowEnteComercials); ListOfCategoriasRequested = new ObservableCollection <Categoria>(); }
private void ShowEnteComercial(string obj) { using (var enteComercialRepository = new EnteComercialRepository()) { EnteComercial = enteComercialRepository.FindBy(int.Parse(obj)); if (EnteComercial == null) { GlobalCommands.GoToHomeCommand.Execute(null); return; } PromocionesActivas = new List <Promocion>(enteComercialRepository.GetPromocionesActivasBy(EnteComercial.Id)); } }
public BusquedaTecladoViewModel() { this._enteComercialRepository = new EnteComercialRepository(); this.SearchEnteComercialsCommand = new DelegateCommand <string>(this.SearchEnteComercials); Categorias = new ObservableCollection <Categoria>(); //var testItems = new List<string>(); //testItems.AddRange(new string[]{ // "January", "February" ,"March", "April", "May", "June", "July", "August", "September", "Octuber", "November", "December" //}); AutoCompleteItems = this._enteComercialRepository.GetAutoCompleteTags(); }
private void UpdatePromocionComercial(Kiosko_Promocion_Detalle promocion) { using (var repository = new EnteComercialRepository()) { repository.AddOrUpdatePromocion(promocion); } Uri webpath; //Imagen Small if (!String.IsNullOrEmpty(promocion.ImagenSmallUrl.card.url)) { webpath = new Uri("file://localhost" + promocion.ImagenSmallUrl.card.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(promocion.ImagenSmallUrl.card.url, inputfilepath); } } } //Imagen if (!String.IsNullOrEmpty(promocion.ImagenUrl.banner.url)) { webpath = new Uri("file://localhost" + promocion.ImagenUrl.banner.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(promocion.ImagenUrl.banner.url, inputfilepath); } } } }
public OfertasViewModel() { this._enteComercialRepository = new EnteComercialRepository(); this._randomObj = new Random(DateTime.Now.Millisecond + 100); this.ShowEnteComercialsCommand = new DelegateCommand <object>(this.ShowEnteComercials); }
private void UpdateEntesComerciales(ListOfEnteComercialDTO listOfEntesComerciales) { if (listOfEntesComerciales == null) { return; } //Repositorios using (var repository = new EnteComercialRepository()) { foreach (var item in listOfEntesComerciales.Entes_Comerciales) { repository.AddOrUpdate(item); } } //Imagenes foreach (var item in listOfEntesComerciales.Entes_Comerciales) { Uri webpath; //Imagen if (!String.IsNullOrEmpty(item.ImagenURL.image.url)) { 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); } } } //Logo if (!String.IsNullOrEmpty(item.LogoURL.logo.url)) { webpath = new Uri("file://localhost" + item.LogoURL.logo.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.LogoURL.logo.url, inputfilepath); } } } //Video if (!String.IsNullOrEmpty(item.VideoUrl)) { var path = _videosPath + "\\" + item.VideoUrl; if (System.IO.File.Exists(path)) { string inputfilepath = AppDomain.CurrentDomain.BaseDirectory + "videos\\" + item.VideoUrl; if (!System.IO.File.Exists(inputfilepath)) { System.IO.File.Copy(path, inputfilepath); } } } } }