示例#1
0
 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();
         }
     }
 }
示例#2
0
 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();
         }
     }
 }
示例#3
0
 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();
         }
     }
 }
示例#4
0
 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();
         }
     }
 }