コード例 #1
0
        internal static void ApiSolicitudEndConsul(InsertPersonasWeb insertPersonasWeb, ref DTO_SOLICITUD_VENTAS persona)
        {
            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 insertPersonasWeb.GetType().GetProperties()
                                       where nodo.GetValue(insertPersonasWeb) != null
                                       select new SpParameter
            {
                Name  = nodo.Name,
                Value = nodo.GetValue(insertPersonasWeb).ToString()
            }
                                       );
            dto.Result = null;
            dto.SPName = "usp_ValidarPIN";

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

            try
            {
                var obj = DynamicSqlDAO.ExecuterSp(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value);

                var dto_result = new List <DTO_SOLICITUD_VENTAS>();
                if (obj.HasResult)
                {
                    dto_result = JsonConvert.DeserializeObject <List <DTO_SOLICITUD_VENTAS> >(JsonConvert.SerializeObject(obj.Result.Tables[0]));
                }


                persona = dto_result.ToList().FirstOrDefault();
                if (persona != null)
                {
                    persona.Status = dto_result.Any() ? dto_result.ToList().FirstOrDefault().Status : null;
                }
                else
                {
                    persona = new DTO_SOLICITUD_VENTAS();
                }
            }
            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);
            }
        }
コード例 #2
0
        private static bool ConsultaUltimoIngresoSolicitud(InsertPersonasWeb persona)
        {
            string xClase   = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name);
            string xProceso = MethodBase.GetCurrentMethod().Name;

            var dto_excepcion = new UTL_TRA_EXCEPCION
            {
                STR_CLASE      = xClase,
                STR_EVENTO     = xProceso,
                STR_PARAMETROS = JsonConvert.SerializeObject(persona),
                STR_APLICATIVO = ConfigurationManager.AppSettings["Aplicativo"],
                STR_SERVIDOR   = System.Net.Dns.GetHostName()
            };
            var dto = new DynamicDto();

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

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


            try
            {
                var obj = DynamicSqlDAO.ExecuterSp <InsertPersonasWeb>(dto, GlobalClass.connectionString.Where(a => a.Key == infDto.STR_COD_PAIS).FirstOrDefault().Value);
                return(obj.Any());
            }
            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(false);
        }