Beispiel #1
0
 public RespuestaModel Agregar(Tbl_Usuarios modelo)
 {
     try
     {
         _respuesta = new RespuestaModel();
         List <string> mensajes;
         if (!ExisteDB(modelo, true, out mensajes))
         {
             _respuesta.ejecucion = false;
             _respuesta.mensaje   = mensajes;
             return(_respuesta);
         }
         using (var conex = new DatabaseViviendaEntities())
         {
             conex.Tbl_Usuarios.Add(modelo);
             conex.SaveChanges();
         }
     }
     catch
     {
         _respuesta.ejecucion = false;
         _respuesta.mensaje.Add(Resources.Mensajes.MensajeError);
     }
     return(_respuesta);
 }
Beispiel #2
0
        public ActionResult Post(bool IsNew, RespuestaModel varRespuesta)
        {
            try
            {
                //if (ModelState.IsValid)
                //{
                if (!_tokenManager.GenerateToken())
                {
                    return(Json(null, JsonRequestBehavior.AllowGet));
                }
                _IRespuestaApiConsumer.SetAuthHeader(_tokenManager.Token);



                var result        = "";
                var RespuestaInfo = new Respuesta
                {
                    Clave         = varRespuesta.Clave
                    , Descripcion = varRespuesta.Descripcion
                };

                result = !IsNew?
                         _IRespuestaApiConsumer.Update(RespuestaInfo, null, null).Resource.ToString() :
                             _IRespuestaApiConsumer.Insert(RespuestaInfo, null, null).Resource.ToString();

                Session["KeyValueInserted"] = result;
                return(Json(result, JsonRequestBehavior.AllowGet));
                //}
                //return Json(false, JsonRequestBehavior.AllowGet);
            }
            catch (ServiceException ex)
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }
Beispiel #3
0
 public RespuestaModel Agregar(TBL_CONTRATOS modelo)
 {
     _respuesta = new RespuestaModel();
     try
     {
         //if (ExisteDB(model.Condominio))
         //{
         //    _respuesta.ejecucion = false;
         //    _respuesta.mensaje.Add(Resources.Mensajes.MensajeDuplicado);
         //    return _respuesta;
         //}
         using (var conex = new DatabaseViviendaEntities())
         {
             modelo.Activo = true;
             conex.TBL_CONTRATOS.Add(modelo);
             conex.SaveChanges();
             _respuesta.datos = modelo.Id_Contrato;
         }
         _respuesta.ejecucion = true;
         _respuesta.mensaje.Add(Resources.Mensajes.MensajeCorrecto);
     }
     catch
     {
         _respuesta.ejecucion = false;
         _respuesta.mensaje.Add(Resources.Mensajes.MensajeError);
     }
     return(_respuesta);
 }
