예제 #1
0
        private void OnInsert()
        {
            mdc = new ModelDataContext();
            try
            {
                Model.Turma turma = new Model.Turma();

                turma.idMateria    = int.Parse(tbCodMaterias.Text.Trim());
                turma.Nome         = tbNome.Text.Trim();
                turma.dataCadastro = Convert.ToDateTime(tbDataCadastro.Text.Trim());

                mdc.Turma.InsertOnSubmit(turma);
                mdc.SubmitChanges();

                Response.Redirect("Turma.aspx");
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                mdc.Dispose();
            }
        }
예제 #2
0
        private void PopulateFields(int pGetID = 0)
        {
            mdc = new ModelDataContext();
            try
            {
                if (pGetID > 0)
                {
                    Model.Turma turma = mdc.Turma.First(tur => tur.idTurma == pGetID);

                    tbCodTurma.Text   = pGetID.ToString();
                    tbCodMateria.Text = turma.idMateria.ToString().Trim();
                    tbNome.Text       = turma.Nome.Trim();
                }
                else
                {
                    Response.Redirect("Turma.aspx");
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                mdc.Dispose();
            }
        }
예제 #3
0
        private void OnUpdate()
        {
            mdc = new ModelDataContext();
            try
            {
                Model.Turma turma = mdc.Turma.First(tur => tur.idTurma == int.Parse(tbCodTurma.Text.Trim()));
                turma.idMateria = int.Parse(tbCodMateria.Text.Trim());
                turma.Nome      = tbNome.Text.Trim();

                mdc.SubmitChanges();
                Response.Redirect("Turma.aspx");
            }
            catch (Exception)
            {
            }
            finally
            {
                mdc.Dispose();
            }
        }
예제 #4
0
        private void OnDelete()
        {
            mdc = new ModelDataContext();
            try
            {
                Model.Turma turma = mdc.Turma.First(tur => tur.idTurma == int.Parse(tbCodTurma.Text.Trim()));

                mdc.Turma.DeleteOnSubmit(turma);
                mdc.SubmitChanges();

                Response.Redirect("Turma.aspx");
            }
            catch (Exception)
            {
                Response.Redirect("Turma.aspx");
            }
            finally
            {
                mdc.Dispose();
            }
        }
예제 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         this.PopulateGrid(int.Parse(Request.QueryString["id"]));
         mdc = new ModelDataContext();
         try
         {
             Model.Turma turma     = mdc.Turma.First(tur => tur.idTurma == int.Parse(Request.QueryString["id"]));
             var         turmaDisp = turma.Nome;
             headerTurma.InnerText = "Todas as Notas da Turma " + turmaDisp;
             headerTurma.InnerHtml = "<h1>" + headerTurma.InnerText;
         }
         catch (Exception)
         {
             throw;
         }
         finally
         {
             mdc.Dispose();
         }
     }
 }
예제 #6
0
 private void detach_Turma(Turma entity)
 {
     this.SendPropertyChanging();
     entity.Materia = null;
 }
예제 #7
0
 private void attach_Turma(Turma entity)
 {
     this.SendPropertyChanging();
     entity.Materia = this;
 }
예제 #8
0
 partial void DeleteTurma(Turma instance);
예제 #9
0
 partial void UpdateTurma(Turma instance);
예제 #10
0
 partial void InsertTurma(Turma instance);