Beispiel #1
0
        public void Insertar(DETALLE_VENTA P)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                ct.DETALLE_VENTA.Add(P);
                ct.SaveChanges();
            }
            catch (Exception e)
            {
                
                throw e; 
            }

        }
Beispiel #2
0
        public void Insertar(ASIENTO_EVENTO P)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                ct.ASIENTO_EVENTO.Add(P);
                ct.SaveChanges();
            }
            catch (Exception e)
            {
                
                throw e;
            }

        }
Beispiel #3
0
        public int Insertar(TIPOEMPLEADO P)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                ct.TIPOEMPLEADO.Add(P);
                ct.SaveChanges();
                return P.CTipoEmpleado;
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #4
0
        public int Insertar(TIPO_ASIENTO P)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                ct.TIPO_ASIENTO.Add(P);
                ct.SaveChanges();
                return P.CTipoAsiento;
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #5
0
        public int Insertar(EVENTO P)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                ct.EVENTO.Add(P);
                ct.SaveChanges();
                return P.CEvento;
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #6
0
        public int Insertar(USUARIO P)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                ct.USUARIO.Add(P);
                ct.SaveChanges();
                return P.CUsuario;
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #7
0
        public int Insertar(VENTA P)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                ct.VENTA.Add(P);
                ct.SaveChanges();
                return P.CVenta;
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #8
0
        public List<VENTA> Leer()
        {
            try
            {
                ContextoDB ct = new ContextoDB();

                return ct.VENTA.ToList();
            }
            catch (Exception ex)
            {

                throw ex;
            }



        }
Beispiel #9
0
        public List<DETALLE_VENTA> Leer()
        {
            try
            {
                ContextoDB ct = new ContextoDB();

                return ct.DETALLE_VENTA.ToList();
            }
            catch (Exception e)
            {
                
                throw e;
            }



        }
Beispiel #10
0
        public List<TIPO_ASIENTO> Leer()
        {
            try
            {
                ContextoDB ct = new ContextoDB();

                return ct.TIPO_ASIENTO.ToList();
            }
            catch (Exception ex)
            {

                throw ex;
            }



        }
Beispiel #11
0
        public List<ASIENTO_EVENTO> Leer()
        {
            try
            {
                ContextoDB ct = new ContextoDB();

                return ct.ASIENTO_EVENTO.ToList();
            }
            catch (Exception e)
            {
                
                throw e;
            }



        }
Beispiel #12
0
        public int Insertar(CLIENTE P, USUARIO P2)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                ct.USUARIO.Add(P2);
                P.CCliente = P2.CUsuario;
                ct.CLIENTE.Add(P);
                ct.SaveChanges();
                return P.CCliente;
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #13
0
        public dynamic Leer()
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                var empleado = (from s in ct.USUARIO
                                join sa in ct.EMPLEADO on s.CUsuario equals sa.CEmpleado                               
                                select s).ToList();
                return empleado;
            }
            catch (Exception ex)
            {

                throw ex;
            }


        }
Beispiel #14
0
        public dynamic Leer()
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                var cliente = (from s in ct.USUARIO
                               join sa in ct.CLIENTE on s.CUsuario equals sa.CCliente
                                select s).ToList();
                return cliente;
            }
            catch (Exception ex)
            {

                throw ex;
            }


        }
