Exemplo n.º 1
0
        public int mantenimientoMateria(E_materia mat, int num)
        {
            try
            {
                materia _mat = new materia();
                var     resp = (from dato in db.empleados
                                where dato.usuario == mat._usuarioEmple
                                select dato.rol).FirstOrDefault();

                if (resp.ToString() == "2")
                {
                    if (num != -1)
                    {
                        _mat = db.materias.Where(val => val.codigo == mat._codigo).Single <materia>();
                    }

                    _mat.codigo       = mat._codigo;
                    _mat.nombreM      = mat._nombre;
                    _mat.usuarioEmple = mat._usuarioEmple;

                    if (num == -1)
                    {
                        _mat.estado = 1;
                        db.materias.InsertOnSubmit(_mat);
                    }
                    db.SubmitChanges();
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
Exemplo n.º 2
0
 private void detach_materias(materia entity)
 {
     this.SendPropertyChanging();
     entity.empleado = null;
 }
Exemplo n.º 3
0
 private void attach_materias(materia entity)
 {
     this.SendPropertyChanging();
     entity.empleado = this;
 }
Exemplo n.º 4
0
 partial void Deletemateria(materia instance);
Exemplo n.º 5
0
 partial void Updatemateria(materia instance);
Exemplo n.º 6
0
 partial void Insertmateria(materia instance);