protected void CreateClassPageDialog_OkButtonClicked(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            if (this.ClassId > 0)
            {
                ClassPageInfo entity = new ClassPageInfo();
                entity.ClassId = this.ClassId;
                entity.Title = TitleTextBox.Text;
                entity.Content = hdnMain.Value;
                entity.Visible = VisibleCheckBox.Checked;
                entity.CreatedBy = Context.User.Identity.Name.ToString();
                entity.UpdatedBy = Context.User.Identity.Name.ToString();

                entity.Save();
                CreateClassPageDialog.Reset();
                DataBind();
                OnPageCreated(EventArgs.Empty);
                entity = null;
                //if (result)
                //{
                //    CreateClassPageDialog.Reset();
                //    DataBind();
                //    OnPageCreated(EventArgs.Empty);
                //    entity = null;
                //}
            }
        }
        else
        {
            ValidationHelper.SetFocusToFirstError(this.Page, "create_page");
        }
    }
 protected void ChangeTitleDialog_OkButtonClick(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         if (this.PageId > 0)
         {
             _entity = ClassPageInfo.Load(this.PageId);
             _entity.Title = TitleTextBox.Text;
             _entity.LastEditDate = DateTime.Now;
             UpdatePageEntity();
             TitleUpdatePanel.Update();
         }
     }
     else
     {
         ValidationHelper.SetFocusToFirstError(this.Page, "change_title");
     }
 }
 protected void DeleteClassPageButton_Click(object sender, EventArgs e)
 {
     ClassPageInfo.DeleteClassPage(this.PageId, 0);
     Response.Redirect("ClassPages.aspx?ClassId=" + Convert.ToInt32(ViewState["ClassId"]));
     _entity = null;
 }
 private void BindDialog()
 {
     _entity = ClassPageInfo.Load(this.PageId);
     ViewState["ClassId"] = _entity.ClassId;
 }
示例#5
0
        public static ClassPageInfo SaveClassPage(ClassPageInfo info)
        {
            DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString, "dbo.mon_elrn_CLASS_PAGE_SAVE");

            try
            {
                cmd.AddInputParam("@PageId", DbType.Int16, info.PageId );
                cmd.AddInputParam("@ClassId", DbType.Int16, info.ClassId );
                cmd.AddInputParam("@Title", DbType.String, info.Title );
                cmd.AddInputParam("@Visible", DbType.Boolean, info.Visible );
                cmd.AddInputParam("@Contents", DbType.String, info.Content);
                cmd.AddInputParam("@CreatedBy", DbType.String, info.CreatedBy);
                cmd.AddInputParam("@UpdatedBy", DbType.String, info.UpdatedBy);
                

                return cmd.ExecuteSelectTable().Rows[0].ToClassPageInfo();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#6
0
    private void BindPages()
    {
        List<ClassPageInfo> pageInfoList = new List<ClassPageInfo>();
        pageInfoList = ClassPageInfo.LoadPagesByClass(this.ClassID);

        if (pageInfoList.Count > 1)
        {
            // there are pages to display
            PageRepeter.DataSource = pageInfoList;
           
            if (this.PageOrder == 1)
            {
                // show the table of contents on page 1
                TableOfContentRepeter.DataSource = pageInfoList;
                TableOfContentRepeter.Visible = true;
            }
            else
            {
                // hide table of contents if not page 1
                TableOfContentRepeter.Visible = false;
            }
        }

        if (pageInfoList.Count > 0)
        {
            // get current page information. 
            _selectedPage = pageInfoList[this.PageOrder - 1];
        }
        else
        {
            /* if there is no page aailable display blank page */
            _selectedPage = new ClassPageInfo();
            _selectedPage.Visible = true;
        }

        try
        {
            _maxPageNo = pageInfoList.Count;
        }
        catch (ArgumentOutOfRangeException ex)
        {
            litDescription.Text = "<p>You can complete the assignments on the right.</p>";
        }
    }