public void Put(string id, [FromBody] vals value) { vals v = _repo.Find(x => x.id == id); if (v != null) { _repo.Remove(v); _repo.Add(value); } }
public static sprop copysprop(sprop aprop) { if (aprop is wire) { sprop.wire returner2 = new sprop.wire(); returner2.name = aprop.name; return returner2; } if (aprop is interact) { sprop.interact gelec = aprop as interact; sprop.interact returner2 = new sprop.interact(); returner2.name = gelec.name; returner2.abool = gelec.abool; return returner2; } if (aprop is oxgen) { sprop.oxgen gelec = aprop as oxgen; sprop.oxgen returner2 = new sprop.oxgen(); returner2.name = aprop.name; returner2.range = gelec.range; return returner2; } if (aprop is elec) { sprop.elec gelec = aprop as elec; sprop.elec returner2 = new sprop.elec(0); returner2.name = aprop.name; returner2.maxpower = gelec.maxpower; returner2.energyoutput = gelec.energyoutput; returner2.energyuse = gelec.energyuse; returner2.maxbuffer = gelec.maxbuffer; returner2.buffer = gelec.buffer; returner2.intake = gelec.intake; returner2.loss = gelec.loss; for (int k = 0; k < 6; k++) { returner2.connected[k] = gelec.connected[k]; } foreach (int anint in gelec.connecteddef) { returner2.connecteddef.Add(anint); } return returner2; } if (aprop is mech) { sprop.mech gelec = aprop as mech; sprop.mech returner2 = new sprop.mech(gelec.load, gelec.production,gelec.maxprod,gelec.convratio); returner2.name = aprop.name; for (int k = 0; k < 6; k++) { returner2.connected[k] = gelec.connected[k]; } foreach (int anint in gelec.connecteddef) { returner2.connecteddef.Add(anint); } return returner2; } if (aprop is gun) { sprop.gun gelec = aprop as gun; sprop.gun returner2 = new sprop.gun(); returner2.name = aprop.name; returner2.range = gelec.range; returner2.stamp = gelec.stamp; returner2.reset = gelec.reset; return returner2; } if (aprop is vals) { vals gvals = aprop as vals; vals returner2 = new vals(); returner2.name = aprop.name; returner2.vstring = gvals.vstring; returner2.vfloat = gvals.vfloat; returner2.vint = gvals.vint; returner2.vVector3 = gvals.vVector3; returner2.vbool = gvals.vbool; return returner2; } if (aprop is invs) { invs ginvs = aprop as invs; invs returner2 = new invs(ginvs.aninv.inv.Length); for (int k = 0; k < ginvs.aninv.inv.Length; k++) { returner2.aninv.inv[k] = new Inventory.InvItem(); } returner2.aninv.protectsuction = ginvs.aninv.protectsuction; return returner2; } if (aprop is rawinvs) { rawinvs ginvs = aprop as rawinvs; rawinvs returner2 = new rawinvs(ginvs.aninv.maxmass); returner2.aninv.protectsuction = ginvs.aninv.protectsuction; foreach (RawInv.rawlibitem anint in ginvs.aninv.inv) { returner2.aninv.add(anint.id, anint.kg); } return returner2; } if (aprop is drops) { drops ginvs = aprop as drops; drops returner2 = new drops(); returner2.aninv.protectsuction = ginvs.aninv.protectsuction; foreach (RawInv.rawlibitem anint in ginvs.aninv.inv) { returner2.aninv.add(anint.id, anint.kg); } return returner2; } if (aprop is craft) { craft ginvs = aprop as craft; craft returner2 = new craft(ginvs.RecipeList); returner2.vint = ginvs.vint; returner2.vfloat = ginvs.vfloat; returner2.vfloat2 = ginvs.vfloat2; foreach (int anint in ginvs.autos) { returner2.autos.Add(anint); } foreach (RawInv.rawlibitem anint in ginvs.ResultRaw) { returner2.ResultRaw.Add(new RawInv.rawlibitem(anint.id, anint.kg)); } foreach (Inventory.InvItem anint in ginvs.Result) { returner2.Result.Add(new Inventory.InvItem(anint.socket,anint.num)); } return returner2; } sprop returner = new sprop(); returner.name = aprop.name; return returner; }
return(BuildObject(cArgGetters, propSetters, vals, propMapValueCache, logger));
private void initialconfigs() { InitializeComponent(); this.DoubleBuffered = true; this.Text = "Venta de Mostrador"; this.gb1.BorderColor = Color.DarkGray; this.gb2.BorderColor = Color.DarkGray; this.gb3.BorderColor = Color.DarkGray; this.gb4.BorderColor = Color.DarkGray; this.gb5.BorderColor = Color.DarkGray; this.gb6.BorderColor = Color.DarkGray; this.gb7.BorderColor = Color.DarkGray; this.txtcliente.ReadOnly = true; this.txtid.ReadOnly = true; this.txtarticulos.ReadOnly = true; this.txtsubtotal.ReadOnly = true; this.txtiva.ReadOnly = true; this.db = new dbop(); behaviorDefinitions.txtPrice(this.txtdescuentoextra); behaviorDefinitions.txtPrice(this.txtidproducto); this.descuentos = new List <int>() { 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 }; this.cbdescuento.DataSource = this.descuentos; this.tabla = new DataTable(); this.tabla.Columns.Add("Codigo Producto", typeof(string)); this.tabla.Columns.Add("Descripción", typeof(string)); this.tabla.Columns.Add("Cantidad", typeof(string)); this.tabla.Columns.Add("Precio", typeof(string)); this.tabla.Columns.Add("Descuento", typeof(string)); this.tabla.Columns.Add("Importe", typeof(string)); this.dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; this.dgv.DataSource = this.tabla; this.cbcantidad.Minimum = 0; this.tmp = new string[6]; this.atributos = new vals(true); this.txttotal.ReadOnly = true; this.MaximizeBox = false; this.checkboxCP.Checked = true; this.ventatmp = new venta(); this.txtvendedor.Text = (this.usuarioactual.nombre).ToUpper(); //CARGA DATOS DEL USUARIO DEL SISTEMA ACTUAL this.inventario = this.db.getinventarioproductos(); //LLENA INVENTARIO TEMPORAL this.FormClosed += (s, g) => { this.central.xventa = null; }; this.txtidproducto.KeyUp += (sender, args) => { if (args.KeyCode == Keys.Enter && this.txtidproducto.Text.Trim() != "") { if (this.rtbCodigos.Checked) { this.addcodeDirect(); } else { this.codetxtproducto(); } } }; this.cbdescuento.KeyUp += (sender, args) => { if (args.KeyCode == Keys.Enter) { this.additem(this.tmp); } }; this.cbcantidad.KeyUp += (sender, args) => { if (args.KeyCode == Keys.Enter) { this.cbdescuento.Focus(); } }; this.cbcantidad.ValueChanged += (sender, args) => { if (this.cbcantidad.Value > this.cbcantidad.Maximum) { this.cbcantidad.Value = this.cbcantidad.Maximum; } }; this.dgv.KeyUp += (sender, args) => { if (args.KeyCode == Keys.Delete) { this.inventario.Find(x => x.idproducto.ToString() == this.dgv.Rows[dgv.CurrentRow.Index].Cells[0].Value.ToString()).stock += int.Parse(this.dgv.Rows[dgv.CurrentRow.Index].Cells[2].Value.ToString()); this.tabla.Rows.RemoveAt(this.dgv.CurrentRow.Index); this.updatevalues(); } this.txtidproducto.Focus(); }; this.txtdescuentoextra.KeyUp += (sender, args) => { if (this.txtdescuentoextra.Text.Trim() != "" && this.txtsubtotal.Text != "0" && args.KeyCode == Keys.Enter) { if (Double.Parse(this.txtdescuentoextra.Text, CultureInfo.InvariantCulture) >= Double.Parse(this.txtsubtotal.Text, CultureInfo.InvariantCulture)) { genericDefinitions.error("Descuento extra invalido", "Aviso"); this.txtdescuentoextra.Focus(); } else { this.updatevalues(); } } }; this.txtdescuentoextra.KeyPress += (x, y) => { if (this.txtsubtotal.Text == "0") { y.Handled = true; } }; this.Resize += (sender, args) => { this.pb.Location = new Point(this.Width / 2 - this.pb.Width / 2, this.pb.Location.Y); }; this.btnaccept.GotFocus += (x, y) => { this.txtidproducto.Focus(); }; this.txtid.TextChanged += (sender, args) => { this.clienteactual = this.db.getclientAsobject(int.Parse(this.txtid.Text.Trim())); }; this.blapse.GotFocus += (sender, args) => { this.txtidproducto.Focus(); }; this.btnsc.GotFocus += (sender, args) => { this.txtidproducto.Focus(); }; this.stopBounds(); this.setimage(); this.LostFocus += (a, b) => { this.Update(); }; this.GotFocus += (a, b) => { this.Update(); }; this.txtidproducto.KeyUp += (sender, args) => { if (args.KeyCode == Keys.F12) { this.cobrar(); } }; this.btnBuscaproducto.GotFocus += (a, b) => { this.txtidproducto.Focus(); }; }
public void Post([FromBody] vals value) { _repo.Add(value); }