Пример #1
0
        public JsonResult GetPlan()
        {
            ModalidadPagoBL            modalidadPagoBL      = new ModalidadPagoBL();
            GetModalidadPagoRequestDTO modalidadPagoRequest = new GetModalidadPagoRequestDTO();

            GetModalidadPagoResponseDTO modalidadPagoResponse = new GetModalidadPagoResponseDTO();

            modalidadPagoResponse = modalidadPagoBL.GetModalidadPago(modalidadPagoRequest);

            List <CatModalidadPago> listaModalidadPago = new List <CatModalidadPago>();

            if (modalidadPagoResponse.Mensaje == "OK")
            {
                listaModalidadPago = modalidadPagoResponse.ListaModalidadPago;
            }

            PlanBL            planBL      = new PlanBL();
            GetPlanRequestDTO planRequest = new GetPlanRequestDTO();

            GetPlanResponseDTO planResponse = new GetPlanResponseDTO();

            planResponse = planBL.GetPlan(planRequest);

            List <CatPlan> listaPlan = new List <CatPlan>();

            if (planResponse.Mensaje == "OK")
            {
                listaPlan = planResponse.ListaEmpresa;
            }

            List <CatPlan> listaPlanActual = new List <CatPlan>();

            listaPlanActual = (from plan in listaPlan
                               join modalidadPago in listaModalidadPago on plan.idModalidadPago equals modalidadPago.idModalidadPago
                               select new CatPlan
            {
                idPlan = plan.idPlan,
                plan = plan.plan,
                descripcion = plan.descripcion,
                idModalidadPago = plan.idModalidadPago,
                modalidadPago = modalidadPago.modalidadPago,
                fechaInsert = plan.fechaInsert,
                usuarioInsert = plan.usuarioInsert,
                fechaUpdate = plan.fechaUpdate,
                usuarioUpdate = plan.usuarioUpdate
            }).ToList();

            PlanModalidadPago planModalidadPago = new PlanModalidadPago();

            planModalidadPago.ListaPlan          = listaPlanActual;
            planModalidadPago.ListaModalidadPago = listaModalidadPago;

            return(Json(planModalidadPago, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
        public GetPlanResponseDTO GetPlan(GetPlanRequestDTO planRequest)
        {
            GetPlanResponseDTO empresaResponse = new GetPlanResponseDTO();
            List <CatPlan>     listaEmpresa    = new List <CatPlan>();

            PlanDal   planDal = new PlanDal();
            DataTable dtDatos = new DataTable();

            try
            {
                dtDatos = planDal.GetPlan(planRequest.IdPlan, planRequest.Plan);

                listaEmpresa = dtDatos.AsEnumerable()
                               .Select(row => new CatPlan
                {
                    idPlan          = row.Field <int?>("idPlan").GetValueOrDefault(),
                    plan            = string.IsNullOrEmpty(row.Field <string>("plan")) ? "" : row.Field <string>("plan"),
                    descripcion     = string.IsNullOrEmpty(row.Field <string>("descripcion")) ? "" : row.Field <string>("descripcion"),
                    idModalidadPago = row.Field <int?>("idModalidadPago").GetValueOrDefault(),
                    usuarioInsert   = string.IsNullOrEmpty(row.Field <string>("usuarioInsert")) ? "" : row.Field <string>("usuarioInsert"),
                    fechaInsert     = row.Field <DateTime?>("fechaInsert").GetValueOrDefault(),
                    usuarioUpdate   = string.IsNullOrEmpty(row.Field <string>("usuarioUpdate")) ? "" : row.Field <string>("usuarioUpdate"),
                    fechaUpdate     = row.Field <DateTime?>("fechaUpdate").GetValueOrDefault(),
                }).ToList();

                empresaResponse.ListaEmpresa = listaEmpresa;
                empresaResponse.Mensaje      = "OK";
            }
            catch (Exception ex)
            {
                empresaResponse.ListaEmpresa = new List <CatPlan>();
                empresaResponse.Mensaje      = "ERROR: " + ex.Message;
            }

            return(empresaResponse);
        }