Beispiel #1
0
        public static void Eliminar(int clienteId)
        {
            var db = new Parcial2Db();

            Clientes cliente = Buscar(clienteId);

            db.Entry(cliente).State = EntityState.Deleted;
            db.SaveChanges();
        }
Beispiel #2
0
        public static void Modificar(Clientes cliente)
        {
            var db = new Parcial2Db();

            db.Entry(cliente).State = EntityState.Modified;
            db.SaveChanges();
            Lista = ClientesBLL.GetLista();
            Lista = GetLista();
        }
        public static void Eliminar(int TipoId)
        {
            var db = new Parcial2Db();

            TiposTelefonos telefono = Buscar(TipoId);

            db.Entry(telefono).State = EntityState.Deleted;
            db.SaveChanges();
        }
        public static bool Eliminar(int ID)
        {
            bool     retorno = false;
            var      db      = new Parcial2Db();
            Clientes cliente = Buscar(ID);

            if (cliente != null)
            {
                db.Entry(cliente).State = EntityState.Deleted;
                db.SaveChanges();
                retorno = true;
            }
            return(retorno);
        }
 public static void Insertar(PresupuestoDetalle pd)
 {
     try
     {
         Parcial2Db db = new Parcial2Db();
         db.detalle.Add(pd);
         db.SaveChanges();
         db.Dispose();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public static void Guardar(TiposEmails em)
 {
     try
     {
         Parcial2Db db = new Parcial2Db();
         db.Tipos.Add(em);
         db.SaveChanges();
         db.Dispose();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #7
0
 public static void Guardar(Empleados em)
 {
     try
     {
         Parcial2Db db = new Parcial2Db();
         db.empleado.Add(em);
         db.SaveChanges();
         db.Dispose();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public static bool Guardar(Clientes c)
        {
            bool retorno = false;

            try
            {
                Parcial2Db db = new Parcial2Db();
                db.Cliente.Add(c);
                db.SaveChanges();
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
        public static bool Guardar(TiposTelefonos TiposTelefono)
        {
            bool retorno = false;

            try
            {
                var db = new Parcial2Db();
                db.TiposTelefono.Add(TiposTelefono);
                db.SaveChanges();
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }

            return(retorno);
        }
        public static bool Guardar(ClientesTelefonos ct)
        {
            bool retorno = false;

            try
            {
                using (var db = new Parcial2Db())
                {
                    db.ClienteTelefono.Add(ct);
                    db.SaveChanges();
                    retorno = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Beispiel #11
0
        public static bool Insertar(Clientes nuevo)
        {
            bool retorno = false;

            using (var db = new Parcial2Db())
            {
                try
                {
                    db.Cliente.Add(nuevo);
                    db.SaveChanges();
                    retorno = true;
                }
                catch (Exception)
                {
                    throw;
                }
                return(retorno);
            }
        }
Beispiel #12
0
        public static Clientes Eliminar(int id)
        {
            var cliente = new Clientes();

            using (var db = new Parcial2Db())
            {
                try
                {
                    cliente = db.Cliente.Find(id);
                    db.Cliente.Remove(cliente);
                    db.SaveChanges();
                }
                catch (Exception)
                {
                    throw;
                }
                return(cliente);
            }
        }
Beispiel #13
0
        public static bool Eliminar(TiposTelefonos tipoTelefono)
        {
            bool resultado = false;

            using (var conexion = new Parcial2Db())
            {
                try
                {
                    conexion.TipoTelefono.Remove(tipoTelefono);
                    conexion.SaveChanges();
                    resultado = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(resultado);
        }
        public static bool Eliminar(int id)
        {
            bool retorno = false;

            try
            {
                using (Parcial2Db db = new Parcial2Db())
                {
                    Clientes user = (from c in db.Cliente where c.ClienteId == id select c).FirstOrDefault();
                    db.Cliente.Remove(user);
                    db.SaveChanges();
                    retorno = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
        public static bool Guardar(TiposTelefonos telefono)
        {
            bool resultado = false;

            using (var db = new Parcial2Db())
            {
                try
                {
                    db.TipoTefefono.Add(telefono);
                    db.SaveChanges();
                    resultado = true;
                }
                catch (Exception)
                {
                    throw;
                }

                return(resultado);
            }
        }
Beispiel #16
0
        public static bool Eliminar(Clientes cliente)
        {
            bool resultado = false;

            using (var conexion = new Parcial2Db())
            {
                try
                {
                    conexion.Entry(cliente).State = EntityState.Deleted;
                    conexion.SaveChanges();
                    resultado = true;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                    throw;
                }
            }
            return(resultado);
        }
Beispiel #17
0
        public static bool Guardar(Clientes clientes)
        {
            bool resultado = false;

            using (var db = new Parcial2Db())
            {
                try
                {
                    db.Cliente.Add(clientes);
                    db.SaveChanges();
                    resultado = true;
                }
                catch (Exception)
                {
                    throw;
                }

                return(resultado);
            }
        }
Beispiel #18
0
        public static bool Insertar(Clientes c)
        {
            bool retorno = false;

            try
            {
                var db = new Parcial2Db();

                db.Clientes.Add(c);
                db.SaveChanges();
                db.Dispose();

                retorno = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            return(retorno);
        }
 public static bool Guardar(Empleados emp)
 {
     using (var conexion = new Parcial2Db())
     {
         try
         {
             conexion.Empleados.Add(emp);
             foreach (var p in emp.Retenciones)
             {
                 conexion.Entry(p).State = System.Data.Entity.EntityState.Unchanged;
             }
             conexion.SaveChanges();
             return(true);
         }
         catch (Exception)
         {
             throw;
         }
     }
     return(false);
 }
Beispiel #20
0
        public static bool Insertar(TiposTelefonos t)
        {
            bool retorno = false;

            try
            {
                var db = new Parcial2Db();

                db.TiposTelefono.Add(t);
                db.SaveChanges();
                db.Dispose();

                retorno = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            return(retorno);
        }
Beispiel #21
0
        public static bool Guardar(TiposTelefonos t)
        {
            bool retorno = false;

            try
            {
                Parcial2Db db = new Parcial2Db();
                db.TipoTelefono.Add(t);
                foreach (var c in t.Clientes)
                {
                    db.Entry(c).State = System.Data.Entity.EntityState.Unchanged;
                }

                db.SaveChanges();
                retorno = true;
            }
            catch (Exception)
            {
                throw;
            }
            return(retorno);
        }
Beispiel #22
0
        public static bool Insertar(Clientes cliente)
        {
            bool resultado = false;

            using (var conexion = new Parcial2Db())
            {
                try
                {
                    var con = conexion.Cliente.Add(cliente);
                    //foreach (var tipo in cliente.TipoTelefonos)
                    //{
                    //    conexion.Entry(tipo).State = EntityState.Unchanged;
                    //}
                    conexion.SaveChanges();
                    resultado = true;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                    throw;
                }
            }
            return(resultado);
        }