public ActionResult DeleteConfirmed(int id) { cotizacion cotizacion = db.cotizacion.Find(id); db.cotizacion.Remove(cotizacion); db.SaveChanges(); return(RedirectToAction("Index")); }
public HttpResponseMessage cotizacionItem(cotizacion valores) { var endpoint = "http://coposoftware.org:8090/itemcotizacion/create"; var client = new HttpClient(); var response = client.PostAsJsonAsync(endpoint, valores).Result; return(response); }
// GET: /Cotizacion/Details/5 public ActionResult Details(int id = 0) { cotizacion cotizacion = db.cotizacion.Find(id); if (cotizacion == null) { return(HttpNotFound()); } return(View(cotizacion)); }
public ActionResult Edit(cotizacion cotizacion) { if (ModelState.IsValid) { db.Entry(cotizacion).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.idTipoTransporte = new SelectList(db.transporte, "idTransporte", "nombre", cotizacion.idTipoTransporte); ViewBag.idUusario = new SelectList(db.usuario, "idUsuario", "nombre", cotizacion.idUusario); return(View(cotizacion)); }
// // GET: /Cotizacion/Edit/5 public ActionResult Edit(int id = 0) { cotizacion cotizacion = db.cotizacion.Find(id); if (cotizacion == null) { return(HttpNotFound()); } ViewBag.idTipoTransporte = new SelectList(db.transporte, "idTransporte", "nombre", cotizacion.idTipoTransporte); ViewBag.idUusario = new SelectList(db.usuario, "idUsuario", "nombre", cotizacion.idUusario); return(View(cotizacion)); }
public int guardarPresupuesto(PresupuestoEntity entidad) { int idResultado = 0; using (var contexto = new ContextoBdSantiago()) { var cot = new cotizacion { Obra = entidad.Obra, DuracionTrabajo = entidad.DuracionTrabajo, DescripcionDetalle = entidad.DetalleDescrip, FechaCalculo = entidad.FechaCalculo, FechaEmision = entidad.FechaEmision, HorasParejas = entidad.HorasParejas, Ascensor = entidad.Ascensor, CantidadFletes = entidad.CantidadFletes, PresupuestoNumero = entidad.PresupuestoNumero, RecargoHHEE = entidad.RecargoHHEE, SubTotal = entidad.Subtotal, SubTotalManoObra = entidad.SubtotalManoObra, Supervisor = entidad.Supervisor, TecnicoEmisor = entidad.TecEmisor, Total = entidad.Total, TotalFletes = entidad.TotalFletes, TotalNetoComisiones = entidad.TotalnetoComisiones, ValorFlete = entidad.ValorFlete, ValorFletes = entidad.ValorFletes, ValorHH = entidad.ValorHH, ValorHP = entidad.ValorHP, ValorManoObra = entidad.ValorManoObra, ValorMargenVenta = entidad.ValorMargenVenta, ValorMoneda = entidad.ValorMoneda, ValorRepuestos = entidad.ValorRepuestos, ValorTerceros = entidad.ValorTerceros, ValorUf = entidad.ValorUf, ValorVenta = entidad.ValorVenta }; contexto.Cotizacion.Add(cot); contexto.SaveChanges(); //retornamos el id del objeto, validar que entregue el identity idResultado = cot.PK_Cotizacion_ID; } return(idResultado); }
public IActionResult creaCotiza(cotizacion cotizac) { servsbs = new servicesSbs(); var response = servsbs.createCotizacion(cotizac); var json = response.Content.ReadAsStringAsync(); if (!response.IsSuccessStatusCode) { Console.WriteLine("Se presento un Error"); return(BadRequest(json.Result)); } else { Console.WriteLine("Success"); return(Ok(1)); } }
public ActionResult guardaCotizacion(int cliente, string total, List <ListaProductosDTO> productos) { var entity = new cotizacion(); var user = UsuarioDAO.GetUserLogged(db); try { entity.ID_CLIENTE = cliente; entity.ID_TIENDA = user.empleado.tienda.FirstOrDefault().ID; entity.ID_VENDEDOR = user.empleado.ID; entity.FECHA_COTIZACION = DateTime.Now; entity.TOTAL = ExtensionMethods.ConverToDecimalFormat(total); entity.VIGENCIA = DateTime.Now.AddDays(15); entity.ID_CANAL_VENTA = 1; entity.cotizacion_producto = new List <cotizacion_producto>(); foreach (ListaProductosDTO prod in productos) { var p = new cotizacion_producto(); decimal precio = ExtensionMethods.ConverToDecimalFormat(prod.precio); float descuento = (float)ExtensionMethods.ConverToDecimalFormat(prod.descuento); p.ID_PRODUCTO = prod.idProducto; p.CODIGO = prod.codigoConfig; p.CANTIDAD = prod.cantidad; p.PRECIO = precio; p.DESCUENTO_UNITARIO = descuento; p.IMPORTE = prod.cantidad * (precio - (precio * (decimal)descuento / 100)); p.ORIGEN_DEL_PRODUCTO = prod.origen; p.ID_ORIGEN_DEL_PRODUCTO = prod.idByOrigen; entity.cotizacion_producto.Add(p); } db.cotizacion.Add(entity); db.SaveChanges(); } catch (Exception e) { } return(RedirectToAction("GetcotizacionByid", new { id = entity.ID })); }
public HttpResponseMessage createCotizacion(cotizacion value) { creaCotizacion p = new creaCotizacion { cotizacion_fecha = value.cotizacion_fecha, id_cliente = value.id_cliente }; var endpoint = "http://coposoftware.org:8090" + "/cotizacion/create"; var client = new HttpClient(); var response = client.PostAsJsonAsync(endpoint, p).Result; var json = response.Content.ReadAsAsync(typeof(creaCotizacion)).Result; creaCotizacion responsecotizacion = new creaCotizacion(); responsecotizacion = (creaCotizacion)json; int idCotizacion = responsecotizacion.id_cotizacion; value.id_cotizacion = idCotizacion; var respuesta = cotizacionItem(value); client.Dispose(); return(respuesta); }