Beispiel #4
0
 public RespuestaModel Actualizar(Tbl_Usuarios modelo)
 {
     try
     {
         _respuesta = new RespuestaModel();
         List <string> mensajes;
         if (ExisteDB(modelo, false, out mensajes))
         {
             _respuesta.ejecucion = false;
             _respuesta.mensaje   = mensajes;
             return(_respuesta);
         }
         using (var conex = new DatabaseViviendaEntities())
         {
             var usuario = conex.Tbl_Usuarios.Where(x => x.Id_Usuario.Equals(modelo.Id_Usuario)).FirstOrDefault();
             usuario.Nombre    = modelo.Nombre;
             usuario.ApMaterno = modelo.ApMaterno;
             usuario.ApPaterno = modelo.ApPaterno;
             usuario.Correo    = modelo.Correo;
             usuario.Usuario   = modelo.Usuario;
             conex.SaveChanges();
             _respuesta.ejecucion = true;
             _respuesta.mensaje.Add(Resources.Mensajes.MensajeEditar);
         }
     }
     catch
     {
         _respuesta.ejecucion = false;
         _respuesta.mensaje.Add(Resources.Mensajes.MensajeError);
     }
     return(_respuesta);
 }
        public JsonResult RegistroGirls(string mail, string password)
        {
            var respuesta = new RespuestaModel();

            if (girls.GetExisteEmail(mail, true))
            {
                respuesta.Descripcion = "La direccion de e-mail: " + mail + " ya existe en nuestro sistema";
                return(Json(respuesta));
            }

            var identificador = util.NuevoIdentificador();
            var password64    = util.CodeBase64(mail + "#" + password);
            var modelGirl     = util.SetGirlsModel(mail, password64, identificador);

            modelGirl = girls.InsertGirls(modelGirl);

            var enlaze         = util.ConstruirEnlazeRegistro(mail, identificador);
            var estructuraMail = util.SetEstructuraMailRegister(enlaze, mail);

            sendMail.EnviarMailNotificacion(estructuraMail, hostEnv);

            if (modelGirl.Id > 0)
            {
                respuesta.Descripcion = "Registro satisfactorio, fue enviado un email a tu direccion electronica para la activacion de tu cuenta";
            }
            else
            {
                respuesta.Descripcion = "Registro fallido";
            }

            return(Json(respuesta));
        }
        public JsonResult EditarProducto(string _IdProducto, string _Producto, string _Familia, string _Umedida, string _Precio)
        {
            if (SessionVariables.Session_Datos_Usuarios == null)
            {
                RedirectToAction("SesionExpirada", "Error");
            }

            var validador = 0;

            if (!string.IsNullOrEmpty(_IdProducto) && !string.IsNullOrEmpty(_Producto) && !string.IsNullOrEmpty(_Familia) && !string.IsNullOrEmpty(_Umedida) && !string.IsNullOrEmpty(_Precio))
            {
                ObjetoProducto lproducto = new ObjetoProducto();
                lproducto.IdProducto   = int.Parse(_IdProducto);
                lproducto.Producto     = _Producto;
                lproducto.Familia      = _Familia;
                lproducto.UnidadMedida = _Umedida;
                lproducto.Precio       = double.Parse(_Precio);

                RespuestaModel resultado = Acceso.EditarProducto(lproducto);
                if (resultado.Verificador == true)
                {
                    validador = 1;
                    return(Json(validador));
                }
                else
                {
                    validador = 2;
                    return(Json(validador));
                }
            }
            else
            {
                return(Json(validador));
            }
        }
Beispiel #7
0
        public JsonResult RegistroAdm(string email, string password)
        {
            var respuesta = new RespuestaModel();

            if (userAdm.GetExisteEmail(email, true))
            {
                respuesta.Descripcion = "La direccion de e-mail: " + email + " ya existe en nuestro sistema";
                return(Json(respuesta));
            }

            var password64 = util.CodeBase64(email + "#" + password);
            var adm        = new UserAdm()
            {
                EmailAdm = email, PasswordAdm = password64,
                Activo   = true, Fecha = DateTime.UtcNow, RolAdm = "administrador"
            };

            adm = userAdm.InsertAdm(adm);

            if (adm.Id > 0)
            {
                respuesta.Descripcion = "Registro satisfactorio";
            }
            else
            {
                respuesta.Descripcion = "Registro fallido";
            }

            return(Json(respuesta));
        }
        public JsonResult LoginGirls(string email, string password)
        {
            RespuestaModel respuesta  = new RespuestaModel();
            var            password64 = util.CodeBase64(email + "#" + password);
            var            s          = girls.LoginGirls(email, password64);

            if (s != null)
            {
                if (SetIdentityUser(s))
                {
                    respuesta.Descripcion = "Usuario correctamente logeado";
                    respuesta.Identidad   = s.Identidad.ToString();
                    respuesta.Username    = s.Email;
                }
                else
                {
                    respuesta.Descripcion = "Completa tu perfil,desde el enlaze que recibiste en: " + email;
                }
            }
            else
            {
                respuesta.Descripcion = "Usuario y password no existe";
            }

            return(Json(respuesta));
        }
