Esempio n. 1
0
        public List <Reporte> infoReporte()
        {
            List <Reporte> result = new List <Reporte>();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    StringBuilder sqlReporte = new StringBuilder();
                    sqlReporte.Append(_sqlreporte);

                    var list = db.Database.SqlQuery <Reporte>(sqlReporte.ToString(), new object[] { Global.evento }).ToList <Reporte>();

                    if (list.Count > 0)
                    {
                        foreach (var item in list)
                        {
                            result.Add(item);
                        }
                    }
                    else
                    {
                        result = new List <Reporte>();
                    }
                }
                return(result);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public Mensaje <Recibo> obtenerCorrelativoVistaPrevia()
        {
            Mensaje <Recibo> result = new Mensaje <Recibo>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un Error en base de datos al obtener el Correlativo";
            result.data    = new Recibo();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    var correlativo = (from c in db.MET01_CORRELATIVO
                                       where c.CORRELATIVO == 1
                                       select c).SingleOrDefault();

                    result.data.recibo = correlativo.CORRELATIVO_ACTUAL;
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una Excepcion, referencia: " + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
Esempio n. 3
0
        public Mensaje <Evento> RegistrarEvento(MET01_EVENTO ev)
        {
            Mensaje <Evento> result = new Mensaje <Evento>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un Error en base de datos al tratar de registrar el Evento";
            result.data    = new Evento();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    var     valcorrelativo = (from li in db.MET01_EVENTO select li.EVENTO).ToList();
                    decimal correlativo    = 0;

                    if (valcorrelativo.Count > 0)
                    {
                        correlativo = valcorrelativo.Max() + 1;
                    }
                    else
                    {
                        correlativo = 1;
                    }

                    MET01_EVENTO nuevoEvento = new MET01_EVENTO()
                    {
                        EVENTO          = correlativo,
                        NOMBRE          = ev.NOMBRE,
                        ESTADO_REGISTRO = ev.ESTADO_REGISTRO,
                        //USUARIO_CREACION = Global.usuario,
                        USUARIO_CREACION = "MET01",
                        FECHA_CREACION   = DateTime.Now
                    };

                    db.MET01_EVENTO.Add(nuevoEvento);
                    db.SaveChanges();
                }
                result.codigo  = 0;
                result.mensaje = "Se ha registrado correctamente el Evento: " + ev.NOMBRE;
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una excepcion, Referencia: " + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
Esempio n. 4
0
        public Mensaje <ReciboOficina> registrarReciboOficina()
        {
            Mensaje <ReciboOficina> result = new Mensaje <ReciboOficina>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en base de datos al tratar de registrar el recibo";
            result.data    = new ReciboOficina();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    MET01_RECIBO_OFICINA nuevoRecibo = new MET01_RECIBO_OFICINA();

                    var correlativo = (from c in db.MET01_CORRELATIVO
                                       where c.CORRELATIVO == 1
                                       select c).Single();

                    nuevoRecibo.RECIBO           = Convert.ToDecimal(correlativo.CORRELATIVO_ACTUAL);
                    nuevoRecibo.RECIBO_OFICINA   = this.reciboOficina;
                    nuevoRecibo.NOMBRE           = this.nombre.ToUpper();
                    nuevoRecibo.TOTAL            = this.cantidad;
                    nuevoRecibo.TOTAL_LETRAS     = NumeroLetras.NumeroALetras(this.cantidad.ToString()).ToUpper();
                    nuevoRecibo.CONCEPTO         = this.conceptoRecibo.ToUpper();
                    nuevoRecibo.EVENTO           = Global.evento;
                    nuevoRecibo.IGLESIA          = this.idIglesia;
                    nuevoRecibo.ESTADO_REGISTRO  = "A";
                    nuevoRecibo.USUARIO_CREACION = Global.usuario;
                    nuevoRecibo.FECHA_CREACION   = DateTime.Now;

                    db.MET01_RECIBO_OFICINA.Add(nuevoRecibo);
                    correlativo.CORRELATIVO_ACTUAL++;
                    db.SaveChanges();
                    result.mensaje = "Se registro el recibo Numero: " + nuevoRecibo.RECIBO + ",\nA nombre de: " + nuevoRecibo.NOMBRE + " de forma Exitosa...!!!";
                }
                result.codigo = 0;
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una Excepcion, referencia: " + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
        public Mensaje <List <Iglesia> > busquedaIglesia(string cadena)
        {
            Mensaje <List <Iglesia> > result = new Mensaje <List <Iglesia> >();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en Base de Datos al tratar de Obtener la busqueda";
            result.data    = new List <Iglesia>();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    var busqueda = db.MET01_IGLESIA.
                                   Where(b => b.NOMBRE.ToUpper().Contains(cadena.ToUpper())).
                                   Select(b => b).ToList();

                    if (busqueda.Count == 0)
                    {
                        result.codigo  = -1;
                        result.mensaje = "No existen datos para la consulta indicada";
                        result.data    = new List <Iglesia>();
                        return(result);
                    }
                    else
                    {
                        foreach (var item in busqueda)
                        {
                            result.data.Add(new Iglesia(item));
                        }
                    }
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una excepcion al momento de realizar la busqueda, ref: " + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
        public Mensaje <Iglesia> datosiglesia()
        {
            Mensaje <Iglesia> result = new Mensaje <Iglesia>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en base de datos al obtener datos de la iglesia";
            result.data    = new Iglesia();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    var dataIglesia = (from i in db.MET01_IGLESIA
                                       where i.IGLESIA == this.idIglesia
                                       select i).SingleOrDefault();

                    var datoPastor = (from p in db.MET01_PASTOR
                                      where p.PASTOR == dataIglesia.PASTOR
                                      select p).SingleOrDefault();

                    var datoEncargado = (from e in db.MET01_ENCARGADO
                                         where e.ENCARGADO == dataIglesia.ENCARGADO
                                         select e).SingleOrDefault();

                    this.nombre_pastor      = datoPastor.NOMBRE.ToUpper();
                    this.nombre_encargado   = datoEncargado.NOMBRE.ToUpper();
                    this.telefono_encargado = datoEncargado.TELEFONO;
                    dbModel = dataIglesia;
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                result.data    = this;
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una Excepcion al tratar de Recuperar los datos, referencia: " + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
Esempio n. 7
0
        public Mensaje <Evento> ActualizarRegistroEvento(MET01_EVENTO ev)
        {
            Mensaje <Evento> result = new Mensaje <Evento>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un Error en base de datos al Actualizar el registro del Evento " + ev.NOMBRE;
            result.data    = new Evento();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    MET01_EVENTO nuevoEvento = (from e in db.MET01_EVENTO
                                                where e.EVENTO == ev.EVENTO
                                                select e).SingleOrDefault();

                    if (nuevoEvento == null)
                    {
                        result.codigo  = -1;
                        result.mensaje = "No existe ningun registro con el dato del evento enviando para su Actualizacion";
                        return(result);
                    }

                    nuevoEvento.NOMBRE          = ev.NOMBRE;
                    nuevoEvento.ESTADO_REGISTRO = ev.ESTADO_REGISTRO;
                    //nuevoEvento.USUARIO_MODIFICACION = Global.usuariologueado;
                    nuevoEvento.USUARIO_MODIFICACION = "MET01";
                    nuevoEvento.FECHA_MODIFICACION   = DateTime.Now;
                    db.SaveChanges();
                }
                result.codigo  = 0;
                result.mensaje = "Se ha actualizado correctamente el Evento: " + ev.NOMBRE;
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una excepcion, Referencia: " + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
Esempio n. 8
0
        public Mensaje <List <MET01_ESTADO> > listaDescripcionEstado()
        {
            Mensaje <List <MET01_ESTADO> > result = new Mensaje <List <MET01_ESTADO> >();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un Error en base de datos al obtener los Estados";
            result.data    = new List <MET01_ESTADO>();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    var list = (from es in db.MET01_ESTADO.Where(d => d.ESTADO == "A" || d.ESTADO == "B").OrderBy(e => e.ESTADO) select es).ToList();

                    if (list.Count > 0)
                    {
                        foreach (var item in list)
                        {
                            result.data.Add(item);
                        }
                    }
                    else
                    {
                        result.codigo  = -1;
                        result.mensaje = "No existen Estados Registrados que mostrar";
                        result.data    = new List <MET01_ESTADO>();
                        return(result);
                    }
                    result.codigo  = 0;
                    result.mensaje = "Ok";
                    return(result);
                }
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una Excepcion, referencia: " + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
Esempio n. 9
0
        public Mensaje <List <MET01_EVENTO> > listarTodoseEventos()
        {
            Mensaje <List <MET01_EVENTO> > result = new Mensaje <List <MET01_EVENTO> >();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un Error en base de datos al obtener los Eventos";
            result.data    = new List <MET01_EVENTO>();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    var list = (from li in db.MET01_EVENTO.OrderByDescending(a => a.EVENTO) select li).ToList();

                    if (list.Count > 0)
                    {
                        foreach (var item in list)
                        {
                            result.data.Add(item);
                        }
                    }
                    else
                    {
                        result.codigo  = -1;
                        result.mensaje = "No existen Eventos Registrados que mostrar, ir al Mantenimiento de Bancos";
                        result.data    = new List <MET01_EVENTO>();
                        return(result);
                    }
                    result.codigo  = 0;
                    result.mensaje = "Ok";
                    return(result);
                }
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una Excepcion, referencia: " + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
Esempio n. 10
0
        public Mensaje <List <MET01_EVENTO> > listarEventosActivos()
        {
            Mensaje <List <MET01_EVENTO> > result = new Mensaje <List <MET01_EVENTO> >();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un Error en Base de Datos al obtener el listado de Eventos";
            result.data    = new List <MET01_EVENTO>();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    var list = (from li in db.MET01_EVENTO.Where(l => l.ESTADO_REGISTRO == "A").OrderByDescending(l => l.EVENTO) select li).ToList();

                    if (list.Count > 0)
                    {
                        foreach (var item in list)
                        {
                            result.data.Add(item);
                        }
                    }
                    else
                    {
                        result.codigo  = -1;
                        result.mensaje = "No existen Eventos Activos";
                        result.data    = new List <MET01_EVENTO>();
                        return(result);
                    }
                    result.codigo  = 0;
                    result.mensaje = "Ok";
                    return(result);
                }
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una Excepcion, referencia: " + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
Esempio n. 11
0
        public Mensaje <List <Recibo> > listarRecibos()
        {
            Mensaje <List <Recibo> > result = new Mensaje <List <Recibo> >();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en base de datos";
            result.data    = new List <Recibo>();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    StringBuilder sqllistar = new StringBuilder();
                    sqllistar.Append(_sqlListadoRecibos);

                    var resp = db.Database.SqlQuery <Recibo>(sqllistar.ToString(), new object[] { Global.evento }).ToList <Recibo>();

                    if (resp.Count == 0)
                    {
                        result.data = new List <Recibo>();
                    }
                    else
                    {
                        foreach (var item in resp)
                        {
                            result.data.Add(item);
                        }
                    }
                }
                result.codigo  = 0;
                result.mensaje = "Ok";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una excepcion al obtener el listado de Recibos, ref;" + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
Esempio n. 12
0
        public Mensaje <List <Region> > listaRegiones()
        {
            Mensaje <List <Region> > result = new Mensaje <List <Region> >();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en base de datos al obtener el listado de Regiones";
            result.data    = new List <Region>();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    var listaregiones = db.MET01_REGION.Where(r => r.REGION != 0).Select(r => r).OrderBy(r => r.REGION).ToList();

                    if (listaregiones.Count > 0)
                    {
                        foreach (var item in listaregiones)
                        {
                            result.data.Add(new Region(item));
                        }
                    }
                    else
                    {
                        result.codigo  = -1;
                        result.mensaje = "No existen registros para el catalogo de Regiones";
                        result.data    = new List <Region>();
                        return(result);
                    }
                    result.codigo  = 0;
                    result.mensaje = "Ok";
                    return(result);
                }
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una excepcion al tratar de obtener el listado, ref: " + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
Esempio n. 13
0
        public List <Recibo> datosRecibo()
        {
            List <Recibo> result = new List <Recibo>();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    StringBuilder sqlrecibo = new StringBuilder();
                    sqlrecibo.Append(_sqlRecibo);

                    var resp = db.Database.SqlQuery <Recibo>(sqlrecibo.ToString(), new object[] { this.recibo }).ToList <Recibo>();
                    result = resp;
                }
                return(result);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public Mensaje <List <Iglesia> > llenarGridIglesias()
        {
            Mensaje <List <Iglesia> > result = new Mensaje <List <Iglesia> >();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un Error en base de datos al cargar el listado";
            result.data    = new List <Iglesia>();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    var listaIglesias = db.MET01_IGLESIA.Where(i => i.ESTADO_REGISTRO == "A").Select(i => i).OrderBy(i => i.NOMBRE).ToList();

                    if (listaIglesias.Count > 0)
                    {
                        foreach (var item in listaIglesias)
                        {
                            result.data.Add(new Iglesia(item));
                        }
                    }
                    else
                    {
                        result.codigo  = -1;
                        result.mensaje = "No existen Iglesias Registradas";
                        return(result);
                    }
                }
                result.codigo  = 0;
                result.mensaje = "OK";
                return(result);
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una excepcion al obtener el listado de Iglesias, ref: " + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
Esempio n. 15
0
        public Mensaje <MET01_EVENTO> obtenerEvento(MET01_EVENTO ev)
        {
            Mensaje <MET01_EVENTO> result = new Mensaje <MET01_EVENTO>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un Error en base de datos al obtener el Evento";
            result.data    = new MET01_EVENTO();

            try
            {
                using (var db = new EntitiesMetro())
                {
                    var concep = (from li in db.MET01_EVENTO
                                  where li.EVENTO == ev.EVENTO
                                  select li).SingleOrDefault();

                    if (concep != null)
                    {
                        result.data = concep;
                    }
                    else
                    {
                        result.codigo  = -1;
                        result.mensaje = "No existe informacion del Evento enviado";
                        result.data    = new MET01_EVENTO();
                        return(result);
                    }
                    result.codigo  = 0;
                    result.mensaje = "Ok";
                    return(result);
                }
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una Excepcion, referencia: " + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
        public Mensaje <Iglesia> agregarNuevaIglesia()
        {
            Mensaje <Iglesia> result = new Mensaje <Iglesia>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en base de datos al tratar de agregar la Iglesia";
            result.data    = new Iglesia();

            try
            {
                using (var tr = new TransactionScope())
                {
                    using (var db = new EntitiesMetro())
                    {
                        var idp = db.MET01_PASTOR.Select(p => p.PASTOR).Max();
                        idp++;
                        MET01_PASTOR nuevoPastor = new MET01_PASTOR();
                        nuevoPastor.PASTOR           = idp;
                        nuevoPastor.NOMBRE           = this.nombre_pastor.ToUpper();
                        nuevoPastor.ESTADO_REGISTRO  = "A";
                        nuevoPastor.USUARIO_CREACION = Global.usuario;
                        nuevoPastor.FECHA_CREACION   = DateTime.Now;

                        db.MET01_PASTOR.Add(nuevoPastor);

                        int res_p = db.SaveChanges();

                        if (res_p <= 0)
                        {
                            Transaction.Current.Rollback();
                            result.codigo  = -2;
                            result.mensaje = "No fue posible registrar la Iglesia, ref: No pudo registrar datos del Pastor";
                            result.data    = new Iglesia();
                            return(result);
                        }

                        var ide = db.MET01_ENCARGADO.Select(p => p.ENCARGADO).Max();
                        ide++;
                        MET01_ENCARGADO nuevoEncargado = new MET01_ENCARGADO();
                        nuevoEncargado.ENCARGADO        = ide;
                        nuevoEncargado.NOMBRE           = this.nombre_encargado.ToUpper();
                        nuevoEncargado.TELEFONO         = this.telefono_encargado;
                        nuevoEncargado.ESTADO_REGISTRO  = "A";
                        nuevoEncargado.USUARIO_CREACION = Global.usuario;
                        nuevoEncargado.FECHA_CREACION   = DateTime.Now;

                        db.MET01_ENCARGADO.Add(nuevoEncargado);

                        int res_e = db.SaveChanges();

                        if (res_e <= 0)
                        {
                            Transaction.Current.Rollback();
                            result.codigo  = -2;
                            result.mensaje = "No fue posible registrar la Iglesia ref: No pudo registrar datos del Encargado";
                            result.data    = new Iglesia();
                            return(result);
                        }

                        var idi = db.MET01_IGLESIA.Select(iga => iga.IGLESIA).Max();
                        idi++;
                        MET01_IGLESIA nuevaIglesia = new MET01_IGLESIA();
                        nuevaIglesia.IGLESIA          = idi;
                        nuevaIglesia.NOMBRE           = this.nombre.ToUpper();
                        nuevaIglesia.REGION           = this.region;
                        nuevaIglesia.ENCARGADO        = ide;
                        nuevaIglesia.PASTOR           = idp;
                        nuevaIglesia.ESTADO_REGISTRO  = "A";
                        nuevaIglesia.USUARIO_CREACION = Global.usuario;
                        nuevaIglesia.FECHA_CREACION   = DateTime.Now;

                        db.MET01_IGLESIA.Add(nuevaIglesia);

                        int res_i = db.SaveChanges();

                        if (res_i <= 0)
                        {
                            Transaction.Current.Rollback();
                            result.codigo  = -2;
                            result.mensaje = "No fue posible registrar la Iglesia, ref: No pudo registrar datos de la Iglesia";
                            result.data    = new Iglesia();
                            return(result);
                        }
                    }
                    tr.Complete();
                    result.codigo  = 0;
                    result.mensaje = "Se registro la iglesia: " + this.nombre.ToUpper();
                    return(result);
                }
            }
            catch (Exception ex)
            {
                result.codigo  = -1;
                result.mensaje = "Ocurrio una excepcion al guarda la Iglesia, ref: " + ex.ToString();
                result.error   = ex.ToString();
                return(result);
            }
        }
        public Mensaje <Iglesia> actualizarDatosIglesia()
        {
            Mensaje <Iglesia> result = new Mensaje <Iglesia>();

            result.codigo  = 1;
            result.mensaje = "Ocurrio un error en base de datos al Actualizar Datos de la Iglesia";
            result.data    = new Iglesia();

            try
            {
                using (var tr = new TransactionScope())
                {
                    using (var db = new EntitiesMetro())
                    {
                        var datoIglesia = (from i in db.MET01_IGLESIA
                                           where i.IGLESIA == this.idIglesia
                                           select i).SingleOrDefault();

                        var datoPastor = (from p in db.MET01_PASTOR
                                          where p.PASTOR == datoIglesia.PASTOR
                                          select p).SingleOrDefault();

                        var datoEncargado = (from e in db.MET01_ENCARGADO
                                             where e.ENCARGADO == datoIglesia.ENCARGADO
                                             select e).SingleOrDefault();

                        if (this.region != datoIglesia.REGION || this.nombre != datoIglesia.NOMBRE)
                        {
                            datoIglesia.REGION = this.region;
                            datoIglesia.NOMBRE = this.nombre.Trim().ToUpper();
                            datoIglesia.USUARIO_MODIFICACION = Global.usuario.ToUpper();
                            datoIglesia.FECHA_MODIFICACION   = DateTime.Now;
                            int res_i = db.SaveChanges();

                            if (res_i <= 0)
                            {
                                Transaction.Current.Rollback();
                                result.codigo  = -2;
                                result.mensaje = "No fue posible Actualizar la Region de la Iglesia";
                                return(result);
                            }
                        }

                        if (this.nombre_pastor.Trim().ToUpper() != datoPastor.NOMBRE.Trim().ToUpper())
                        {
                            datoPastor.NOMBRE = this.nombre_pastor.Trim().ToUpper();
                            datoPastor.USUARIO_MODIFICACION = Global.usuario.ToUpper();
                            datoPastor.FECHA_MODIFICACION   = DateTime.Now;
                            int res_p = db.SaveChanges();

                            if (res_p <= 0)
                            {
                                Transaction.Current.Rollback();
                                result.codigo  = -2;
                                result.mensaje = "No fue posible Actualizar la Informacion del Pastor";
                                return(result);
                            }
                        }

                        if (this.nombre_encargado.Trim().ToUpper() != datoEncargado.NOMBRE.Trim().ToUpper() ||
                            this.telefono_encargado.Trim() != datoEncargado.TELEFONO.Trim())
                        {
                            datoEncargado.NOMBRE               = this.nombre_encargado.Trim().ToUpper();
                            datoEncargado.TELEFONO             = this.telefono_encargado;
                            datoEncargado.USUARIO_MODIFICACION = Global.usuario.ToUpper();
                            datoEncargado.FECHA_MODIFICACION   = DateTime.Now;
                            int res_e = db.SaveChanges();

                            if (res_e <= 0)
                            {
                                Transaction.Current.Rollback();
                                result.codigo  = -2;
                                result.mensaje = "No fue posible Actualizar la Informacion del Encargado";
                                return(result);
                            }
                        }
                    }
                    tr.Complete();
                    result.codigo  = 0;
                    result.mensaje = "Se Actualizaron los datos Correctamente";
                    return(result);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }