public List <CarouselData> promo(string usuario) { promocion codigo = new promocion { idUsuario = usuario }; List <CarouselData> promo; string json = JsonConvert.SerializeObject(codigo, Formatting.Indented); StringContent Content = new StringContent(json, Encoding.UTF8, "application/json"); Uri RequestUri = new Uri("https://asigna-promociones.herokuapp.com/getPromociones"); HttpResponseMessage res = client.PutAsync(RequestUri, Content).Result; string result = JsonConvert.SerializeObject(res.Content.ReadAsStringAsync().Result, Formatting.Indented); if (result.Contains("exists")) { promo = null; } else { //result = "no contiene"; promo = JsonConvert.DeserializeObject <List <CarouselData> >(res.Content.ReadAsStringAsync().Result); } return(promo); //return result; }
private void button1_Click(object sender, EventArgs e) { promocion pr = new promocion(); pr.plg = this.preciopromo.Text; pr.ps = this.precioserv.Text; pr.pe = this.precioesp.Text; pr.descrip = this.descrip.Text; new query().crearpromocion(pr); }
public void crearpromocion(promocion promo) { this.conectarMySQL(); string sql = ("INSERT INTO `punto_venta_autolavado`.`descuentos`" + " (`lgeneral`,`descservicio`,`descespecial`,`descripcion`) " + " VALUES (" + promo.pe + "," + promo.plg + "," + promo.ps + "," + promo.descrip + "," + "');"); this.desconectarMySQL(); }
public PromocionesDTO GetPk(int i) { try { PromocionesDTO ud = new PromocionesDTO(); promocion u = db.promocion.Where(t => t.codigo == i).SingleOrDefault(); Mapper.Map(u, ud); return(ud); } catch (Exception ex) { throw ex; } }
public void AgregarPromociones(PromocionesDTO obje) { try { promocion obj = new promocion(); Mapper.CreateMap <PromocionesDTO, promocion>(); Mapper.Map(obje, obj); db.promocion.Add(obj); db.SaveChanges(); } catch (Exception ex) { throw ex; } }
public promocion insertPromo(string usuario) { promocion codigo = new promocion { idUsuario = usuario }; promocion promo; string json = JsonConvert.SerializeObject(codigo, Formatting.Indented); StringContent Content = new StringContent(json, Encoding.UTF8, "application/json"); Uri RequestUri = new Uri("https://asigna-promociones.herokuapp.com/promociones"); HttpResponseMessage res = client.PutAsync(RequestUri, Content).Result; promo = JsonConvert.DeserializeObject <promocion>(res.Content.ReadAsStringAsync().Result); return(promo); }
public void AgregarPromociones(PromocionesDTO obje) { try { promocion obj = new promocion(); Mapper.CreateMap<PromocionesDTO, promocion>(); Mapper.Map(obje, obj); db.promocion.Add(obj); db.SaveChanges(); } catch (Exception ex) { throw ex; } }
public void ActualizarPromociones(int id, PromocionesDTO obj) { promocion u = db.promocion.Where(t => t.codigo == id).FirstOrDefault(); if (u != null) { u.codigo = obj.codigo; u.nombre = obj.nombre; u.precio = obj.precio; u.empresa = obj.empresa; obj.fechaIncial = obj.fechaIncial; obj.fechaFincal = obj.fechaFincal; obj.imagen = obj.imagen; db.SaveChanges(); } }
public Promocion(string id) { InitializeComponent(); _id = id; n = globales.GetPromocion(_id); lNombre.Text = n.nombre; lDescripcion.Text = n.descripcion; lRestricciones.Text = n.restricciones; DateTime ini, fin; ini = DateTime.Parse(n.inicia); fin = DateTime.Parse(n.vigencia); lFechaV.Text = "De " + ini.Day + "/" + globales.MonthName(ini) + "/" + ini.Year + " " + ini.Hour + ":" + ini.Minute.ToString().PadLeft(2, '0') + " hrs " + "\nAl " + fin.Day + "/" + globales.MonthName(fin) + "/" + fin.Year + " " + fin.Hour + ":" + fin.Minute.ToString().PadLeft(2, '0') + " hrs "; }
private async void BtnConfirmarOrden_Clicked(object sender, EventArgs e) { var activo = true; promocion p = null; await Task.Factory.StartNew(() => { UserDialogs.Instance.ShowLoading("Estamos procesando tu pago"); new restClient().insertOrden(idPhone1, sucursal1, descripcion1, total1); p = new restClient().insertPromo(idPhone1); UserDialogs.Instance.HideLoading(); activo = false; var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); for (int i = 0; i <= 5; i++) { var filename = Path.Combine(documents, i.ToString() + ".txt"); try { File.Delete(filename); } catch (FileNotFoundException) { } } }); if (activo == false) { await Navigation.PopToRootAsync(); await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PushAsync(new PopUpConfirmacion()); if (p.exists) { await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PushAsync(new PopupOferta(idPhone1)); } } }