private void iniciaMesa() { ApiBase inicioApi = new ApiBase(); IRestResponse respuesta = inicioApi.execApi(urlcont, mesascoman); listaMesas = JsonConvert.DeserializeObject <List <Model.MesasModel> >(respuesta.Content); if (listaMesas.Count > 0) { for (int i = 0; i < listaMesas.Count; i++) { Button botonPro = new Button(); botonPro.Name = "btmesas" + i; botonPro.Text = "" + listaMesas[i].numero; botonPro.Height = 100; botonPro.Width = 100; botonPro.ForeColor = Color.White; if (String.Equals(listaMesas[i].estado, "O")) { botonPro.BackColor = Color.Red; } else { botonPro.BackColor = Color.Green; } flpMesas.Controls.Add(botonPro); botonPro.Click += new EventHandler(button_Click); } } }
private void clickCatg(object sender, EventArgs e) { if (flpProductos.Controls.Count > 0) { flpProductos.Controls.Clear(); } Button button = sender as Button; String str = button.Name.Substring(button.Name.Length - 1); ApiBase apbasep = new ApiBase(); Model.ProdEnCatgModel obj = new Model.ProdEnCatgModel(); obj.id_categoria = listaCatg[int.Parse(str)].id_categoria; IRestResponse respuesta2 = apbasep.execApi(urlprodgcont, JsonConvert.SerializeObject(obj)); prodCatg = JsonConvert.DeserializeObject <List <Model.ProdEnCatgModel> >(respuesta2.Content); for (int j = 0; j < prodCatg.Count; j++) { Button botonPro = new Button(); botonPro.Name = "btnprod" + j; botonPro.Text = prodCatg[j].descripcion; botonPro.Height = 100; botonPro.Width = 100; botonPro.Click += new EventHandler(clickProducto); flpProductos.Controls.Add(botonPro); } }
private void btcompra_Click(object sender, EventArgs e) { ApiBase apbasep = new ApiBase(); Model.NuevaOrdenModel obj = new Model.NuevaOrdenModel(); obj.total = txbtotal.Text; obj.iduser = "******";//aqui va el id del usuario que se obtiene con el login obj.mesa = idmesa; obj.idclient = idcliente; List <Model.ProductosEnOrdenModel> productoss = new List <Model.ProductosEnOrdenModel>(); foreach (DataGridViewRow fila in dataGridView1.Rows) { double c = double.Parse(fila.Cells["canti"].Value.ToString()); double p = double.Parse(fila.Cells["preci"].Value.ToString()); double t = (c * p); productoss.Add(new Model.ProductosEnOrdenModel { idproduct = fila.Cells["idproducto"].Value.ToString(), cantidades = c.ToString(), preciosss = p.ToString(), totality = t.ToString() }); } obj.productos = productoss; IRestResponse respues = apbasep.execApi(urlnuevaorden, JsonConvert.SerializeObject(obj)); string h = JsonConvert.DeserializeObject <String>(respues.Content); if (!string.IsNullOrEmpty(h)) { this.OnAviso(h); this.Close(); } else { MessageBox.Show("Error"); } }
private void btcli_Click(object sender, EventArgs e) { idcliente = txtidcli.Text; ApiBase llamada = new ApiBase(); Model.SolcClsModel modelo = new Model.SolcClsModel(); modelo.id_cliente = idcliente; IRestResponse resp = llamada.execApi(urlclpnts, JsonConvert.SerializeObject(modelo)); clienteinfo = JsonConvert.DeserializeObject <Model.SolcClsModel>(resp.Content); lbnombre.Text = String.Concat(clienteinfo.nombre, clienteinfo.apellido); lbpunts.Text = clienteinfo.puntos; }
private void cargaboto() { //Carga categoria 1 entrada ApiBase apbase = new ApiBase(); IRestResponse respuesta = apbase.execApi(urlcatgcont, coman); listaCatg = JsonConvert.DeserializeObject <List <Model.CategModel> >(respuesta.Content); for (int i = 0; i < listaCatg.Count; i++) { Button botonCat = new Button(); botonCat.Name = "btncat" + i; botonCat.Text = listaCatg[i].nombre; botonCat.Width = 90; botonCat.Height = 80; flpCplatosfue.Controls.Add(botonCat); botonCat.Click += new EventHandler(clickCatg); } }