Ejemplo n.º 1
0
 //metodo eliminar
 public void mtdEliminar()
 {
     try
     {
         using (var db = new conModelo())
         {
             db.Entry(this).State = EntityState.Deleted;
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Ejemplo n.º 2
0
        public List <conSERpServicio> mtdListar() //retornar un collection
        {
            var servicios = new List <conSERpServicio>();

            try
            {
                //conexion con la fuente de datos
                using (var db = new conModelo())
                {
                    servicios = db.conSERpServicio.Include("conCATtCategoria").Where(x => x.SERestado.Equals("A")).ToList();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(servicios);
        }
Ejemplo n.º 3
0
        public List <conSERpServicio> mtdListarMisServicios(int xGintIdUsuario) //retornar un collection
        {
            var servicios = new List <conSERpServicio>();

            try
            {
                //conexion con la fuente de datos
                using (var db = new conModelo())
                {
                    servicios = db.conSERpServicio.Include("conCATtCategoria").Where(x => x.USUid_usuario == xGintIdUsuario).ToList();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(servicios);
        }
Ejemplo n.º 4
0
        public List <conDTOtDepartamento> mtdListar() //retornar un collection
        {
            var LobjDepartamentos = new List <conDTOtDepartamento>();

            try
            {
                //conexion con la fuente de datos
                using (var conModelo = new conModelo())
                {
                    LobjDepartamentos = conModelo.conDTOtDepartamento.ToList();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(LobjDepartamentos);
        }
Ejemplo n.º 5
0
        public List <conCATtCategoria> Listar() //retornar un collection
        {
            var catServicios = new List <conCATtCategoria>();

            try
            {
                //conexion con la fuente de datos
                using (var db = new conModelo())
                {
                    catServicios = db.conCATtCategoria.ToList();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(catServicios);
        }
Ejemplo n.º 6
0
        public List <conPRVtProvincia> mtdListar(int xGintIdDepartamento) //retornar un collection
        {
            var LobjProvincias = new List <conPRVtProvincia>();

            try
            {
                //conexion con la fuente de datos
                using (var conModelo = new conModelo())
                {
                    LobjProvincias = conModelo.conPRVtProvincia.Where(x => x.DTOid_departamento == xGintIdDepartamento).ToList();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(LobjProvincias);
        }
Ejemplo n.º 7
0
        public List <conDSTtDistrito> mtdListar(int xGintIdProvincia) //retornar un collection
        {
            var LobjDistritos = new List <conDSTtDistrito>();

            try
            {
                //conexion con la fuente de datos
                using (var conModelo = new conModelo())
                {
                    LobjDistritos = conModelo.conDSTtDistrito.Where(x => x.PRVid_provincia == xGintIdProvincia).ToList();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(LobjDistritos);
        }
Ejemplo n.º 8
0
        public List <conCTRpCotizacionRespuesta> mtdListar() //retornar un collection
        {
            var cotizacionRespuestas = new List <conCTRpCotizacionRespuesta>();

            try
            {
                //conexion con la fuente de datos
                using (var db = new conModelo())
                {
                    cotizacionRespuestas = db.conCTRpCotizacionRespuesta.ToList();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(cotizacionRespuestas);
        }
Ejemplo n.º 9
0
        //metodo Obtener
        public conCOTpCotizacion mtdObtener(int ixGintIdCotizaciond) //retorna un objeto
        {
            var cotizacionRespuesta = new conCOTpCotizacion();

            try
            {
                using (var db = new conModelo())
                {
                    cotizacionRespuesta = db.conCOTpCotizacion
                                          .Where(x => x.COTid_cotizacion == ixGintIdCotizaciond)
                                          .SingleOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(cotizacionRespuesta);
        }
Ejemplo n.º 10
0
        public List <conCOTpCotizacion> mtdListarMisCotizaciones(int xGintIdUsuario) //retornar un collection
        {
            var cotizaciones = new List <conCOTpCotizacion>();

            try
            {
                //conexion con la fuente de datos
                using (var db = new conModelo())
                {
                    cotizaciones = db.conCOTpCotizacion
                                   .Where(x => x.USUid_usuario == xGintIdUsuario).ToList();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(cotizaciones);
        }
Ejemplo n.º 11
0
        public conDSTtDistrito mtdObtenerLatitudLongitud(int xGintIdDepartamento, int xGintIdProvincia, int xGintIdDistrito)
        {
            var LobjDistrito = new conDSTtDistrito();

            try
            {
                using (var db = new conModelo())
                {
                    LobjDistrito = db.conDSTtDistrito.Where(x => x.conPRVtProvincia.DTOid_departamento == xGintIdDepartamento &&
                                                            x.PRVid_provincia == xGintIdProvincia &&
                                                            x.DSTid_distrito == xGintIdDistrito).SingleOrDefault();

                    return(LobjDistrito);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 12
0
        public List <conUSUpUsuario> mtdListarProveedores() //retornar un collection
        {
            var GobjListaUsuarios = new List <conUSUpUsuario>();

            try
            {
                //conexion con la fuente de datos
                using (var db = new conModelo())
                {
                    //INNER JOIN EN TIPO USUARIO, SERVICIOS QUE OFRECE Y QUE ESTE ACTIVO
                    GobjListaUsuarios = db.conUSUpUsuario
                                        .Include("conSERpServicio")
                                        .Where(x => x.conTIUtTipoUsuario.TIUnombre.Equals("Proveedor") && x.USUestado.Equals("A")).ToList();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(GobjListaUsuarios);
        }
Ejemplo n.º 13
0
        //metodo Obtener
        public conPDSpPedidoServicio mtdObtener(int xGintIdPedidoServicio) //retorna un objeto
        {
            var LobjPedidoServicio = new conPDSpPedidoServicio();

            try
            {
                using (var db = new conModelo())
                {
                    LobjPedidoServicio = db.conPDSpPedidoServicio
                                         .Include("conSERpServicio.conUSUpUsuario")
                                         .Include("conUSUpUsuario")
                                         .Where(x => x.PDSid_pedidoServicio == xGintIdPedidoServicio)
                                         .SingleOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(LobjPedidoServicio);
        }
Ejemplo n.º 14
0
        //metodo Obtener
        public conCOTpCotizacion mtdObtenerCotizacion(int ixGintIdCotizaciond) //retorna un objeto
        {
            var cotizacion = new conCOTpCotizacion();

            try
            {
                using (var db = new conModelo())
                {
                    cotizacion = db.conCOTpCotizacion
                                 .Include("conUSUpUsuario")
                                 .Include("conCTRpCotizacionRespuesta.conUSUpUsuario")
                                 .Where(x => x.COTid_cotizacion == ixGintIdCotizaciond)
                                 .SingleOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(cotizacion);
        }
Ejemplo n.º 15
0
 public void mtdGuardarCotizacionRespuesta()
 {
     try
     {
         using (var db = new conModelo())
         {
             if (this.CTRid_cotizacionRespuesta > 0)
             {
                 db.Entry(this).State = EntityState.Modified;
             }
             else
             {
                 db.Entry(this).State = EntityState.Added;
             }
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 16
0
 public void mtdGuardar()
 {
     try
     {
         using (var db = new conModelo())
         {
             if (this.FOPid_foroPregunta > 0)
             {
                 db.Entry(this).State = EntityState.Modified;
             }
             else
             {
                 db.Entry(this).State = EntityState.Added;
             }
             db.SaveChanges();
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 17
0
        public conUSUpUsuario mtdObtenerPorUsuario(string xGstrUSUusuario)
        {
            var GobjUsuario = new conUSUpUsuario();

            try
            {
                //conexion con la fuente de datos
                using (var db = new conModelo())
                {
                    //INNER JOIN EN TIPO USUARIO, SERVICIOS QUE OFRECE Y QUE ESTE ACTIVO
                    GobjUsuario = db.conUSUpUsuario
                                  .Include("conTIUtTipoUsuario")
                                  .Where(x => x.USUusuario == xGstrUSUusuario)
                                  .SingleOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(GobjUsuario);
        }
Ejemplo n.º 18
0
        //metodo Obtener
        public conSERpServicio mtdObtener(int id) //retorna un objeto
        {
            var servicio = new conSERpServicio();

            try
            {
                using (var db = new conModelo())
                {
                    servicio = db.conSERpServicio
                               .Include("conCATtCategoria")
                               .Include("conUSUpUsuario")
                               .Include("conCALpCalificacion")
                               .Where(x => x.SERid_servicio == id)
                               .SingleOrDefault();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(servicio);
        }
Ejemplo n.º 19
0
        public conFOPpForoPreguntas mtdObtener(int xGintIdForoPregunta)
        {
            var objPedidosServicio = new conFOPpForoPreguntas();

            try
            {
                //conexion con la fuente de datos
                using (var db = new conModelo())
                {
                    objPedidosServicio = db.conFOPpForoPreguntas
                                         .Include("conSERpServicio")
                                         .Include("conUSUpUsuario")
                                         .Where(x => x.FOPid_foroPregunta == xGintIdForoPregunta)
                                         .SingleOrDefault();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(objPedidosServicio);
        }
Ejemplo n.º 20
0
        public List <conFOPpForoPreguntas> mtdListarPreguntasServicio(int xGintIdServicio)
        {
            var lstPedidosServicios = new List <conFOPpForoPreguntas>();

            try
            {
                //conexion con la fuente de datos
                using (var db = new conModelo())
                {
                    lstPedidosServicios = db.conFOPpForoPreguntas
                                          .Include("conSERpServicio")
                                          .Include("conUSUpUsuario")
                                          .Where(x => x.conSERpServicio.SERid_servicio == xGintIdServicio)
                                          .ToList();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(lstPedidosServicios);
        }
Ejemplo n.º 21
0
 public void mtdGuardar()
 {
     try
     {
         using (var db = new conModelo())
         {
             if (this.PDSid_pedidoServicio > 0)
             {
                 db.Entry(this).State = EntityState.Modified;
             }
             else
             {
                 db.Entry(this).State = EntityState.Added;
             }
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Ejemplo n.º 22
0
 public void mtdGuardar()
 {
     try
     {
         using (var db = new conModelo())
         {
             if (this.CALid_calificacion > 0)
             {
                 db.Entry(this).State = EntityState.Modified;
             }
             else
             {
                 db.Entry(this).State = EntityState.Added;
             }
             db.SaveChanges();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 23
0
        public List <conPDSpPedidoServicio> mtdListarPedidosCliente(int xGintIdUsuario) //
        {
            var lstPedidosServicios = new List <conPDSpPedidoServicio>();

            try
            {
                //conexion con la fuente de datos
                using (var db = new conModelo())
                {
                    lstPedidosServicios = db.conPDSpPedidoServicio
                                          .Include("conSERpServicio")
                                          .Include("conUSUpUsuario")
                                          .Where(x => x.USUid_usuario == xGintIdUsuario)
                                          .ToList();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(lstPedidosServicios);
        }
Ejemplo n.º 24
0
        public List <conPDSpPedidoServicio> mtdListarPedidosPendienteCalificacion(int xGintIdUsuario)
        {
            var pedidos = new List <conPDSpPedidoServicio>();

            try
            {
                //conexion con la fuente de datos
                using (var db = new conModelo())
                {
                    pedidos = db.conPDSpPedidoServicio
                              .Include("conSERpServicio.conUSUpUsuario")
                              .Include("conSERpServicio.conCALpCalificacion")
                              .Where(x => x.USUid_usuario == xGintIdUsuario &&
                                     x.conSERpServicio.conCALpCalificacion.Count == 0 &&
                                     x.PDSestado.Equals("T")).ToList(); //x.PDSestado.Equals("T") &&
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            return(pedidos);
        }
Ejemplo n.º 25
0
        public ResponseModel mtdSeguridad(string xGstrUsuario, string xGstrContrasena)
        {
            var rm = new ResponseModel();

            try
            {
                using (var db = new conModelo())
                {
                    var contrasenaSHA = HashHelper.SHA1(xGstrContrasena);

                    var usuario = db.conUSUpUsuario
                                  .Where(x => x.USUusuario.Equals(xGstrUsuario) &&
                                         x.USUclave.Equals(contrasenaSHA)).SingleOrDefault();

                    if (usuario != null)
                    {
                        if (usuario.USUestado.Equals("A"))
                        {
                            SessionHelper.AddUserToSession(usuario.USUid_usuario.ToString());
                            rm.SetResponse(true);
                        }
                        else
                        {
                            rm.SetResponse(false, "Usuario desactivado, comuniquese con el administrador.");
                        }
                    }
                    else
                    {
                        rm.SetResponse(false, "Usuario o Contrase�a incorrectos.");
                    }
                }
            }
            catch (Exception)
            {
            }
            return(rm);
        }