Ejemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="StudentData"></param>
 public void InsertHorario(Horario HorarioData)
 {
     try
     {
         using (TableContext HT = new TableContext(ConnectionString))
         {
             Horario horario = new Horario();
             horario.Matricula = HorarioData.Matricula;
             horario.Dia       = HorarioData.Dia;
             horario.Entrada   = HorarioData.Entrada;
             horario.Salida    = HorarioData.Salida;
             HT.Horarios.InsertOnSubmit(horario);
             HT.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
         Exception ex2 = ex;
         while (ex2.InnerException != null)
         {
             ex2 = ex2.InnerException;
         }
         throw;
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="StudentData"></param>
 public void UpdateHorario(Horario HorarioData)
 {
     using (TableContext HT = new TableContext(ConnectionString))
     {
         var horario = (from Row in HT.Horarios where Row.Matricula == HorarioData.Matricula select Row).FirstOrDefault();
         horario.Matricula = HorarioData.Matricula;
         HT.SubmitChanges();
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="HorarioData"></param>
        public void DeleteHorario(Horario HorarioData)
        {
            using (TableContext HT = new TableContext(ConnectionString))
            {
                var student = (from Row in HT.Horarios
                               where Row.Matricula == HorarioData.Matricula
                               & Row.Dia == HorarioData.Dia
                               & Row.Entrada == HorarioData.Entrada
                               & Row.Salida == HorarioData.Salida
                               select Row).FirstOrDefault();

                if (student != null)
                {
                    HT.Horarios.DeleteOnSubmit(student);
                    HT.SubmitChanges();
                }
            }
        }