public IActionResult Index(DateTime fecha1, DateTime fecha2) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_venta_ = new Ecom_venta(); Ecom_venta_.Incio = fecha1; Ecom_venta_.Final = fecha2; Ecom_Abono Ecom_Abono_list = (Ecom_Abono)EcomData_.GetObject(DataModel.Abono); Ecom_Inversiones Ecom_Inversiones_list = (Ecom_Inversiones)EcomData_.GetObject(DataModel.Inversioniones); Ecom_venta_.Ecom_Abono_ = Ecom_Abono_list.Get(fecha1, fecha2); Ecom_venta_.Ecom_Inversiones_ = Ecom_Inversiones_list.Get(fecha1, fecha2); return(View(Ecom_venta_)); } catch (Ecom_Exception ex) { return(View("../ErrorPages/Error", new { id = ex.Message })); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Create([FromBody] Ecom_Abono Ecom_Abono_) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Abono_ = (Ecom_Abono)EcomData_.SetObjectConnection(Ecom_Abono_, DataModel.Abono); if (Ecom_Abono_.Cliente == 0) { throw new Ecom_Exception("Por favor selecciona Cliente"); } bool result = Ecom_Abono_.Add(); if (result) { return(Ok(EcomData_.GetLastMessage())); } else { return(BadRequest(EcomData_.GetLastMessage())); } } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Delete(int id) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Abono_ = (Ecom_Abono)EcomData_.GetObject(DataModel.Abono); Ecom_Abono_.Id = id; bool result = Ecom_Abono_.Delete(); if (result) { return(Ok(EcomData_.GetLastMessage())); } else { return(BadRequest(EcomData_.GetLastMessage())); } } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult ConcelarVenta([FromBody] Ecom_Producto Ecom_Producto_) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Producto_ = (Ecom_Producto)EcomData_.SetObjectConnection(Ecom_Producto_, DataModel.Producto); bool result = Ecom_Producto_.Update(7); if (result) { return(Ok(EcomData_.GetLastMessage())); } else { return(BadRequest(EcomData_.GetLastMessage())); } } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Recuperar([FromBody] Ecom_Inversiones Ecom_Inversiones_) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Inversiones_ = (Ecom_Inversiones)EcomData_.SetObjectConnection(Ecom_Inversiones_, DataModel.Inversioniones); bool result = Ecom_Inversiones_.Update(3); if (result) { return(Ok(EcomData_.GetLastMessage())); } else { return(BadRequest(EcomData_.GetLastMessage())); } } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Cotizar([FromBody] Ecom_Producto Ecom_Producto_) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Producto_ = (Ecom_Producto)EcomData_.SetObjectConnection(Ecom_Producto_, DataModel.Producto); if (Ecom_Producto_.Cliente == 0) { throw new Ecom_Exception("Por favor selecciona un cliente para la venta"); } bool result = Ecom_Producto_.Update(5); if (result) { return(Ok(EcomData_.GetLastMessage())); } else { return(BadRequest(EcomData_.GetLastMessage())); } } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Details(int id) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Producto_ = (Ecom_Producto)EcomData_.GetObject(DataModel.Cliente); bool result = Ecom_Producto_.Get(id); if (result) { return(Ok(Ecom_Producto_)); } else { return(BadRequest(Ecom_Producto_)); } } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
// GET: TipoProducto/Details/5 public ActionResult Details(int id) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Pedido_ = (Ecom_Pedido)EcomData_.GetObject(DataModel.Pedido); bool result = Ecom_Pedido_.Get(id); if (result) { return(View(Ecom_Pedido_)); } else { throw new Ecom_Exception(EcomData_.GetLastMessage()); } } catch (Ecom_Exception ex) { return(View("../ErrorPages/Error", new { id = ex.Message })); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Delete(int id, IFormCollection collection) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Pedido_ = (Ecom_Pedido)EcomData_.GetObject(DataModel.Pedido); Ecom_Pedido_.Id = id; bool result = Ecom_Pedido_.Delete(); if (result) { return(RedirectToAction(nameof(Index))); } else { throw new Ecom_Exception(EcomData_.GetLastMessage()); } } catch (Ecom_Exception ex) { return(View("../ErrorPages/Error", new { id = ex.Message })); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Delete(int id, IFormCollection collection) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_PedidoAjuste_ = (Ecom_PedidoAjuste)EcomData_.GetObject(DataModel.PedidoAjuste); Ecom_PedidoAjuste_.Id = id; bool result2 = Ecom_PedidoAjuste_.Get(id); int perdido = Ecom_PedidoAjuste_.Pedido; bool result = Ecom_PedidoAjuste_.Delete(); if (result) { return(RedirectToAction("Details", "Pedido", new { Id = perdido })); } else { throw new Ecom_Exception(EcomData_.GetLastMessage()); } } catch (Ecom_Exception ex) { return(View("../ErrorPages/Error", new { id = ex.Message })); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult GetRange(DateTime fecha1, DateTime fecha2) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Abono_ = (Ecom_Abono)EcomData_.GetObject(DataModel.Abono); List <Ecom_Abono> result = Ecom_Abono_.Get(fecha1, fecha2); return(Ok(result)); } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult GetSinComprar(int id) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Producto_ = (Ecom_Producto)EcomData_.GetObject(DataModel.Producto); List <Ecom_Producto> result = Ecom_Producto_.GetByPedido(id); return(Ok(result.Where(item => item.Estatus == 1 || item.PrecioCompra == 0).ToList())); } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Index(int id) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Producto_ = (Ecom_Producto)EcomData_.GetObject(DataModel.Producto); List <Ecom_Producto> result = Ecom_Producto_.GetByPedido(id); return(Ok(result)); } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
// GET: TipoProducto public ActionResult Index() { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Pedido_ = (Ecom_Pedido)EcomData_.GetObject(DataModel.Pedido); List <Ecom_Pedido> result = Ecom_Pedido_.Get(); return(View(result)); } catch (Ecom_Exception ex) { return(View("../ErrorPages/Error", new { id = ex.Message })); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult GetInversionista(int id) { EcomData_ = new EcomData(StringConnectio); try { EcomData_.Connect(); Ecom_Inversiones_ = (Ecom_Inversiones)EcomData_.GetObject(DataModel.Inversioniones); List <Ecom_Inversiones> result = Ecom_Inversiones_.GetByClienteInversionista(id); return(Ok(result)); } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Create(Ecom_Pedido Ecom_Pedido_) { //return RedirectToAction(nameof(Index)); EcomData_ = new EcomData(StringConnectio); try { if (!ModelState.IsValid) { return(View(Ecom_Pedido_)); } else { EcomData_.Connect(); Ecom_Pedido_ = (Ecom_Pedido)EcomData_.SetObjectConnection(Ecom_Pedido_, DataModel.Pedido); bool result = Ecom_Pedido_.Add(); if (result) { return(RedirectToAction(nameof(Index))); } else { throw new Ecom_Exception(EcomData_.GetLastMessage()); } } } catch (Ecom_Exception ex) { ModelState.AddModelError(string.Empty, string.Format("{0}", ex.Message)); return(View(Ecom_Pedido_)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Create([FromBody] Ecom_Cliente Ecom_Cliente_) { //return RedirectToAction(nameof(Index)); EcomData_ = new EcomData(StringConnectio); try { if (!ModelState.IsValid) { throw new Ecom_Exception("Campos no validos"); } else { EcomData_.Connect(); Ecom_Cliente_ = (Ecom_Cliente)EcomData_.SetObjectConnection(Ecom_Cliente_, DataModel.Cliente); bool result = Ecom_Cliente_.Add(); if (result) { return(Ok(EcomData_.GetLastMessage())); } else { throw new Ecom_Exception(EcomData_.GetLastMessage()); } } } catch (Ecom_Exception ex) { return(BadRequest(ex.Message)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }
public ActionResult Edit(Ecom_PedidoAjuste Ecom_PedidoAjuste_) { EcomData_ = new EcomData(StringConnectio); try { if (!ModelState.IsValid) { return(View(Ecom_PedidoAjuste_)); } else { EcomData_.Connect(); Ecom_PedidoAjuste_ = (Ecom_PedidoAjuste)EcomData_.SetObjectConnection(Ecom_PedidoAjuste_, DataModel.PedidoAjuste); bool result = Ecom_PedidoAjuste_.Update(); if (result) { return(RedirectToAction("Details", "Pedido", new { Id = Ecom_PedidoAjuste_.Pedido })); } else { throw new Ecom_Exception(EcomData_.GetLastMessage()); } } } catch (Ecom_Exception ex) { ModelState.AddModelError(string.Empty, string.Format("{0}", ex.Message)); return(View(Ecom_PedidoAjuste_)); } finally { if (EcomData_ != null) { EcomData_.Disconnect(); } } }