Beispiel #9
0
        public void Start_Visitas()
        {
            RespuestaModel      res = new RespuestaModel();
            List <string>       filenames;
            bool                existenLeidos;
            List <LogEjecucion> logErrors;

            _eventLog.CrearLog("Inicio del servicio de Ejecuciones");
            try
            {
                Dictionary <string, dynamic> P = new Dictionary <string, dynamic> {
                    { "Opcion", 5 }
                };

                IEnumerable <Configuracion> configActivos = _dao.Consultar <Configuracion>(P);
                if (configActivos.Any())
                {
                    foreach (Configuracion item in configActivos)
                    {
                        if (item.RutaLog.Substring(0, 7).Contains("http://") || item.RutaLog.Substring(0, 8).Contains("https://"))
                        {
                            logErrors = VisitarRuta(item.RutaLog, item.ConfiguracionId, out filenames, out existenLeidos);
                            if (logErrors.Count > 0)
                            {
                                res = RegistrarEjecucion(logErrors, item.SistemaId, item.ConfiguracionId, filenames[filenames.Count - 1]);
                            }
                        }
                        else
                        {
                            logErrors = VisitarDirectorio(item.RutaLog, item.ConfiguracionId, out filenames, out existenLeidos);
                            if (logErrors.Count > 0)
                            {
                                res = RegistrarEjecucion(logErrors, item.SistemaId, item.ConfiguracionId, filenames[filenames.Count - 1]);
                            }
                        }

                        if (res.Satisfactorio && filenames.Count > 0)
                        {
                            if (existenLeidos)
                            {
                                ActualizarArchivosLeidos(3, filenames, logErrors.Count, item.ConfiguracionId, false, out res);
                            }
                            else
                            {
                                RegistrarArchivosLeidos(1, filenames, logErrors.Count, item.ConfiguracionId, false, out res);
                            }
                        }
                        ActualizarVisitaConfiguracion(4, item.ConfiguracionId, 1, false, out m);
                    }
                }
            }
            catch (Exception ex)
            {
                string       InnerExcepcionResult = (ex.InnerException != null ? ex.InnerException?.ToString() : "").Trim();
                string       ErrorResult          = ("Error en el proceso: " + ex.Message + ". " + InnerExcepcionResult).Trim();
                LogExcepcion logEx = GenerarLogExcepcion("Proceso de Ejecuciones", ErrorResult, ErrorResult, "750", InnerExcepcionResult, "Proceso de Ejecuciones");
                m = RegistrarExcepcion(logEx, null);
                _eventLog.CrearLog("Error interno del servicio de ejecuciones. " + ex.Message + ". " + ex.InnerException?.ToString(), System.Diagnostics.EventLogEntryType.Error);
            }
        }
 public Conectores()
 {
     m          = new RespuestaModel();
     _dao       = new ConectorDao();
     _daoConfig = new MonitorConfiguracionDao();
     _eventLog  = new Log("Proceso de Conectores", "Servicio de Monitor de Procesos");
 }
Beispiel #11
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here

                SessionInitialize();
                RespuestaCAD   respuestaCAD = new RespuestaCAD(session);
                RespuestaCEN   respuestaCEN = new RespuestaCEN(respuestaCAD);
                RespuestaEN    respuestaEN  = respuestaCEN.ReadOID(id);
                RespuestaModel respuesta    = RespuestaAssembler.ConvertENToModelUI(respuestaEN);

                TemaModel tem   = new TemaModel();
                TemaEN    temEN = new TemaCAD(session).ReadOIDDefault(respuestaEN.Tema.Id);
                tem = TemaAssembler.ConvertENToModelUI(temEN);

                SessionClose();

                new RespuestaCEN().Destroy(id);



                return(RedirectToRoute(new
                {
                    controller = "Tema",
                    action = "Details",
                    id = tem.Id,
                }));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #12
0
 public RespuestaModel Consultar(CondominioModel model)
 {
     try
     {
         List <CAT_CONDOMINIOS> listado;
         _respuesta = new RespuestaModel();
         using (var conex = new DatabaseViviendaEntities())
         {
             listado = conex.CAT_CONDOMINIOS.ToList();
             if (!String.IsNullOrEmpty(model.Condominio))
             {
                 listado = listado.Where(x => x.Condominio.ToUpper().Contains(model.Condominio.ToUpper())).ToList();
             }
             if (model.Activo == 1)
             {
                 listado = listado.Where(x => x.Activo.Equals(true)).ToList();
             }
             if (model.Activo == 0)
             {
                 listado = listado.Where(x => x.Activo.Equals(false)).ToList();
             }
             _respuesta.ejecucion = true;
             _respuesta.datos     = listado;
         }
     }
     catch
     {
         _respuesta.ejecucion = false;
         _respuesta.mensaje.Add(Resources.Mensajes.MensajeError);
     }
     return(_respuesta);
 }
