예제 #1
0
        public int InsertaMatricula(E_matricula matricula)
        {
            matricula mat  = new matricula();
            string    resp = "";
            var       txt  = (from dato in db.matriculas
                              where dato.codigoMateria == matricula._codigoMat && dato.usuarioEst == matricula._usuEst
                              select dato.numero).FirstOrDefault();

            resp = txt.ToString();
            if (resp != "" || resp != null)
            {
                var txt2 = (from dato2 in db.matriculas
                            where dato2.codigoMateria == matricula._codigoMat
                            select dato2.codigoMateria).Count();
                int total = Convert.ToInt32(txt2);

                if (total < 35)
                {
                    mat.codigoMateria = matricula._codigoMat;
                    mat.usuarioEst    = matricula._usuEst;
                    db.matriculas.InsertOnSubmit(mat);
                    db.SubmitChanges();
                    return(1); //exito
                }
                else
                {
                    return(3); //no hay cupo
                }
            }
            else
            {
                return(4);//ya se encuentra matriculado
            }
        }
예제 #2
0
 private void btn_busMatM_Click(object sender, EventArgs e)
 {
     try
     {
         E_materia _mat = new E_materia();
         _mat = _matricula.ObtenerMat(Convert.ToInt32(txt_busMatM.Text));
         if (_mat == null)
         {
             MessageBox.Show("No existe el registro.");
         }
         else
         {
             txt_codMatM.Text  = _mat._codigo.ToString();
             txt_nomMatM.Text  = _mat._nombre;
             txt_usuProfM.Text = _mat._usuarioEmple;
         }
     }
     catch (Exception)
     {
         MessageBox.Show("No existe el registro.");
     }
 }
예제 #3
0
 public int insertaMatricula(E_matricula mat)
 {
     return(_matri.InsertaMatricula(mat));
 }