Пример #1
0
        internal static List <PlazoCredito> TraePlazoCalcu(PlazoCredito plazoCredito)
        {
            string xClase   = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name);
            string xProceso = MethodBase.GetCurrentMethod().Name;
            var    dto      = new DynamicDto();

            dto.ParameterList = new List <SpParameter>();

            dto.ParameterList.AddRange(from nodo in plazoCredito.GetType().GetProperties()
                                       where nodo.GetValue(plazoCredito) != null
                                       select new SpParameter
            {
                Name  = nodo.Name,
                Value = nodo.GetValue(plazoCredito).ToString()
            }
                                       );
            dto.Result = null;
            dto.SPName = "usp_TraePlazoCredito";

            var dto_excepcion = new UTL_TRA_EXCEPCION
            {
                STR_CLASE      = xClase,
                STR_EVENTO     = xProceso,
                STR_PARAMETROS = JsonConvert.SerializeObject(plazoCredito),
                STR_APLICATIVO = ConfigurationManager.AppSettings["Aplicativo"],
                STR_SERVIDOR   = System.Net.Dns.GetHostName()
            };
            var dto_obj = new List <PlazoCredito>();

            try
            {
                var obj = DynamicSqlDAO.ExecuterSp <PlazoCredito>(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value);
                dto_obj = obj.ToList();
            }
            catch (Exception ex)
            {
                dto_excepcion.STR_MENSAJE = ex.Message;
                dto_excepcion.STR_DETALLE = ex.StackTrace;
                TwoFunTwoMe_DataAccess.Utility.guardaExcepcion(dto_excepcion, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value);
            }
            return(dto_obj);
        }