public async Task <ActionResult <Precio> > PostPrecio(Precio precio) { _context.Precio.Add(precio); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPrecio", new { id = precio.Id }, precio)); }
public void Insert(Precio model, int FK_BuildOfMaterialsID, int FK_ProductID) { var objRepository = new RepositoryPrice(); EntityPrice data = new EntityPrice() { PK_PriceID = 0, FK_BuildOfMaterialsID = FK_BuildOfMaterialsID, FK_ProductID = FK_ProductID, TypeCondition = model.TipoCondicion, SalesOrganization = model.OrganizacionVentas, DistributionChannel = model.CanalDistribucion, Price = double.Parse(model.PrecioMaterial), Coin = model.Moneda, DateValidity = DateTime.ParseExact(model.FechaValidez, "yyyyMMdd", CultureInfo.InvariantCulture), DateValidityEnd = DateTime.ParseExact(model.FechaFinValidez, "yyyyMMdd", CultureInfo.InvariantCulture), Policy = "", Guaranty = "", Status = true, CreateDate = DateTime.Now, ModifyDate = DateTime.UtcNow }; data = objRepository.Insert(data); }
public OrdenDeCompra(Proveedor proveedor, AsistenciaTecnica asistencia, Componente componente, Precio precio) : base(Id.Empty) { Proveedor = proveedor; AsistenciaTecnica = asistencia; Componente = componente; Precio = precio; }
private void GuardarPrecios() { try { for (int i = 0; i < grvPrecios.RowCount; i++) { Precio premod = _entidades.Precios.FirstOrDefault(p => p.Clave == Convert.ToInt32(grvPrecios.GetRowCellValue(i, "Clave").ToString())); if (premod == null) { continue; } premod.Empeño = Convert.ToDecimal(grvPrecios.GetRowCellValue(i, "Empeño").ToString()); premod.Compra = Convert.ToDecimal(grvPrecios.GetRowCellValue(i, "Compra").ToString()); premod.VentaContado = Convert.ToDecimal(grvPrecios.GetRowCellValue(i, "VentaContado").ToString()); premod.VentaApartado = Convert.ToDecimal(grvPrecios.GetRowCellValue(i, "VentaApartado").ToString()); _entidades.SubmitChanges(); } XtraMessageBox.Show("Se ha Guardado los Precios", "Guardar"); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Error en Guardar"); } }
public async Task <IActionResult> PutPrecio(DateTime id, Precio precio) { if (id != precio.fechahora) { return(BadRequest()); } _context.Entry(precio).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrecioExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public override string ToString() { return(string.Format("ID: {0}\r\nNombre: {1}\r\nPrecio: {2}" , ID.ToString("0000000000;-0000000000") , string.Format("{0,-25}", Nombre) , Precio.ToString("0000000000;-0000000000"))); }
private void Mostrar() { Pelicula peliculas = null; Genero genero = null; Calificacion clasificacion = null; Precio precio = null; NegocioCine.Conectar(); peliculas = NegocioCine.ObtenerPelicula(Convert.ToInt32(Session["idPelicula"])); genero = NegocioCine.ObtenerGenero(peliculas.Genero); clasificacion = NegocioCine.ObtenerCalificacion(peliculas.Calificacion); precio = NegocioCine.ObtenerPrecio(peliculas.Formato3D); Session["Precio"] = precio.Importe; imgDetalle.ImageUrl = peliculas.Imagen; lblNombrePelicula.Text = peliculas.Nombre; lblDuracion.Text += peliculas.Duracion.ToString() + " min"; lblSinopsis.Text = peliculas.Sinopsis; lblGenero.Text += genero.Nombre; lblClasificacion.Text += clasificacion.Nombre; lblPrecio.Text += precio.Importe; if (peliculas.Formato3D) { lblFormato.Text += "3D"; } else { lblFormato.Text += "2D"; } }
public IHttpActionResult PutPrecio(int id, Precio precio) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != precio.idPrecio) { return(BadRequest()); } db.Entry(precio).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PrecioExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,PrecioNormal,PrecioPromocion,CursoId")] Precio precio) { if (id != precio.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(precio); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrecioExists(precio.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CursoId"] = new SelectList(_context.Curso, "Id", "Titulo", precio.CursoId); return(View(precio)); }
public bool agregar(Precio precio) { try { conexion.abrir(); query = "INSERT INTO Precios VALUES(@codCine, @codTipoSala, @codTipoEntrada, @precio)"; comando = new SqlCommand(query, conexion.getSqlConnection()); comando.Parameters.Add("@codCine", SqlDbType.Int); comando.Parameters["@codCine"].Value = precio.getCine().getId(); comando.Parameters.Add("@codTipoSala", SqlDbType.Int); comando.Parameters["@codTipoSala"].Value = precio.getTipoSala().getId(); comando.Parameters.Add("@codTipoEntrada", SqlDbType.Int); comando.Parameters["@codTipoEntrada"].Value = precio.getTipoEntrada().getId(); comando.Parameters.Add("@precio", SqlDbType.Int); comando.Parameters["@precio"].Value = precio.getPrecio(); comando.ExecuteNonQuery(); conexion.cerrar(); return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); conexion.cerrar(); return(false); } }
public bool modificar(Precio precio) { try { conexion.abrir(); query = "UPDATE Precios SET Precio_Prec = @precio WHERE CodCine_Prec = @codCine AND " + "CodTipoDeSala_Prec = @codTipoSala AND CodTipoDeEntrada_Prec = @codTipoEntrada"; comando = new SqlCommand(query, conexion.getSqlConnection()); comando.Parameters.Add("@codCine", SqlDbType.Int); comando.Parameters["@codCine"].Value = precio.getCine().getId(); comando.Parameters.Add("@codTipoSala", SqlDbType.Int); comando.Parameters["@codTipoSala"].Value = precio.getTipoSala().getId(); comando.Parameters.Add("@codTipoEntrada", SqlDbType.Int); comando.Parameters["@codTipoEntrada"].Value = precio.getTipoEntrada().getId(); comando.Parameters.Add("@precio", SqlDbType.Int); comando.Parameters["@precio"].Value = precio.getPrecio(); comando.ExecuteNonQuery(); conexion.cerrar(); return(true); } catch (Exception ex) { Console.WriteLine(ex.Message); conexion.cerrar(); return(false); } }
public ActionResult Create(Precio especie) { try { // TODO: Add insert logic here var result = process.Agregar(especie); TempData["MessageViewBagName"] = new GenericMessageViewModel { Message = "Registro agregado a la base de datos.", // orivle MessageType = GenericMessages.success }; return(RedirectToAction("Index")); } catch (Exception ex) { TempData["MessageViewBagName"] = new GenericMessageViewModel { Message = ex.Message, MessageType = GenericMessages.danger, ConstantMessage = true }; return(View(especie)); } }
public string insertarPrecio([FromBody] Precio precio) { HotelesEntities db = new HotelesEntities(); try { if (precio.ID_Precio == 0) { db.sproc_hoteles_InsertPrecio(precio.Tipo, precio.Monto); } else { db.sproc_hoteles_UpdatePrecio(precio.ID_Precio, precio.Tipo, precio.Monto); } var responseModel = new ResponseModel { Success = true, Message = "Precio registrado" }; return(JsonConvert.SerializeObject(responseModel)); } catch (DbEntityValidationException e) { manejoDeErrores.GuardarError(e.ToString()); return(JsonConvert.SerializeObject(manejoDeErrores.errorBaseDeDatos(e))); } catch (Exception ex) { manejoDeErrores.GuardarError(ex.ToString()); return(JsonConvert.SerializeObject(manejoDeErrores.errorGeneral(ex))); } }
public async Task <ActionResult <Response> > UpdPrecio([FromBody] Precio precio) { Response response = new Response(); object rpta = new object(); try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } precio = (Precio)BusinessLogic.Utilities.AuxiliarMethods.ValidateParameters(precio, precio.GetType()); rpta = await _productologic.UpdPrecio(precio); if (rpta == null) { return(NotFound()); } } catch (Exception e) { response.Status = Constant.Error500; response.Message = e.Message; return(Ok(response)); } return(Ok(rpta)); }
private void tsbSeleccionar_Click(object sender, EventArgs e) { Precio precioSeleccionado = ((List <Precio>)dgvPrecios.DataSource).Where(x => x.seleccionado).FirstOrDefault(); if (precioSeleccionado == null) { MessageBox.Show("Para poder seleccionar tiene que realizar la búsqueda de un producto", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (precioSeleccionado.precio == 0) { MessageBox.Show("Producto no tiene precio", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (tipoOrdenVenta == "O" && lvwInventario.CheckedItems.Count == 0) { MessageBox.Show("Seleccione una bodega de la cual se va a tomar el inventario", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else if (tipoOrdenVenta == "O" && lvwInventario.CheckedItems.Count > 1) { MessageBox.Show("Solo se puede seleccionar una bodega de la cual se va a tomar el inventario", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { long idBodega = (tipoOrdenVenta == "O" ? Convert.ToInt64(lvwInventario.CheckedItems[0].Tag) : 0); codigoProducto = precioSeleccionado.codigoProducto; bodega = (from B in _dbCosolemEntities.tbBodega where B.idBodega == idBodega select B).FirstOrDefault(); this.DialogResult = System.Windows.Forms.DialogResult.OK; } }
public OrdenDeCompra(CodigoOrdenDeCompra codigo, Proveedor proveedor, AsistenciaTecnica asistenciaTecnica, Componente componente, Precio precio) : base(codigo) { Proveedor = proveedor; AsistenciaTecnica = asistenciaTecnica; Componente = componente; Precio = precio; }
private void bGuardar_Click(object sender, EventArgs e) { if (Precio.Value.ToString() == "0.00") { MessageBox.Show("El precio no Puede ser Cero", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Precio.Focus(); return; } string FechaHora = Fecha.Text + " " + Hora.Value.ToString().Substring(Hora.Value.ToString().IndexOf(" "), Hora.Value.ToString().Length - Hora.Value.ToString().IndexOf(" ")); dtPrecios = C.SQL("ARTICULOSPRECIOS_M " + vOpt + C.QII + PrecioID + C.QII + vArticuloID + C.QII + Precio.Value + C.QII + 1 + C.QIS + FechaHora.Replace("p.m.", "PM").Replace("a.m.", "AM") + C.QSI + C.vUserID); if (dtPrecios.Rows[0]["R"].ToString() == "0") { GRD.DataSource = dtPrecios; bNuevo_Click(null, null); MessageBox.Show("Guardado Con Exito", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { GRD.DataSource = C.SQL("ARTICULOSPRECIOS_L " + vArticuloID); MessageBox.Show(dtPrecios.Rows[0]["msgbox"].ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Valor")] Precio precio) { if (id != precio.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(precio); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PrecioExists(precio.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(precio)); }
protected void GuardarPrincipiante(object sender, EventArgs e) { Resultado resultado = new Resultado(); Precio preG = new Precio(); try { preG.PrecioD = Convert.ToDouble(txtCostoPrincipiante.Text); preG.Descripcion = txtDscPrincipiante.Text; preG.Tipo = "PRINCIPIANTE"; preG.IdEscuela = usu.IdEscuela; preG.Tag = "INSER_ACTUA"; resultado = new PrecioLogica().Acciones(preG); if (resultado.TipoResultado == "OK") { ObtenerListado(); string script = "swal('Excelente', 'Éxito en la insersión', 'success'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); } else { string script = "swal('Lo sentimos, ha ocurrido un error', '" + resultado.Mensaje + "', 'error'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); } } catch (Exception ex) { string script = "swal('Error', 'Lo sentimos por lo sucedido', 'error'); "; ScriptManager.RegisterStartupScript(this, typeof(Page), "alerta", script, true); } }
public string ToFixedSizeString() { return($"{string.Format("{0,-25}", Nombre)}~" + $"{string.Format("{0,-25}", Sabor)}~" + $"{Volumen.ToString("0000000000;-0000000000")}~" + $"{Precio.ToString("0000000000;-0000000000")}~" + $"{string.Format("{0,-25}", CasaProductora)}"); }
public FormPrecioDetalle(Precio currentPrecio, Decimal precioCompra, int idProducto) { InitializeComponent(); this.currentPrecio = currentPrecio; this.precioCompra = precioCompra; this.currentidProducto = idProducto; this.reLoad(); }
public ActionResult ConfirmarEliminar(int id) { Precio Precio = db.Precios.Find(id); db.Precios.Remove(Precio); db.SaveChanges(); return(RedirectToAction("Index")); }
public Precio Agregar(Precio precio) { Precio result = default(Precio); var precioDAC = new PrecioDAC(); result = precioDAC.Create(precio); return(result); }
public ActionResult DeleteConfirmed(int id) { Precio precio = db.Precios.Find(id); db.Precios.Remove(precio); db.SaveChanges(); return(RedirectToAction("Index")); }
public Precio BuscarPorId(int id) { Precio result = default(Precio); var precioDAC = new PrecioDAC(); result = precioDAC.ReadBy(id); return(result); }
private void limpiar() { IdProducto.Clear(); NProducto.Clear(); Precio.Clear(); IdProducto.Focus(); IdProducto.Enabled = true; }
public Precio GetByID(int ID) { Precio result = default(Precio); var PrecioDAC = new PrecioDAC(); result = PrecioDAC.ReadBy(ID); return(result); }
public Precio Details(int Id) { Precio result = default(Precio); var precioDAC = new PrecioDAC(); result = precioDAC.ReadBy(Id); return(result); }
public Precio Editar(Precio precio) { Precio result = default(Precio); var precioDAC = new PrecioDAC(); precioDAC.Update(precio); result = precio; return(result); }
public Linea RegistrarLinea(Linea l) { using (uruguay_busEntities db = new uruguay_busEntities()) { try { // convertir linea // convertir tramos y asociarlos a la linea // para cada tramo obtener la parada desde la DB y asociarlo // para cada tramo convertir y asociar el precio linea lin = LineaConverter.convert(l); foreach (var t in l.tramos) { tramo tra = TramoConverter.convert(t); lin.tramo.Add(tra); parada par = db.parada.Find(t.parada.id); if (par == null) { throw new Exception("No se encontro ninguna parada con ese ID"); } tra.parada = par; tra.precio.Add(PrecioConverter.convert(t.precio.First())); } // guardo la linea, sus tramos y sus precios (las paradas no, esas ya estaban en a DB) db.linea.Add(lin); //foreach (var tra in lin.tramo) //{ // db.tramo.Add(tra); // db.precio.Add(tra.precio.First()); //} db.SaveChanges(); // Hago las conversiones inversas y las asociaciones l = LineaConverter.convert(lin); foreach (var tra in lin.tramo) { Tramo t = TramoConverter.convert(tra); l.tramos.Add(t); t.parada = ParadaConverter.convert(tra.parada); precio pre = db.precio.FirstOrDefault(x => x.linea_id == l.id && x.parada_id == t.parada.id); Precio p = PrecioConverter.convert(pre); t.precio.Add(p); } return(l); } catch (Exception e) { throw e; } } }
public bool Equals(Precio p) { // If parameter is null return false: if (p == null) { return false; } // Return true if the fields match: return (Moneda == p.Moneda) && (Valor == p.Valor); }