예제 #1
0
        public async Task PerfilEmpl(int idEmpl, int idProy, int idPerf)
        {
            if (_context.PerfilEmpleado.Any(x => x.PerfilEmpleadoIdEmpleado == idEmpl &&
                                            x.ProyectoIdProyecto == idProy))
            {
                throw new AppException("El empleado " + idEmpl + " ya tiene tarea asignada para el mismo proyecto.");
            }
            // GENERO PERFIL-EMPLEADO
            PerfilEmpleado aux = new PerfilEmpleado
            {
                PerfilEmpleadoIdEmpleado = idEmpl,
                ProyectoIdProyecto       = idProy,
                PerfilEmpleadoIdPerfil   = idPerf
            };

            _context.PerfilEmpleado.Add(aux);
            // GENERO EMPLEADO-PROYECTO
            EmpleadoProyecto empPro = new EmpleadoProyecto
            {
                IdEmpleado = idEmpl,
                IdProyecto = idProy
            };

            _context.EmpleadoProyecto.Add(empPro);
            await _context.SaveChangesAsync();
        }
예제 #2
0
        private void ObjectSpace_Committing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            EmpleadoProyecto obj = View.CurrentObject as EmpleadoProyecto;

            if (View.ObjectSpace.IsNewObject(obj))
            {
                Negocio.GrabaEmpleadoProyecto(obj);
            }
        }
예제 #3
0
        protected override void OnViewControlsCreated()
        {
            base.OnViewControlsCreated();
            // Access and customize the target View control.

            if (View is DetailView)
            {
                EmpleadoProyecto obj = View.CurrentObject as EmpleadoProyecto;
                if (View.ObjectSpace.IsNewObject(obj))
                {
                    Negocio.IniciaEmpleadoProyecto(obj);
                }
            }
        }