예제 #1
0
파일: busEmpleado.cs 프로젝트: dambert/Repo
        public void Actualizar(EMPLEADO P, USUARIO P2)
        {
            try
            {
                new DatEmpleado().Actualizar(P,P2);
            }
            catch (Exception e)
            {

                throw e;
            }

        }
예제 #2
0
파일: busEmpleado.cs 프로젝트: dambert/Repo
        public int Insertar(EMPLEADO P, USUARIO P2)
        {
            try
            {
                return new DatEmpleado().Insertar(P,P2);
            }
            catch (Exception e)
            {

                throw e;
            }

        }
예제 #3
0
파일: DatEmpleado.cs 프로젝트: dambert/Repo
        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;
            }

        }
예제 #4
0
파일: DatEmpleado.cs 프로젝트: dambert/Repo
        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;
            }

        }