//TERMINA PROCESO DE CARGAR LISTA DE ESTADOS //Get datos de pago a prestamo public List <GetDatosPagoPrestamo> PagoPrestamo(int id) { List <GetDatosPagoPrestamo> EstadosList = new List <GetDatosPagoPrestamo>(); try { SqlCommand cmd = CrearComando("SF_SP_GetDatosPagoPrestamo"); //Pasamos el procedimiento almacenado. cmd.Parameters.AddWithValue("@CodPrest", id); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); AbrirConexion(); da.Fill(dt); CerrarConexion(); EstadosList = (from DataRow dr in dt.Rows select new GetDatosPagoPrestamo() { Prestamo = Convert.ToInt32(dr["Codigo_Prestamo"]), Capital = Convert.ToString(dr["Capital"]), Intereses = Convert.ToString(dr["Intereses"]), Mora = Convert.ToString(dr["Mora"]), //Total = Convert.ToDecimal(dr["Total"]), Saldo = Convert.ToDecimal(dr["Saldo"]), Accion = 1, Mensaje = "Se cargaron correctamente los datos del pago de prestamo" }).ToList(); if (EstadosList.Count == 0) { GetDatosPagoPrestamo ss = new GetDatosPagoPrestamo(); ss.Accion = 0; ss.Mensaje = "No se pudo calcular información sobre pago del prestamo!"; EstadosList.Add(ss); } } catch (Exception ex) { GetDatosPagoPrestamo oSucursal = new GetDatosPagoPrestamo(); oSucursal.Accion = 0; oSucursal.Mensaje = ex.Message.ToString(); EstadosList.Add(oSucursal); throw new Exception("Error Obteniendo todos los registros " + ex.Message, ex); } return(EstadosList); }
public JsonResult GetDatosPagoPrestamo(int id) { CajaRepository SucRep = new CajaRepository(); try { return Json(SucRep.PagoPrestamo(id), JsonRequestBehavior.AllowGet); } catch (Exception ex) { //throw; List<GetDatosPagoPrestamo> list = new List<GetDatosPagoPrestamo>(); GetDatosPagoPrestamo obj = new GetDatosPagoPrestamo(); obj.Accion = 0; obj.Mensaje = ex.Message.ToString(); list.Add(obj); return Json(list, JsonRequestBehavior.AllowGet); } }
public JsonResult PagoPrestamo(int codigo, string Capital, string Intereses, string Mora, int TipoPago, string Observacion) { CajaRepository CitaRep = new CajaRepository(); var Cajero = (string)(Session["usuario"]); try { return Json(CitaRep.PagoPrestamo(codigo, Capital, Intereses, Mora, TipoPago, Cajero, Observacion), JsonRequestBehavior.AllowGet); } catch (Exception ex) { //throw; List<GetDatosPagoPrestamo> list = new List<GetDatosPagoPrestamo>(); GetDatosPagoPrestamo obj = new GetDatosPagoPrestamo(); obj.Accion = 0; obj.Mensaje = ex.Message.ToString(); list.Add(obj); return Json(list, JsonRequestBehavior.AllowGet); } }