Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (this.user.IsTeacher)
                {
                    Response.Redirect("~/AdviseeCommentReview.aspx");
                }
                using (WebhostEntities db = new WebhostEntities())
                {
                    int        sid     = this.user.ID;
                    Student    student = db.Students.Where(s => s.ID == sid).Single();
                    List <int> termIds = new List <int>();
                    foreach (StudentComment comment in student.StudentComments.ToList())
                    {
                        if (!termIds.Contains(comment.CommentHeader.TermIndex) && comment.CommentHeader.Term.CommentsDate < DateTime.Today)
                        {
                            termIds.Add(comment.CommentHeader.TermIndex);
                        }
                    }

                    TermSelect.DataSource     = TermListItem.GetDataSource(termIds);
                    TermSelect.DataTextField  = "Text";
                    TermSelect.DataValueField = "ID";
                    TermSelect.DataBind();

                    ClassSelect.Enabled            = false;
                    ReadonlyCommentViewer1.Visible = false;
                }
            }
        }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         using (WebhostEntities db = new WebhostEntities())
         {
             TermSelect.DataSource = (from term in db.Terms
                                      orderby term.StartDate descending
                                      select new
             {
                 Text = term.Name + " " + term.StartDate.Year,
                 ID = term.id
             }).ToList();
             TermSelect.DataTextField  = "Text";
             TermSelect.DataValueField = "ID";
             TermSelect.DataBind();
         }
     }
 }