public static void CargarPlanDetalle(List <mdlCuadroAmortizacion> _PlanDePago, int NroDePlan) { using (var context = new lts_sindicatoDataContext()) { foreach (var item in _PlanDePago) { PlanDetalle InsertPlanDetalle = new PlanDetalle(); InsertPlanDetalle.NroPlanDePago = NroDePlan; InsertPlanDetalle.Cuota = item.Cuota == "Anticipo" ? 0 : Convert.ToInt32(item.Cuota); //fila.Cells["CuotaDelPlan"].Value.ToString() == "Anticipo" ? 0 : Convert.ToInt32(fila.Cells["CuotaDelPlan"].Value); InsertPlanDetalle.ImporteCuota = (decimal)item.ImporteDeCuota; //Convert.ToDecimal(fila.Cells["ImporteDeCuota"].Value); InsertPlanDetalle.Interes = (decimal)item.Interes; //Convert.ToDecimal(fila.Cells["InteresDeCuota"].Value); InsertPlanDetalle.Amortizado = (decimal)item.Amortizado; //Convert.ToDecimal(fila.Cells["Amortizado"].Value); InsertPlanDetalle.AAmortizar = (decimal)item.AAmortizar; //Convert.ToDecimal(fila.Cells["AAmortizar"].Value); InsertPlanDetalle.FechaVenc = item.FechaDeVenc; // Convert.ToDateTime(fila.Cells["FechaDeVencimiento"].Value); InsertPlanDetalle.Estado = 1; InsertPlanDetalle.InteresResarcitorio = 0; InsertPlanDetalle.DiasDeMora = 0; InsertPlanDetalle.ImporteCobrado = 0; InsertPlanDetalle.Cancelado = "0"; context.PlanDetalle.InsertOnSubmit(InsertPlanDetalle); context.SubmitChanges(); } } }
public async Task <IActionResult> PutPlanDetalle(int id, PlanDetalle planDetalle) { if (id != planDetalle.PlanDetalleId) { return(BadRequest()); } _context.Entry(planDetalle).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PlanDetalleExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <PlanDetalle> > PostPlanDetalle(PlanDetalle planDetalle) { _context.PlanDetalle.Add(planDetalle); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPlanDetalle", new { id = planDetalle.PlanDetalleId }, planDetalle)); }
private void CargarPlanDetalle(DataGridView dgv, int NroDePlan) { foreach (DataGridViewRow fila in dgv.Rows) { using (var context = new lts_sindicatoDataContext()) { PlanDetalle InsertPlanDetalle = new PlanDetalle(); InsertPlanDetalle.NroPlanDePago = NroDePlan; InsertPlanDetalle.Cuota = fila.Cells["CuotaDelPlan"].Value.ToString() == "Anticipo" ? 0 : Convert.ToInt32(fila.Cells["CuotaDelPlan"].Value); InsertPlanDetalle.ImporteCuota = Convert.ToDecimal(fila.Cells["ImporteDeCuota"].Value); InsertPlanDetalle.Interes = Convert.ToDecimal(fila.Cells["InteresDeCuota"].Value); InsertPlanDetalle.Amortizado = Convert.ToDecimal(fila.Cells["Amortizado"].Value); InsertPlanDetalle.AAmortizar = Convert.ToDecimal(fila.Cells["AAmortizar"].Value); InsertPlanDetalle.FechaVenc = Convert.ToDateTime(fila.Cells["FechaDeVencimiento"].Value); InsertPlanDetalle.Estado = 1; InsertPlanDetalle.DiasDeMora = 0; InsertPlanDetalle.ImporteCobrado = 0; context.PlanDetalle.InsertOnSubmit(InsertPlanDetalle); context.SubmitChanges(); } } }