Example #1
0
        private void btnHtml_Click(object sender, EventArgs e)
        {
            if (grdDatos.Rows.Count > 1)
            {
                using (new CursorWait()) {
                    try {
                        StringBuilder tem = DataGridtoHTML(this.grdDatos);
                        using (SaveFileDialog dlg = new SaveFileDialog())
                        {
                            dlg.Filter       = "Data Files (*.html)|*.html";
                            dlg.DefaultExt   = "html";
                            dlg.AddExtension = true;
                            if (dlg.ShowDialog() == DialogResult.OK)
                            {
                                string fileName = dlg.FileName;

                                System.IO.TextWriter w = new System.IO.StreamWriter(fileName);
                                w.Write(tem);
                                w.Flush();
                                w.Close();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        ELog.save("ERROR AL EXPORTAR A HTML", ex);
                    }
                }
            }
            else
            {
                MessageBox.Show("Debe seleccionar un Almacen", "No hay almacen", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        public string DL_registrarOrden(int habreposo, int nOrdenMedId)
        {
            string res = "";

            try
            {
                cmd.Connection  = NewConnection(strCon);
                cmd.CommandText = "GHS.USP_Insertar_Orden_Intervencion";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Clear();
                pAddParameter(cmd, "@nOrdenMedId", nOrdenMedId, SqlDbType.Int);
                pAddParameter(cmd, "@nAmbienteId", habreposo, SqlDbType.Int);

                res = fEjecutar(cmd);
            }
            catch (Exception e)
            {
                ELog.Save(this, e);
            }
            finally
            {
                if (cmd.Connection.State == ConnectionState.Open)
                {
                    cmd.Connection.Close();
                }
            }

            return(res);
        }
        public void EnviarMensajeServicioMensajeria()
        {
            MessageQueue myQueue = new MessageQueue(@".\Private$\email");

            myQueue.Formatter = new XmlMessageFormatter(new Type[]
                                                        { typeof(string) });

            try
            {
                var    msg  = myQueue.Receive();
                string json = msg.Body.ToString();
                if (json != null)
                {
                    EnvioMensajeServicioDeCorreo obj = new EnvioMensajeServicioDeCorreo();
                    obj.PostEnvioMensajeJSONAsync(json);
                }
            }

            catch (Exception ex)
            {
                ELog.save(ex);
            }


            return;
        }
Example #4
0
        public ResponseModel Guardar(tb_Poliza poliza)
        {
            var rm = new ResponseModel();

            try
            {
                using (var ctx = new SeguroContext())
                {
                    if (poliza.IdPoliza > 0)
                    {
                        ctx.Entry(poliza).State = EntityState.Modified;
                    }
                    else
                    {
                        ctx.Entry(poliza).State = EntityState.Added;
                    }
                    rm.SetResponse(true);
                    ctx.SaveChanges();
                }
            }
            catch (Exception e)
            {
                ELog.save(this, e); //throw;
            }

            return(rm);
        }
Example #5
0
        /// <summary>
        /// Este método es usado para registrar la información básica del usuario, autentificar y redireccionar al home de nuestro aplicativo.
        /// </summary>
        /// <param name="usuario"></param>
        /// <returns></returns>
        public ResponseModel RegistroDeLogin(Usuario usuario)
        {
            using (var context = new RedSocialContext())
            {
                try
                {
                    // Guardamos la clave en formato MD5
                    usuario.Contrasena = HashHelper.MD5(usuario.Contrasena);

                    // Ignoramos la validacion para que la contraseña pase
                    context.Configuration.ValidateOnSaveEnabled = false;

                    context.Usuario.Add(usuario);
                    context.SaveChanges();

                    context.Database.ExecuteSqlCommand("UPDATE Usuario SET Url = @url WHERE id = @id",
                                                       new SqlParameter("url", ViewHelper.ConvertNameToUrl(usuario.Nombre, usuario.Apellido, usuario.id.ToString())),
                                                       new SqlParameter("id", usuario.id));

                    // Guardamos en session al usuario actual, solo necesitamos guardar su ID
                    SessionHelper.AddUserToSession(usuario.id.ToString());

                    rm.SetResponse(true);
                    rm.href = "inicio";
                }
                catch (Exception e)
                {
                    ELog.Save(this, e);
                }
            }

            return(rm);
        }
Example #6
0
        public tb_Periodo ObtenerPeriodo(int idPeriodo)
        {
            var periodo = new tb_Periodo();

            try
            {
                using (var ctx = new SeguroContext())
                {
                    //formas de incluir una relacion entre objetos

/*                    periodo = ctx.tb_Periodo
 *                      .Include(x => x.tb_Estado)
 *                      .Where(x => x.IdPeriodo==idPeriodo )
 *                                  .SingleOrDefault() ;*/

                    periodo = ctx.tb_Periodo
                              .Include("tb_Estado")
                              .Where(x => x.IdPeriodo == idPeriodo)
                              .SingleOrDefault();
                }
            }
            catch (Exception e)
            {
                ELog.save(this, e); //throw;
            }

            return(periodo);
        }
Example #7
0
        public List <tb_Periodo> ListarPeriodo(int i = 0)
        {
            var periodos = new List <tb_Periodo>();

            try
            {
                using (var ctx = new SeguroContext())
                {
                    if (i == 0)
                    {
                        //obtiene la relacion entre periodo y estado
                        periodos = ctx.tb_Periodo
                                   .Include(x => x.tb_Estado)
                                   .ToList();
                    }
                    else
                    {
                        periodos = ctx.Database.SqlQuery <tb_Periodo>("sp_listaPeriodos").ToList();
                    }
                }
            }
            catch (Exception e)
            {
                ELog.save(this, e); //throw;
            }

            return(periodos);
        }
Example #8
0
        /* P R O C E S O S */

        private void InicializandoAplicacion()
        {
            try
            {
                this.Icon             = SpyScr.Properties.Resources.settings;
                this.IcoNotifica.Icon = SpyScr.Properties.Resources.settings;
                IsActivo                 = true;
                IsDesactivado            = false;
                BtnEstatus.MouseHover   += new EventHandler(BtnEstatus_MouseHover);
                BtnEstatus.MouseLeave   += new EventHandler(BtnEstatus_MouseLeave);
                BtnMinimizar.MouseHover += new EventHandler(BtnMinimizar_MouseHover);
                BtnMinimizar.MouseLeave += new EventHandler(BtnMinimizar_MouseLeave);
                BtnCerrar.MouseHover    += new EventHandler(BtnCerrar_MouseHover);
                BtnCerrar.MouseLeave    += new EventHandler(BtnCerrar_MouseLeave);
                this.FormClosing        += new FormClosingEventHandler(frmPrincipal_FormClosing);
                Pass = ConfigurationManager.AppSettings["Pass"].ToString();
                string Intervalo = ConfigurationManager.AppSettings["Intervalo"].ToString();
                Tiempo.Interval = int.Parse(Intervalo);
                Tiempo.Enabled  = true;
                Tiempo.Start();
                this.IcoNotifica.Text = "Proceso Activo";
            }
            catch (Exception ex)
            {
                ELog.Save(this, ex);
            }
        }
Example #9
0
        public string DL_Insertar_RequisitoPlan(int nOrdenIntervencionId, string cRequisitoDesc, int nCantidad)
        {
            string res = "";

            try
            {
                cmd.Connection  = NewConnection(strCon);
                cmd.CommandText = "GHS.USP_MNT_Plan_Intervencion";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Clear();
                pAddParameter(cmd, "@nOrdenIntervencionId", nOrdenIntervencionId, SqlDbType.Int);
                pAddParameter(cmd, "@cRequisitoDesc", cRequisitoDesc, SqlDbType.VarChar);
                pAddParameter(cmd, "@nCantidad", nCantidad, SqlDbType.Int);

                res = fEjecutar(cmd);
            }
            catch (Exception e)
            {
                ELog.Save(this, e);
            }
            finally
            {
                if (cmd.Connection.State == ConnectionState.Open)
                {
                    cmd.Connection.Close();
                }
            }

            return(res);
        }
Example #10
0
        public ResponseModel Guardar(List <tb_Reserva> ListaReseva)
        {
            var rm = new ResponseModel();

            try
            {
                using (var ctx = new SeguroContext())
                {
                    foreach (tb_Reserva reserva in ListaReseva)
                    {
                        if (reserva.IdReserva > 0)
                        {
                            ctx.Entry(reserva).State = EntityState.Modified;
                        }
                        else
                        {
                            ctx.Entry(reserva).State = EntityState.Added;
                        }
                        rm.SetResponse(true);
                        ctx.SaveChanges();
                    }
                }
            }
            catch (Exception e)
            {
                ELog.save(this, e); //throw;
            }

            return(rm);
        }
Example #11
0
        public int GuardarPersona(tb_Persona persona)
        {
            var codigo = 0;

            try
            {
                using (var ctx = new SeguroContext())
                {
                    if (persona.idPersona > 0)
                    {
                        ctx.Entry(persona).State = EntityState.Modified;
                    }
                    else
                    {
                        ctx.Entry(persona).State = EntityState.Added;
                    }
                    ctx.SaveChanges();

                    codigo = persona.idPersona;
                }
            }
            catch (Exception e)
            {
                ELog.save(this, e); //throw;
            }

            return(codigo);
        }
Example #12
0
        public ELUsuario ObtenerUsuarioLogeado(int id)
        {
            var usuario = new ELUsuario();

            try
            {
                using (var conn = new SqlConnection(strCon))
                {
                    conn.Open();

                    var query = new SqlCommand("select * from usuario where id = @id", conn);
                    query.Parameters.AddWithValue("@id", id);

                    using (var dr = query.ExecuteReader())
                    {
                        dr.Read();
                        if (dr.HasRows)
                        {
                            usuario.Nombre         = dr["Nombre"].ToString();
                            usuario.Apellido       = dr["Apellido"].ToString();
                            usuario.NombreCompleto = usuario.Nombre + " " + usuario.Apellido;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                ELog.Save(this, e);
            }

            return(usuario);
        }
Example #13
0
        public bool EsAdmin(int usuario_id)
        {
            var EsAdmin = false;

            using (var context = new RedSocialContext())
            {
                try
                {
                    var u = context.Usuario
                            .Where(x => x.id == usuario_id && x.Admin == 1)
                            .FirstOrDefault();

                    if (u != null)
                    {
                        EsAdmin = true;
                    }
                }
                catch (Exception e)
                {
                    ELog.Save(this, e);
                }
            }

            return(EsAdmin);
        }
Example #14
0
        /* A C C I O N E S*/

        #region BtnEstatus

        private void BtnEstatus_Click(object sender, EventArgs e)
        {
            string respuesta = Prompt.ShowDialog(text: "Indique Contraseña", caption: "Contraseña");

            if (respuesta == Pass)
            {
                IsActivo = !IsActivo;
                if (IsActivo)
                {
                    Tiempo.Start();
                    this.BtnEstatus.Image = SpyScr.Properties.Resources.imgSwitchOn;
                    this.IcoNotifica.Text = "Proceso Activo";
                    ELog.SaveString(titulo: "Proceso Activo", mensaje: "Se activa proceso");
                }
                else
                {
                    Tiempo.Stop();
                    this.BtnEstatus.Image = SpyScr.Properties.Resources.imgSwitchOff;
                    this.IcoNotifica.Text = "Proceso Inactivo";
                    ELog.SaveString(titulo: "Proceso Inactivo", mensaje: "Se desactiva proceso");
                }
            }
            else
            {
                MessageBox.Show("Contaseña Incorrecta", "Contraseña Incorrecta", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                ELog.SaveString(titulo: "Contaseña Incorrecta", mensaje: "Contaseña Incorrecta");
            }
        }
Example #15
0
 public void EnvioCarpetaLocal()
 {
     try
     {
         //Invoca al metodo que transforma el contenido de excel en un json.
         CargarInformacionExcel obj = new CargarInformacionExcel();
         Object myObjeto            = obj.CargarObjeto();
         //Serializa el objeto creado a un json.
         string JSONresult = JsonConvert.SerializeObject(myObjeto);
         var    fecha      = DateTime.Now.ToString("hhmmsspppppp");
         string path       = @"C:\Users\programador1\source\repos\CorreosMasivos\JSON Creados\correos" + fecha + ".json";
         if (File.Exists(path))
         {
             File.Delete(path);
             using (var tw = new StreamWriter(path, true))
             {
                 tw.WriteLine(JSONresult.ToString());
                 tw.Close();
             }
         }
         else if (!File.Exists(path))
         {
             using (var tw = new StreamWriter(path, true))
             {
                 tw.WriteLine(JSONresult.ToString());
                 tw.Close();
             }
         }
     }
     catch (Exception ex)
     {
         ELog.save(ex);
     }
 }
Example #16
0
        public ResponseModel Acceder(ELUsuario usuario)
        {
            try
            {
                // Encriptamos la contraseña para comparar
                usuario.Password = HashHelper.MD5(usuario.Password);

                var _usuario = dl.DL_Autenticar(usuario);

                if (_usuario != null)
                {
                    SessionHelper.AddUserToSession(_usuario.Id.ToString());

                    rm.SetResponse(true);
                    rm.href = "inicio";
                }
                else
                {
                    rm.SetResponse(false, "El usuario ingresado no existe");
                }
            }
            catch (Exception e)
            {
                ELog.Save(this, e);
            }

            return(rm);
        }
Example #17
0
        public ResponseModel Acceder(Usuario usuario)
        {
            using (var context = new RedSocialContext())
            {
                try
                {
                    // Encriptamos la contraseña para comparar
                    usuario.Contrasena = HashHelper.MD5(usuario.Contrasena);

                    var _usuario = context.Usuario
                                   .Where(x =>
                                          x.Contrasena == usuario.Contrasena &&
                                          x.Correo == usuario.Correo
                                          ).SingleOrDefault();

                    if (_usuario != null)
                    {
                        SessionHelper.AddUserToSession(_usuario.id.ToString());

                        rm.SetResponse(true);
                        rm.href = "inicio";
                    }
                    else
                    {
                        rm.SetResponse(false, "El usuario ingresado no existe");
                    }
                }
                catch (Exception e)
                {
                    ELog.Save(this, e);
                }
            }

            return(rm);
        }
Example #18
0
        public string DL_Insertar_SOAP(int nHistoriaClinica, string cSubjetivo, string cApreciacion)
        {
            string res = "";

            try
            {
                cmd.Connection  = NewConnection(strCon);
                cmd.CommandText = "GHS.USP_Insertar_SOAP";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Clear();
                pAddParameter(cmd, "@nHistoriaClinica", nHistoriaClinica, SqlDbType.Int);
                pAddParameter(cmd, "@cSubjetivo", cSubjetivo, SqlDbType.VarChar);
                pAddParameter(cmd, "@cApreciacion", cApreciacion, SqlDbType.VarChar);

                res = fEjecutar(cmd);
            }
            catch (Exception e)
            {
                ELog.Save(this, e);
            }
            finally
            {
                if (cmd.Connection.State == ConnectionState.Open)
                {
                    cmd.Connection.Close();
                }
            }

            return(res);
        }
Example #19
0
        private void frmPrincipal_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!IsDesactivado)
            {
                string respuesta = Prompt.ShowDialog(text: "Indique Contraseña", caption: "Contraseña");

                if (respuesta == Pass)
                {
                    ELog.SaveString(titulo: "SpyScr Cerrado", mensaje: "Aplicación Cerrada");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Contaseña Incorrecta", "Contraseña Incorrecta", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    ELog.SaveString(titulo: "Contaseña Incorrecta", mensaje: "Contaseña Incorrecta");
                    e.Cancel = true;
                }
            }
            else
            {
                try
                {
                    ELog.SaveString(titulo: "SpyScr Cerrado", mensaje: "Aplicación Cerrada");
                    Application.Exit();
                }
                catch (Exception ex)
                {
                    ELog.Save(this, ex);
                }
            }
        }
Example #20
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (grdDatos.Rows.Count > 1)
     {
         using (new CursorWait()) {
             try {
                 this.UI_GV_CopyData(this.grdDatos);
                 Microsoft.Office.Interop.Excel.Application xlexcel;
                 Microsoft.Office.Interop.Excel.Workbook    xlWorkBook;
                 Microsoft.Office.Interop.Excel.Worksheet   xlWorkSheet;
                 object valores = System.Reflection.Missing.Value;
                 xlexcel         = new Microsoft.Office.Interop.Excel.Application();
                 xlexcel.Visible = true;
                 xlWorkBook      = xlexcel.Workbooks.Add(valores);
                 xlWorkSheet     = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
                 Microsoft.Office.Interop.Excel.Range cr = (Microsoft.Office.Interop.Excel.Range)xlWorkSheet.Cells[1, 1];
                 cr.Select();
                 xlWorkSheet.PasteSpecial(cr, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, true);
             }catch (Exception ex) {
                 ELog.save("ERROR AL ENVIAR A EXCEL", ex);
             }
         }
     }
     else
     {
         MessageBox.Show("Debe seleccionar un Almacen", "No hay almacen", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #21
0
        public List <Publicacion> Listar(int usuario_id = 0)
        {
            List <Publicacion> publicaciones = new List <Publicacion>();

            using (var context = new RedSocialContext())
            {
                try
                {
                    // Traemos las ultimoas 20 publicaciones
                    if (usuario_id == 0) // Si queremos traer todas las publicaciones
                    {
                        publicaciones = context.Publicacion
                                        .OrderByDescending(x => x.FechaRegistro)
                                        .Take(30).ToList();        //Take equivale a SELECT TOP 30
                    }
                    else // Si queremos traer las publicaciones de u nusuario especifico
                    {
                        publicaciones = context.Publicacion
                                        .OrderByDescending(x => x.FechaRegistro)
                                        .Where(x => x.Para == usuario_id)
                                        .Take(30).ToList();        //Take equivale a SELECT TOP 30
                    }

                    foreach (var p in publicaciones)
                    {
                        // Obtenemos el emisor y su foto
                        p.Emisor = context.Usuario
                                   .Where(x => x.id == p.De).SingleOrDefault();

                        p.Emisor.Foto = context.Foto
                                        .Where(x => x.Relacion == "U" + p.De).SingleOrDefault();


                        if (p.Emisor.Foto == null)
                        {
                            p.Emisor.Foto = new Foto();                        // Si no tiene foto agregamos una por defecto
                        }
                        // Obtenemos el receptor y su foto
                        p.Receptor = context.Usuario
                                     .Where(x => x.id == p.Para).SingleOrDefault();

                        p.Receptor.Foto = context.Foto
                                          .Where(x => x.Relacion == "U" + p.Para).SingleOrDefault();

                        if (p.Receptor.Foto == null)
                        {
                            p.Receptor.Foto = new Foto();                          // Si no tiene foto agregamos una por defecto
                        }
                    }
                }
                catch (Exception e)
                {
                    ELog.Save(this, e);
                }
            }

            return(publicaciones);
        }
Example #22
0
        public ELPaciente DL_BuscarPaciente(string dni, string hc)
        {
            ELPaciente objPaciente = null;

            try
            {
                using (SqlConnection conn = new SqlConnection(strCon))
                {
                    conn.Open();

                    cmd.Connection  = conn;
                    cmd.CommandText = "GHS.USP_Consultar_Paciente";
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Clear();

                    cmd.Parameters.AddWithValue("@cNroDocumento", dni == "" ? "" : dni);
                    cmd.Parameters.AddWithValue("@cNroHistoriaClinica", hc == "" ? "" : hc);

                    SqlDataReader drSQL = fLeer(cmd);
                    if (drSQL.HasRows == false)
                    {
                        objPaciente = new ELPaciente();
                    }
                    else
                    {
                        while (drSQL.Read())
                        {
                            objPaciente                     = new ELPaciente();
                            objPaciente.nPacienteId         = drSQL["nPacienteId"].Equals(System.DBNull.Value) ? 0 : Convert.ToInt32(drSQL["nPacienteId"]);
                            objPaciente.cNomCompleto        = drSQL["cNomCompleto"].Equals(System.DBNull.Value) ? "" : Convert.ToString(drSQL["cNomCompleto"]);
                            objPaciente.cApePaterno         = drSQL["cApePaterno"].Equals(System.DBNull.Value) ? "" : Convert.ToString(drSQL["cApePaterno"]);
                            objPaciente.cApeMaterno         = drSQL["cApeMaterno"].Equals(System.DBNull.Value) ? "" : Convert.ToString(drSQL["cApeMaterno"]);
                            objPaciente.cNroHistoriaClinica = drSQL["cNroHistoriaClinica"].Equals(System.DBNull.Value) ? "" : Convert.ToString(drSQL["cNroHistoriaClinica"]);
                            objPaciente.cFechaNacimiento    = drSQL["cFechaNacimiento"].Equals(System.DBNull.Value) ? "" : Convert.ToString(drSQL["cFechaNacimiento"]);
                            objPaciente.cNombres            = drSQL["cNombres"].Equals(System.DBNull.Value) ? "" : Convert.ToString(drSQL["cNombres"]);
                            objPaciente.nEdad               = drSQL["nEdad"].Equals(System.DBNull.Value) ? 0 : Convert.ToInt32(drSQL["nEdad"]);
                            objPaciente.cSexo               = drSQL["cSexo"].Equals(System.DBNull.Value) ? "" : Convert.ToString(drSQL["cSexo"]);
                            objPaciente.cMaestroDescripcion = drSQL["cMaestroDescripcion"].Equals(System.DBNull.Value) ? "" : Convert.ToString(drSQL["cMaestroDescripcion"]);
                            objPaciente.cNroDocumento       = drSQL["cNroDocumento"].Equals(System.DBNull.Value) ? "" : Convert.ToString(drSQL["cNroDocumento"]);
                            objPaciente.cAlergias           = drSQL["cAlergias"].Equals(System.DBNull.Value) ? "" : Convert.ToString(drSQL["cAlergias"]);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                ELog.Save(this, e);
            }
            finally
            {
                if (cmd.Connection.State == ConnectionState.Open)
                {
                    cmd.Connection.Close();
                }
            }

            return(objPaciente);
        }
Example #23
0
        public AnexGRIDResponde ListarReservas(AnexGRID grid)
        {
            try
            {
                using (var ctx = new SeguroContext())
                {
                    //inicializa la grilla
                    grid.Inicializar();

                    string sql = "select (p.anio+p.mes) as periodo, m.DescripcionMoneda as moneda, r.FechaReserva as fecha," +
                                 " sum(r.ReservaSepelio) as Sepelio, sum(r.ReservaGarantizado) as Garantizado, " +
                                 " sum(r.ReservaMatematica) as Matematica, sum(r.ReservaTotal) as total" +
                                 " , e.DescripcionEstado as estado " +
                                 " from tb_Reserva r" +
                                 " inner join tb_Periodo p on r.IdPeriodo = p.IdPeriodo" +
                                 " inner join tb_estado e on r.IdEstado = e.IdEstado" +
                                 " inner join tb_Foto f on r.IdFoto = f.IdFoto" +
                                 " inner join tb_Moneda m on f.IdMoneda = m.idMoneda" +
                                 " group by p.anio, p.mes, m.DescripcionMoneda , r.FechaReserva, e.DescripcionEstado" +
                                 " order by periodo desc";

                    var query = ctx.Database.SqlQuery <ListaReseva>(sql).ToList();

                    //Skip(grid.pagina)-->se indica desde que página se inicia la paginacion
                    //Take(grid.limite)-->se indica la cantidad de registros a mostrar
                    var listaReserva = query.Skip(grid.pagina)
                                       .Take(grid.limite)
                                       .ToList();

                    //Se obtiene la cantidad de registros que hay en la tabla, se usa en la paginacion
                    var total = query.Count();

                    grid.SetData(
                        from p in listaReserva
                        select new
                    {
                        p.Periodo,
                        p.Moneda,
                        p.Fecha,
                        p.Sepelio,
                        p.Garantizado,
                        p.Matematica,
                        p.total,
                        p.Estado
                    },
                        total
                        );
                }
            }
            catch (Exception e)
            {
                ELog.save(this, e); //throw;
            }

            return(grid.responde());
        }
Example #24
0
 private void Tiempo_Tick(object sender, EventArgs e)
 {
     try
     {
         CapturaPantalla();
     }
     catch (Exception ex)
     {
         ELog.Save(this, ex);
     }
 }
Example #25
0
        private static void Log <T>(T message, int stackFrame, ELog logType = ELog.Log)
        {
            ChangeConsoleForegroundColor(logType);

            var    frame  = new System.Diagnostics.StackFrame(stackFrame);
            string format = $"[{DateTime.Now:HH:mm:ss}] {message}\n[{logType}] - {frame.GetMethod().DeclaringType.Name}\n";

            Console.WriteLine(format);

            ChangeConsoleForegroundColor(ELog.None);
        }
Example #26
0
 public void PruebaDeServicio()
 {
     try
     {
         PruebaEnvioCarpetaLocal ejecutaPrueba = new PruebaEnvioCarpetaLocal();
         ejecutaPrueba.EnvioCarpetaLocal();
     }
     catch (Exception ex)
     {
         ELog.save(ex);
     }
 }
Example #27
0
        public AnexGRIDResponde ListarFotos(AnexGRID grid)
        {
            try
            {
                using (var ctx = new SeguroContext())
                {
                    //inicializa la grilla
                    grid.Inicializar();

                    string sql = "select (p.anio+p.mes) as periodo, f.fechafoto as Fecha, " +
                                 " m.DescripcionMoneda as moneda, " +
                                 " e.DescripcionEstado as estado" +
                                 " from tb_Foto f inner " +
                                 " join tb_Periodo p on f.IdPeriodo = p.IdPeriodo inner " +
                                 " join tb_estado e on f.IdEstado = e.IdEstado inner " +
                                 " join tb_Moneda m on f.IdMoneda = m.idMoneda " +
                                 " group by p.anio, p.mes, f.fechafoto, m.DescripcionMoneda, " +
                                 " e.DescripcionEstado" +
                                 " order by periodo desc";

                    var query = ctx.Database.SqlQuery <ListaFoto>(sql).ToList();

                    //Skip(grid.pagina)-->se indica desde que página se inicia la paginacion
                    //Take(grid.limite)-->se indica la cantidad de registros a mostrar
                    var listaFotos = query.Skip(grid.pagina)
                                     .Take(grid.limite)
                                     .ToList();

                    //Se obtiene la cantidad de registros que hay en la tabla, se usa en la paginacion
                    var total = query.Count();

                    grid.SetData(
                        from p in listaFotos
                        select new
                    {
                        p.Periodo,
                        p.Fecha,
                        p.Moneda,
                        p.Estado,
                        p.total
                    },
                        total
                        );
                }
            }
            catch (Exception e)
            {
                ELog.save(this, e); //throw;
            }

            return(grid.responde());
        }
Example #28
0
 private void btnCopiar_Click(object sender, EventArgs e)
 {
     try {
         using (new CursorWait())
         {
             UI_GV_CopyData(grdDatos);
         }
     }
     catch (Exception ex)
     {
         ELog.save("ERROR AL COPIAR EN CADUCOS", ex);
     }
 }
Example #29
0
 public void PruebaLog()
 {
     try
     {
         int v1 = 5;
         int v2 = 0;
         int v3 = v1 / v2;
     }
     catch (Exception ex)
     {
         ELog.save(ex);
     }
 }
Example #30
0
        public string BL_registrarOrden(int habreposo, int nOrdenMedId)
        {
            //ELPaciente paciente = new ELPaciente();
            try
            {
                dlOrden.DL_registrarOrden(habreposo, nOrdenMedId);
            }
            catch (Exception e)
            {
                ELog.Save(this, e);
            }

            return("Registro Exitoso");
        }