Beispiel #13
0
 public RespuestaModel Actualizar(CAT_CONDOMINIOS model)
 {
     try
     {
         _respuesta = new RespuestaModel();
         if (ExisteDB(model))
         {
             _respuesta.ejecucion = false;
             _respuesta.mensaje.Add(Resources.Mensajes.MensajeDuplicado);
             return(_respuesta);
         }
         using (var conex = new DatabaseViviendaEntities())
         {
             var condominio = conex.CAT_CONDOMINIOS.Where(x => x.Id_Condominio.Equals(model.Id_Condominio)).FirstOrDefault();
             //condominio = model;
             condominio.Activo     = model.Activo;
             condominio.Clave      = model.Clave;
             condominio.Colonia    = model.Colonia;
             condominio.Condominio = model.Condominio;
             condominio.Cp         = model.Cp;
             condominio.DemMun     = model.DemMun;
             condominio.Id_Estado  = model.Id_Estado;
             conex.SaveChanges();
             _respuesta.ejecucion = true;
             _respuesta.mensaje.Add(Resources.Mensajes.MensajeEditar);
         }
     }
     catch
     {
         _respuesta.ejecucion = false;
         _respuesta.mensaje.Add(Resources.Mensajes.MensajeError);
     }
     return(_respuesta);
 }
Beispiel #14
0
 public RespuestaModel Select()
 {
     try
     {
         List <SelectModel> listadoSelect = new List <SelectModel>();
         _respuesta = new RespuestaModel();
         using (var conex = new DatabaseViviendaEntities())
         {
             var listado = conex.CAT_CONDOMINIOS.Where(x => x.Activo.Equals(true)).ToList();
             foreach (var itemlst in listado)
             {
                 listadoSelect.Add(new SelectModel()
                 {
                     descripcion = itemlst.Condominio, id = itemlst.Id_Condominio
                 });
             }
             _respuesta.ejecucion = true;
             _respuesta.datos     = listadoSelect;
         }
     }
     catch
     {
         _respuesta.ejecucion = false;
         _respuesta.mensaje.Add(Resources.Mensajes.MensajeError);
     }
     return(_respuesta);
 }
Beispiel #15
0
        private void ActualizarVisitaConfiguracion(int Opcion, int EjecucionConfiguracionId, int UsuarioModificacionId, bool Baja, out RespuestaModel res)
        {
            res = new RespuestaModel();
            Dictionary <string, dynamic> P = new Dictionary <string, dynamic> {
                { "EjecucionConfiguracionId", EjecucionConfiguracionId },
                { "UsuarioModificacionId", UsuarioModificacionId },
                { "Baja", Baja },
                { "Opcion", Opcion }
            };

            try
            {
                res = _dao.Actualizar <RespuestaModel>(P);
            }
            catch (Exception ex)
            {
                string       InnerExcepcionResult = (ex.InnerException != null ? ex.InnerException?.ToString() : "").Trim();
                string       ErrorResult          = ("Error en el proceso: " + ex.Message + ". " + InnerExcepcionResult).Trim();
                LogExcepcion logEx = GenerarLogExcepcion("Proceso de Ejecuciones", ErrorResult, ErrorResult, "750", InnerExcepcionResult, "Proceso de Ejecuciones");
                m                 = RegistrarExcepcion(logEx, null);
                res.Id            = 0;
                res.ErrorId       = -2;
                res.Satisfactorio = false;
                res.Datos         = null;
                res.Mensaje       = ex.Message + ". " + ex.InnerException;
            }
        }
Beispiel #16
0
 public RespuestaModel Consultar(ContratoModel modelo)
 {
     _respuesta = new RespuestaModel();
     try {
         List <TBL_CONTRATOS> listTodo = new List <TBL_CONTRATOS>();
         using (var conex = new DatabaseViviendaEntities())
         {
             listTodo = conex.TBL_CONTRATOS.ToList();
         }
         if (!modelo.Id_Contrato.Equals(0))
         {
             listTodo = listTodo.Where(x => x.Id_Contrato.Equals(modelo.Id_Contrato)).ToList();
         }
         if (!modelo.Id_Condominio.Equals(0))
         {
             listTodo = listTodo.Where(x => x.Id_Condominio.Equals(modelo.Id_Condominio)).ToList();
         }
         _respuesta.ejecucion = true;
         _respuesta.datos     = listTodo;
     }
     catch (Exception ex)
     {
     }
     return(listTodo);
 }
Beispiel #17
0
        public RespuestaModel validaApertura(int idUsuario)
        {
            RespuestaModel resp = new RespuestaModel();

            try
            {
                var data = new Conector().EjecutarProcedimiento("validaApertura", new System.Collections.Hashtable()
                {
                    { "idUsuario", idUsuario }
                });
                if (data.Rows.Count > 0)
                {
                    for (var i = 0; i < data.Rows.Count; i++)
                    {
                        var validador = new object();

                        validador        = data.Rows[i].Field <object>("Verificador");
                        resp.Verificador = validador != null ? data.Rows[i].Field <bool>("Verificador") : false;
                    }
                }
                else
                {
                    resp = null;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(resp);
        }
        public JsonResult SendMailChangePassword(string email)
        {
            RespuestaModel respuesta = new RespuestaModel();

            if (!girls.GetExisteEmail(email, true))
            {
                respuesta.Descripcion = "El email:" + email + " no esta registrado o puede estar inactivo";
                respuesta.Status      = "false";
                return(Json(respuesta));
            }

            var codigo  = util.ConstruirCodigo();
            var subject = "Cambio de contraseña Chileplacer";
            var body    = "Tu codigo para cambio de contraseña es : " + codigo;

            var model = util.ConstruirChangePassword(email, codigo, false);

            changePassword.InsertChangePassword(model);
            sendMail.EnviarMailNotificacion(subject, body, email);

            respuesta.Descripcion = "Enviamos un codigo a la cuenta: " + email + " revise su bandeja de entrada";
            respuesta.Status      = "true";

            return(Json(respuesta));
        }
Beispiel #19
0
        public RespuestaModel cierreCaja(int idUsuario, string glosaCierre)
        {
            RespuestaModel resp = new RespuestaModel();

            try
            {
                var data = new Conector().EjecutarProcedimiento("cierreCaja", new System.Collections.Hashtable()
                {
                    { "idUsuario", idUsuario },
                    { "glosaCierre", glosaCierre }
                });
                if (data.Rows.Count > 0)
                {
                    for (var i = 0; i < data.Rows.Count; i++)
                    {
                        var validador = new object();

                        validador        = data.Rows[i].Field <object>("Verificador");
                        resp.Verificador = validador != null ? data.Rows[i].Field <bool>("Verificador") : false;

                        validador    = data.Rows[i].Field <object>("Mensaje");
                        resp.Mensaje = validador != null ? data.Rows[i].Field <string>("Mensaje") : "NO ASIGNADO";
                    }
                }
                else
                {
                    resp = null;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(resp);
        }
        public JsonResult EditarFamilia(string _Familia, string _IdFamilia, string _Impresora, string _Receta)
        {
            var validador = 0;

            if (!string.IsNullOrEmpty(_Familia) && !string.IsNullOrEmpty(_IdFamilia) && !string.IsNullOrEmpty(_Impresora) && !string.IsNullOrEmpty(_Receta))
            {
                ObjetoFamilia lfamialia = new ObjetoFamilia();
                lfamialia.Familia   = _Familia;
                lfamialia.IdFamilia = int.Parse(_IdFamilia);
                lfamialia.Impresora = _Impresora;
                lfamialia.Receta    = int.Parse(_Receta);

                RespuestaModel resultado = Acceso.EditarFamilia(lfamialia);
                if (resultado.Verificador == true)
                {
                    validador = 1;
                    return(Json(validador));
                }
                else
                {
                    validador = 2;
                    return(Json(validador));
                }
            }
            else
            {
                return(Json(validador));
            }
        }
Beispiel #21
0
        private RespuestaModel RegistrarEjecucion(List <LogEjecucion> logErrors, int SistemaId, int EjecucionConfiguracionId, string filename)
        {
            List <Ejecucion> list = MapearLogs(logErrors, SistemaId, EjecucionConfiguracionId, filename);

            try
            {
                foreach (Ejecucion ejecucion in list.OrderBy(x => x.FechaOcurrencia))
                {
                    Dictionary <string, dynamic> P = ejecucion.AsDictionary();
                    m = _dao.Insertar <RespuestaModel>(P);
                }
            }
            catch (Exception ex)
            {
                string       InnerExcepcionResult = (ex.InnerException != null ? ex.InnerException?.ToString() : "").Trim();
                string       ErrorResult          = ("Error en el proceso: " + ex.Message + ". " + InnerExcepcionResult).Trim();
                LogExcepcion logEx = GenerarLogExcepcion("Proceso de Ejecuciones", ErrorResult, ErrorResult, "750", InnerExcepcionResult, "Proceso de Ejecuciones");
                m               = RegistrarExcepcion(logEx, null);
                m.Id            = 0;
                m.ErrorId       = -2;
                m.Satisfactorio = false;
                m.Datos         = null;
                m.Mensaje       = ex.Message + ". " + ex.InnerException;
            }

            return(m);
        }
Beispiel #22
0
        public JsonResult validaApertura()
        {
            var            idUsuario = SessionVariables.Session_Datos_Usuarios.IdUsuario;
            RespuestaModel result    = Acceso.validaApertura(idUsuario);

            return(Json(result));
        }
Beispiel #23
0
 public RespuestaModel Agregar(CAT_CONDOMINIOS model)
 {
     _respuesta = new RespuestaModel();
     try
     {
         if (ExisteDB(model.Condominio))
         {
             _respuesta.ejecucion = false;
             _respuesta.mensaje.Add(Resources.Mensajes.MensajeDuplicado);
             return(_respuesta);
         }
         using (var conex = new DatabaseViviendaEntities())
         {
             model.Activo = true;
             conex.CAT_CONDOMINIOS.Add(model);
             conex.SaveChanges();
         }
         _respuesta.ejecucion = true;
         _respuesta.mensaje.Add(Resources.Mensajes.MensajeCorrecto);
     }
     catch
     {
         _respuesta.ejecucion = false;
         _respuesta.mensaje.Add(Resources.Mensajes.MensajeError);
     }
     return(_respuesta);
 }
        public JsonResult ImagenProfileGirl(string username)
        {
            var respuesta = new RespuestaModel();

            respuesta.Descripcion = profileGirls.GetProfileImage(username);

            return(Json(respuesta));
        }
Beispiel #25
0
 public Ejecuciones()
 {
     m           = new RespuestaModel();
     _dao        = new EjecucionDao();
     _daoLectura = new EjecucionConfiguracionLecturaDao();
     _daoConfig  = new MonitorConfiguracionDao();
     _eventLog   = new Log("Proceso de Ejecuciones", "Servicio de Monitor de Procesos");
 }
Beispiel #26
0
        public JsonResult UpdateAdmPassword(string email, string password)
        {
            var respuesta  = new RespuestaModel();
            var password64 = util.CodeBase64(email + "#" + password);
            var adm        = userAdm.UpdateAdmPassword(email, password64);

            respuesta.Descripcion = adm != null ? "Modificacion de contraseña satisfactoria" : "No existen los datos enviados";
            return(Json(respuesta));
        }
        public JsonResult GetProfile(string id)
        {
            var respuesta     = new RespuestaModel();
            var identificador = Guid.Parse(id);

            respuesta.Descripcion = profileGirls.GetProfileImage(identificador);

            return(Json(respuesta));
        }
Beispiel #28
0
        // GET: Respuesta/Details/5
        public ActionResult Details(int id)
        {
            SessionInitialize();
            RespuestaCAD   respuestaCAD   = new RespuestaCAD(session);
            RespuestaEN    respuestas     = respuestaCAD.ReadOIDDefault(id);
            RespuestaModel respuestaModel = RespuestaAssembler.ConvertENToModelUI(respuestas);

            SessionClose();
            return(View(respuestaModel));
        }
Beispiel #29
0
        private List <LogEjecucion> VisitarRuta(string RutaLog, int EjecucionConfiguracionId, out List <string> filenames, out bool existenLeidos)
        {
            List <LogEjecucion> logErrors = new List <LogEjecucion>();

            filenames     = new List <string>();
            existenLeidos = false;
            _eventLog.CrearLog("Buscando archivos de log en la ruta: " + RutaLog);
            try
            {
                List <string> files = FileSystemScanner.UrlDirectoryDownload(RutaLog, out string mensaje);
                foreach (string filename in files.Where(x => x.Contains(".txt")))
                {
                    _eventLog.CrearLog("Leyendo el archivo: " + filename);
                    string[] filenameArray = filename.Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries);
                    string   filenameI     = filenameArray[filenameArray.Length - 1];
                    if (filenameI != "LogEjec.txt" && ValidarFechaArchivo(filenameI))
                    {
                        _eventLog.CrearLog("Obteniendo la bitacora de logs leidos de: " + filename);

                        Dictionary <string, dynamic> P = new Dictionary <string, dynamic> {
                            { "Opcion", 2 },
                            { "EjecucionConfiguracionId", EjecucionConfiguracionId },
                            { "EjecucionConfiguracionLecturaDescripcion", filenameI },
                            { "Baja", false }
                        };

                        List <EjecucionConfiguracionLectura> lectura = _daoLectura.Consultar <EjecucionConfiguracionLectura>(P).ToList();

                        string urlFile  = Path.Combine(RutaLog, filenameI);
                        string fileText = FileSystemScanner.GetLogFile(urlFile, out string mensajeArchivo);
                        logErrors.AddRange(FileSystemScanner.MapLogText <LogEjecucion>(fileText));

                        if (lectura.Any())
                        {
                            existenLeidos = true;
                            logErrors     = logErrors.OrderBy(x => x.Fecha).Skip(lectura[0].NumeroRegistros).ToList();
                        }

                        filenames.Add(filenameI);
                    }
                }
            }
            catch (Exception ex)
            {
                string       InnerExcepcionResult = (ex.InnerException != null ? ex.InnerException?.ToString() : "").Trim();
                string       ErrorResult          = ("Error en el proceso: " + ex.Message + ". " + InnerExcepcionResult).Trim();
                LogExcepcion logEx = GenerarLogExcepcion("Proceso de Ejecuciones", ErrorResult, ErrorResult, "750", InnerExcepcionResult, "Proceso de Ejecuciones");
                m         = RegistrarExcepcion(logEx, null);
                logErrors = new List <LogEjecucion>();
                string error = string.Format("Hubo un problema con el proceso. {0}. {1}.", ex.Message, ex.InnerException?.ToString());
                _eventLog.CrearLog(error);
            }

            return(logErrors);
        }
Beispiel #30
0
 public RespuestaModel Consultar(UsuarioModel modelo)
 {
     try
     {
         _respuesta = new RespuestaModel();
         using (var conex = new DatabaseViviendaEntities())
         {
             var lstUsuario = conex.Tbl_Usuarios.ToList();
             if (!modelo.Id_Usuario.Equals(0))
             {
                 lstUsuario = lstUsuario.Where(x => x.Id_Usuario.Equals(modelo.Id_Usuario)).ToList();
             }
             if (String.IsNullOrEmpty(modelo.Nombre))
             {
                 lstUsuario = lstUsuario.Where(x => x.Nombre.Equals(modelo.Nombre)).ToList();
             }
             if (String.IsNullOrEmpty(modelo.ApPaterno))
             {
                 lstUsuario = lstUsuario.Where(x => x.ApPaterno.Equals(modelo.ApPaterno)).ToList();
             }
             if (String.IsNullOrEmpty(modelo.ApMaterno))
             {
                 lstUsuario = lstUsuario.Where(x => x.ApMaterno.Equals(modelo.ApMaterno)).ToList();
             }
             if (String.IsNullOrEmpty(modelo.Correo))
             {
                 lstUsuario = lstUsuario.Where(x => x.Correo.Equals(modelo.Correo)).ToList();
             }
             if (String.IsNullOrEmpty(modelo.Usuario))
             {
                 lstUsuario = lstUsuario.Where(x => x.Usuario.Equals(modelo.Usuario)).ToList();
             }
             if (String.IsNullOrEmpty(modelo.Contraseña))
             {
                 lstUsuario = lstUsuario.Where(x => x.Password.Equals(modelo.Contraseña)).ToList();
             }
             if (modelo.Activo.Equals(1))
             {
                 lstUsuario = lstUsuario.Where(x => x.Activo.Equals(true)).ToList();
             }
             if (modelo.Activo.Equals(0))
             {
                 lstUsuario = lstUsuario.Where(x => x.Activo.Equals(false)).ToList();
             }
             _respuesta.ejecucion = true;
             _respuesta.datos     = lstUsuario;
         }
     }
     catch
     {
         _respuesta.ejecucion = false;
         _respuesta.mensaje.Add(Resources.Mensajes.MensajeError);
     }
     return(_respuesta);
 }