Beispiel #15
0
        public int Insertar(EMPLEADO P,USUARIO P2)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                ct.USUARIO.Add(P2);
                P.CEmpleado = P2.CUsuario;
                ct.EMPLEADO.Add(P);
                ct.SaveChanges();
                return P.CEmpleado;
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #16
0
        public void Eliminar(int CEvento)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                EVENTO EVENTO = ct.EVENTO.Where(x => x.CEvento == CEvento).SingleOrDefault();
                if (EVENTO != null)
                {
                    ct.EVENTO.Remove(EVENTO);
                    ct.SaveChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #17
0
        public void Eliminar(int CTipoAsiento)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                TIPO_ASIENTO TIPO_ASIENTO = ct.TIPO_ASIENTO.Where(x => x.CTipoAsiento == CTipoAsiento).SingleOrDefault();
                if (TIPO_ASIENTO != null)
                {
                    ct.TIPO_ASIENTO.Remove(TIPO_ASIENTO);
                    ct.SaveChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #18
0
        public void Eliminar(int CUsuario)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                USUARIO USUARIO = ct.USUARIO.Where(x => x.CUsuario == CUsuario).SingleOrDefault();
                if (USUARIO != null)
                {
                    ct.USUARIO.Remove(USUARIO);
                    ct.SaveChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #19
0
        public void Eliminar(int CTipoEmpleado)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                TIPOEMPLEADO TIPOEMPLEADO = ct.TIPOEMPLEADO.Where(x => x.CTipoEmpleado == CTipoEmpleado).SingleOrDefault();
                if (TIPOEMPLEADO != null)
                {
                    ct.TIPOEMPLEADO.Remove(TIPOEMPLEADO);
                    ct.SaveChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #20
0
        public void Eliminar(int CVenta)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                VENTA VENTA = ct.VENTA.Where(x => x.CVenta == CVenta).SingleOrDefault();
                if (VENTA != null)
                {
                    ct.VENTA.Remove(VENTA);
                    ct.SaveChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #21
0
        public void Actualizar(VENTA P)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                VENTA VENTA = ct.VENTA.Where(x => x.CVenta == P.CVenta).SingleOrDefault();

                if (VENTA != null)
                {
                    ct.Entry(VENTA).CurrentValues.SetValues(P);
                    ct.SaveChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #22
0
        public void Actualizar(TIPOEMPLEADO P)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                TIPOEMPLEADO TIPOEMPLEADO = ct.TIPOEMPLEADO.Where(x => x.CTipoEmpleado == P.CTipoEmpleado).SingleOrDefault();

                if (TIPOEMPLEADO != null)
                {
                    ct.Entry(TIPOEMPLEADO).CurrentValues.SetValues(P);
                    ct.SaveChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #23
0
        public void Actualizar(TIPO_ASIENTO P)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                TIPO_ASIENTO TIPO_ASIENTO = ct.TIPO_ASIENTO.Where(x => x.CTipoAsiento == P.CTipoAsiento).SingleOrDefault();

                if (TIPO_ASIENTO != null)
                {
                    ct.Entry(TIPO_ASIENTO).CurrentValues.SetValues(P);
                    ct.SaveChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #24
0
        public void Actualizar(USUARIO P)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                USUARIO USUARIO = ct.USUARIO.Where(x => x.CUsuario == P.CUsuario).SingleOrDefault();

                if (USUARIO != null)
                {
                    ct.Entry(USUARIO).CurrentValues.SetValues(P);
                    ct.SaveChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }
Beispiel #25
0
        public void Eliminar(int CAsiento, int CVenta)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                DETALLE_VENTA DETALLE_VENTA = (from x in ct.DETALLE_VENTA
                                               where x.CASiento == CAsiento && x.CVenta == CVenta
                                               select x).FirstOrDefault();
                if (DETALLE_VENTA != null)
                {
                    ct.DETALLE_VENTA.Remove(DETALLE_VENTA);
                    ct.SaveChanges();
                }
            }
            catch (Exception e)
            {
                
                throw e;
            }

        }
Beispiel #26
0
        public void Eliminar(int CAsiento,int CEvento)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                ASIENTO_EVENTO ASIENTO_EVENTO = (from x in ct.ASIENTO_EVENTO
                                                 where x.CASiento == CAsiento && x.CEvento == CEvento
                                                 select x).FirstOrDefault();
                if (ASIENTO_EVENTO != null)
                {
                    ct.ASIENTO_EVENTO.Remove(ASIENTO_EVENTO);
                    ct.SaveChanges();
                }
            }
            catch (Exception e)
            {
                
                throw e;
            }

        }
Beispiel #27
0
        public void Actualizar(ASIENTO_EVENTO P)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                ASIENTO_EVENTO ASIENTO_EVENTO = (from x in ct.ASIENTO_EVENTO
                                                 where x.CASiento == P.CASiento && x.CEvento == P.CEvento
                                                 select x).FirstOrDefault();

                if (ASIENTO_EVENTO != null)
                {
                    ct.Entry(ASIENTO_EVENTO).CurrentValues.SetValues(P);
                    ct.SaveChanges();
                }
            }
            catch (Exception e)
            {
                
                throw e;
            }

        }
Beispiel #28
0
        public void Actualizar(DETALLE_VENTA P)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                DETALLE_VENTA DETALLE_VENTA = (from x in ct.DETALLE_VENTA
                                               where x.CASiento == P.CASiento && x.CVenta == P.CVenta
                                               select x).FirstOrDefault();

                if (DETALLE_VENTA != null)
                {
                    ct.Entry(DETALLE_VENTA).CurrentValues.SetValues(P);
                    ct.SaveChanges();
                }
            }
            catch (Exception e)
            {
                
                throw e;
            }

        }
Beispiel #29
0
        public dynamic Leer()
        {
            try
            {
                ContextoDB ct = new ContextoDB();

                var usuarios = (from s in ct.USUARIO
                                join sa in ct.EMPLEADO on s.CUsuario equals sa.CEmpleado
                                join so in ct.CLIENTE on s.CUsuario equals so.CCliente
                                select s).ToList();

                return usuarios;
            }
            catch (Exception ex)
            {

                throw ex;
            }



        }
Beispiel #30
0
        public void Actualizar(EMPLEADO P, USUARIO P2)
        {
            try
            {
                ContextoDB ct = new ContextoDB();
                USUARIO USUARIO = ct.USUARIO.Where(x => x.CUsuario == P2.CUsuario).SingleOrDefault();
                EMPLEADO EMPLEADO = ct.EMPLEADO.Where(x => x.CEmpleado == P.CEmpleado).SingleOrDefault();                
                if (EMPLEADO != null && USUARIO!=null)
                {
                   
                    ct.Entry(EMPLEADO).CurrentValues.SetValues(P);
                    ct.Entry(USUARIO).CurrentValues.SetValues(P2);
                    ct.SaveChanges();
                }
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }