public static bool Existe(string ced)
        {
            DatosDataContext DB;

            try
            {
                using (DB = new DatosDataContext())
                {
                    var query = (from usu in DB.USUARIO where usu.CEDULA == ced select usu).Count();
                    if (query == 0)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new DatosExcepciones("Error al Buscar cedual del usuairo", ex);
            }
            finally
            {
                DB = null;
            }
        }
예제 #2
0
        public static Local Create(Local p)
        {
            DatosDataContext bd = new DatosDataContext();

            try
            {
                //Categoria p = new C>
                //  p.IdProveedor = not.IdProveedor;
                //p.CedProveedor = not.CedProveedor;>
                //p.Nombre = not.Nombre;>
                //p.Representante = not.Representante;>
                //p.Direccion = not.Direccion;>
                //p.Ciudad = not.Ciudad;>
                //p.Telefono = not.Telefono;>
                //p.Fax = not.Fax;>
                bd.insertarlocal(p.direccion, p.ciudad, p.telefono, p.fax);
                bd.SubmitChanges();
            }
            catch (DatosExcepciones ex)
            {
                throw new DatosExcepciones("Error al  Insertar Proveedor.", ex);
            }
            finally
            {
                bd = null;
            }

            return(p);
        }
예제 #3
0
        public static Local Modificar(Local p)
        {
            DatosDataContext bd = new DatosDataContext();

            try
            {
                //    Categoria p = new Proveedor();
                //    p.IdProveedor = not.IdProveedor;
                //    p.CedProveedor = not.CedProveedor;
                //    p.Nombre = not.Nombre;
                //    p.Representante = not.Representante;
                //    p.Direccion = not.Direccion;
                //    p.Ciudad = not.Ciudad;
                //    p.Telefono = not.Telefono;
                //    p.Fax = not.Fax;
                bd.actualizarlocal(p.idLocal, p.direccion, p.ciudad, p.telefono, p.fax);
                bd.SubmitChanges();
            }
            catch (DatosExcepciones ex)
            {
                throw new DatosExcepciones("Error al  Modificar Proveedor.", ex);
            }
            finally
            {
                bd = null;
            }

            return(p);
        }
예제 #4
0
        public bool AgregarUsuario(int idTipoRol,
                                   string usuario, string clave, bool estado)
        {
            try
            {
                int respuesta = 1;
                estado = true;
                DatosDataContext dc = new DatosDataContext();
                respuesta = Convert.ToInt32(dc.AgregarUsuario(idTipoRol,
                                                              usuario, clave, estado));

                if (respuesta == 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #5
0
        public static bool ExisteID(int id)
        {
            DatosDataContext DB;

            try
            {
                using (DB = new DatosDataContext())
                {
                    var query = (from loc in DB.LOCAL where loc.IdLocal == id select loc).Count();
                    if (query == 0)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new DatosExcepciones("Error al Buscar Codigo del Proveedor.", ex);
            }
            finally
            {
                DB = null;
            }
        }
예제 #6
0
        public static bool Existe(string ced)
        {
            DatosDataContext DB;

            try
            {
                using (DB = new DatosDataContext())
                {
                    var query = (from prov in DB.PROVEEDOR where prov.CedProveedor == ced select prov).Count();
                    if (query == 0)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new DatosExcepciones("Error al Buscar Codigo del Proveedor.", ex);
            }
            finally
            {
                DB = null;
            }
        }
예제 #7
0
        public static Proveedor Modificar(Proveedor not)
        {
            DatosDataContext bd = new DatosDataContext();

            try
            {
                Proveedor p = new Proveedor();
                p.IdProveedor   = not.IdProveedor;
                p.CedProveedor  = not.CedProveedor;
                p.Nombre        = not.Nombre;
                p.Representante = not.Representante;
                p.Direccion     = not.Direccion;
                p.Ciudad        = not.Ciudad;
                p.Telefono      = not.Telefono;
                p.Fax           = not.Fax;
                bd.actualizarproveedor(p.IdProveedor, p.CedProveedor, p.Nombre, p.Representante, p.Direccion, p.Ciudad, p.Telefono, p.Fax);
                bd.SubmitChanges();
            }
            catch (DatosExcepciones ex)
            {
                throw new DatosExcepciones("Error al  Modificar Proveedor.", ex);
            }
            finally
            {
                bd = null;
            }

            return(not);
        }
        public static bool ExisteID(int id)
        {
            DatosDataContext DB;

            try
            {
                using (DB = new DatosDataContext())
                {
                    var query = (from prov in DB.PRODUCTO where prov.IdProducto == id select prov).Count();
                    if (query == 0)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new DatosExcepciones("Error al Buscar Codigo del Producto.", ex);
            }
            finally
            {
                DB = null;
            }
        }
        public static Producto Modificar(Producto p)
        {
            DatosDataContext bd = new DatosDataContext();

            try
            {
                //Producto p = new Producto();
                //p.IdProducto = not.IdProducto;
                //p.CedProducto = not.CedProducto;
                //p.Nombre = not.Nombre;
                //p.Representante = not.Representante;
                //p.Direccion = not.Direccion;
                //p.Ciudad = not.Ciudad;
                //p.Telefono = not.Telefono;
                //p.Fax = not.Fax;
                bd.actualizarproducto(p.Idproducto, p.Idcategoria, p.Idproveedor, p.Nombre, p.Unidad_medida, p.Precio_proveedor, p.Stock_actual, p.Stock_minimo);
                bd.SubmitChanges();
            }
            catch (DatosExcepciones ex)
            {
                throw new DatosExcepciones("Error al  Modificar Producto.", ex);
            }
            finally
            {
                bd = null;
            }

            return(p);
        }
        public static Guia_Detalle Create(Guia_Detalle p)
        {
            DatosDataContext bd = new DatosDataContext();

            try
            {
                //Categoria p = new C>
                //  p.IdProveedor = not.IdProveedor;
                //p.CedProveedor = not.CedProveedor;>
                //p.Nombre = not.Nombre;>
                //p.Representante = not.Representante;>
                //p.Direccion = not.Direccion;>
                //p.Ciudad = not.Ciudad;>
                //p.Telefono = not.Telefono;>
                //p.Fax = not.Fax;>
                bd.spInsertarGuiaDetalle(p.idGuia, p.idProducto, p.precioventa, p.cantidad);
                bd.SubmitChanges();
            }
            catch (DatosExcepciones ex)
            {
                throw new DatosExcepciones("Error al  Insertar Proveedor.", ex);
            }
            finally
            {
                bd = null;
            }

            return(p);
        }
예제 #11
0
        public static byte[] getImageById(string id)
        {
            DatosDataContext bd = new DatosDataContext();

            try
            {
                //Categoria p = new Categoria();
                //p.Idcategoria = not.IdProveedor;
                USUARIO j = (from usu in bd.USUARIO where usu.IDUSUARIO == int.Parse(id) select usu).Single();
                if (j.FOTO != null)
                {
                    return(j.FOTO.ToArray());
                }
                else
                {
                    return(null);
                }
            }
            catch (DatosExcepciones ex)
            {
                throw new DatosExcepciones("Error al  Eliminar Usuario.", ex);
            }
            finally
            {
                bd = null;
            }
        }
예제 #12
0
        public List <ConsultarDistritosResult> ObtenerDistritos()
        {
            DatosDataContext db = new DatosDataContext();
            List <ConsultarDistritosResult> datos = db.ConsultarDistritos().ToList();

            return(datos);
        }
예제 #13
0
        public bool AgregarEmpleado(int IdTipoIdentificacion, string Identificacion, string Nombre, string Apellido1, string Apellido2,
                                    string Direccion, string fechaNacimiento, string departamento, string Correo, string Telefono, char Provincia, string Canton, string Distrito,
                                    string FechaEntrada, string FechaSalida, bool Estado, bool estadoEmpleado)
        {
            try
            {
                int respuesta       = 1;
                DatosDataContext dc = new DatosDataContext();
                respuesta = Convert.ToInt32(dc.AgregarEmpleado(IdTipoIdentificacion, Identificacion, Nombre, Apellido1, Apellido2,
                                                               Direccion, fechaNacimiento, departamento, Correo, Telefono, Provincia, Canton, Distrito,
                                                               FechaEntrada, FechaSalida, Estado, estadoEmpleado));

                if (respuesta == 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
예제 #14
0
        public static bool ExisteID(int id)
        {
            DatosDataContext DB;

            try
            {
                using (DB = new DatosDataContext())
                {
                    var query = (from cat in DB.GUIA where cat.IdGuia == id select cat).Count();
                    if (query == 0)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new DatosExcepciones("Error al Buscar Codigo de Guia.", ex);
            }
            finally
            {
                DB = null;
            }
        }
예제 #15
0
        public static bool Existe(string cate)
        {
            DatosDataContext DB;

            try
            {
                using (DB = new DatosDataContext())
                {
                    var query = (from cat in DB.CATEGORIA where cat.Categoria1 == cate select cat).Count();
                    if (query == 0)
                    {
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                throw new DatosExcepciones("Error al Buscar Codigo del Proveedor.", ex);
            }
            finally
            {
                DB = null;
            }
        }
예제 #16
0
        public static Guia Create(Guia p)
        {
            DatosDataContext bd = new DatosDataContext();

            try
            {
                //Categoria p = new C>
                //  p.IdProveedor = not.IdProveedor;
                //p.CedProveedor = not.CedProveedor;>
                //p.Nombre = not.Nombre;>
                //p.Representante = not.Representante;>
                //p.Direccion = not.Direccion;>
                //p.Ciudad = not.Ciudad;>
                //p.Telefono = not.Telefono;>
                //p.Fax = not.Fax;>
                bd.spInsertarGuia(p.idGuia, p.idLocal, p.fechaSalida, p.idTransportista, p.total);
                bd.SubmitChanges();
            }
            catch (DatosExcepciones ex)
            {
                throw new DatosExcepciones("Error al  Insertar Proveedor.", ex);
            }
            finally
            {
                bd = null;
            }

            return(p);
        }
예제 #17
0
        public List <DistritosResult> ObtenerDistritos(char Provincia, string Canton)
        {
            DatosDataContext       db    = new DatosDataContext();
            List <DistritosResult> datos = db.Distritos(Provincia, Canton).ToList();

            return(datos);
        }
예제 #18
0
        public List <CantonesResult> ObtenerCantones(char Provincia)
        {
            DatosDataContext      db    = new DatosDataContext();
            List <CantonesResult> datos = db.Cantones(Provincia).ToList();

            return(datos);
        }
예제 #19
0
        public List <ProvinciasResult> ObtenerProvincias()
        {
            DatosDataContext        db    = new DatosDataContext();
            List <ProvinciasResult> datos = db.Provincias().ToList();

            return(datos);
        }
예제 #20
0
        public static Categoria Modificar(Categoria p)
        {
            DatosDataContext bd = new DatosDataContext();

            try
            {
                //    Categoria p = new Proveedor();
                //    p.IdProveedor = not.IdProveedor;
                //    p.CedProveedor = not.CedProveedor;
                //    p.Nombre = not.Nombre;
                //    p.Representante = not.Representante;
                //    p.Direccion = not.Direccion;
                //    p.Ciudad = not.Ciudad;
                //    p.Telefono = not.Telefono;
                //    p.Fax = not.Fax;
                bd.actualizarcategoria(p.Idcategoria, p.Categoria1, p.Descripcion);
                bd.SubmitChanges();
            }
            catch (DatosExcepciones ex)
            {
                throw new DatosExcepciones("Error al  Modificar Proveedor.", ex);
            }
            finally
            {
                bd = null;
            }

            return(p);
        }
예제 #21
0
 public AgregarUsuarioResult AgregarUsuario(string Usuario, string Clave)
 {
     try
     {
         DatosDataContext dc = new DatosDataContext();
         return(dc.AgregarUsuario(Usuario, Clave).FirstOrDefault());
     }
     catch
     {
         throw;
     }
 }
예제 #22
0
 public List <ConsultaEmpleadoResult> ConsultaEmpleado(int Codigo)
 {
     try
     {
         DatosDataContext dc = new DatosDataContext();
         List <ConsultaEmpleadoResult> data = dc.ConsultaEmpleado(Codigo).ToList();
         return(data);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
예제 #23
0
 public bool AgregarDocenteGrado(int IdDocente, int IdGrado)
 {
     try
     {
         DatosDataContext db = new DatosDataContext();
         var dato            = db.AgregarDocenteGrado(IdDocente, IdGrado);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
예제 #24
0
 public ConsultaDocenteGradoResult ConsultaDocenteGrado(int IdDocenteGrado)
 {
     try
     {
         DatosDataContext db = new DatosDataContext();
         var dato            = db.ConsultaDocenteGrado(IdDocenteGrado).FirstOrDefault();
         return(dato);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
예제 #25
0
 public ConsultaUSUARIOSResult ConsultaUSUARIOS(int UsuarioID)
 {
     try
     {
         DatosDataContext       db    = new DatosDataContext();
         ConsultaUSUARIOSResult datos = db.ConsultaUSUARIOS(UsuarioID).FirstOrDefault();
         return(datos);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
예제 #26
0
 public bool AgregarUsuarioRol(int IdUsuario, int IdRol)
 {
     try
     {
         DatosDataContext db = new DatosDataContext();
         var dato            = db.AgregarUsuarioRol(IdUsuario, IdRol);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
예제 #27
0
 public ConsultaUsuarioRolResult ConsultaUsuarioRol(int IdUsuarioRol)
 {
     try
     {
         DatosDataContext db = new DatosDataContext();
         var dato            = db.ConsultaUsuarioRol(IdUsuarioRol).FirstOrDefault();
         return(dato);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
예제 #28
0
 public bool DeshabilitarEmpleado(int IdEmpleado)
 {
     try
     {
         DatosDataContext dc = new DatosDataContext();
         dc.DeshabilitarEmpleado(IdEmpleado);
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
예제 #29
0
 public List <ConsultarGradoResult> ConsultarGrado()
 {
     try
     {
         DatosDataContext            db    = new DatosDataContext();
         List <ConsultarGradoResult> datos = db.ConsultarGrado().ToList();
         return(datos);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
예제 #30
0
 public List <ConsultarActivoResult> ConsultarActivo()
 {
     try
     {
         DatosDataContext             dc   = new DatosDataContext();
         List <ConsultarActivoResult> data = dc.ConsultarActivo().ToList();
         return(data);
     }
     catch (Exception ex)
     {
         throw;
     }
 }