protected void CreateCourseDialog_OkButtonClicked(object sender, EventArgs e) { Page.Validate("create_course"); if (this.Page.IsValid) { CourseInfo entity = new CourseInfo(); entity.Title = TitleTextBox.Text; entity.Description = DescriptionTextBox.Value; entity.CreatedTimestamp = DateTime.Now; entity.UpdatedTimestamp = DateTime.Now; entity.Visible = VisibleCheckBox.Checked; //bool result = ClassroomController.InsertCourse(ref entity); bool result = CourseInfo.InsertCourse(ref entity); if (result) { DataBind(); OnCourseCreated(EventArgs.Empty); entity = null; Response.Redirect("~/Admin/Classroom/Default.aspx"); } } else { ValidationHelper.SetFocusToFirstError(this.Page, "create_course"); } }
/// <summary> /// Inserts a course into the database /// </summary> /// <param name="entity"></param> /// <returns></returns> public static bool InsertCourse(ref CourseInfo entity) { DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString); cmd.CommandText = "dbo.mon_elrn_INSERT_COURSE"; cmd.AddInputParam("@Title", DbType.AnsiString, entity.Title); cmd.AddInputParam("@Description", DbType.AnsiString, entity.Description); cmd.AddInputParam("@Visible", DbType.Boolean, entity.Visible); cmd.AddInputParam("@CreatedTimestamp", DbType.DateTime, entity.CreatedTimestamp); cmd.AddInputParam("@UpdatedTimestamp", DbType.DateTime, entity.UpdatedTimestamp); cmd.AddInputParam("@ImageXml", DbType.String, entity.ImageXml); cmd.AddInputParam("@InstructorID", DbType.Int32, entity.InstructorID); cmd.AddInputParam("@ApplicationName", DbType.String, System.Web.Security.Membership.Provider.ApplicationName); cmd.AddInputParam("@ShortDescription", DbType.String, entity.ShortDescription); int result; try { result = Convert.ToInt32(SqlHelpers.ExecuteScalar(cmd)); if (result > 0) return true; else return false; } catch (Exception ex) { throw ex; } }
protected void CreateCourseDialog_OkButtonClicked(object sender, EventArgs e) { DescriptionCustomValidator.Validate(); if (Page.IsValid) { CourseInfo entity = new CourseInfo(); entity.Title = TitleTextBox.Text; entity.Description = hdnMain.Value; entity.CreatedTimestamp = DateTime.Now; entity.UpdatedTimestamp = DateTime.Now; entity.Visible = VisibleCheckBox.Checked; entity.InstructorID = Convert.ToInt32(InstructorDropDown.SelectedValue); if (ShortDescriptionTextBox.Value.Length > 250) entity.ShortDescription = ShortDescriptionTextBox.Value.Substring(0, 250).Trim(); else entity.ShortDescription = ShortDescriptionTextBox.Value; bool result = CourseInfo.InsertCourse(ref entity); if (result) { CreateCourseDialog.Reset(); DataBind(); OnCourseCreated(EventArgs.Empty); entity = null; } } else { ValidationHelper.SetFocusToFirstError(this.Page, "create_course"); } }
protected void Page_Load(object sender, EventArgs e) { if (CourseID != null) _course = CourseInfo.GetCourse((int)CourseID); DataBind(); }
protected void Page_Load(object sender, EventArgs e) { //ImFinishedButton.Click += new EventHandler(ImFinishedButton_Click); if (!IsPostBack) { //this.BindPage(); } this.BindPage(); /* Show appropriate image according to user workbook status */ if (WorkbookCompleted(WorkbookId)) { WorkbookStatusDiv.Attributes.Add("class", "classProgressIcon item48 tasks48complete"); WorkbookStatusTitleDiv.Attributes.Add("class", "classProgressIcon item48 tasks48complete"); divCompleteStatus.Style.Add("Display", "block"); divIncompleteStatus.Style.Add("Display", "none"); //ImFinishedButton.Text = "I'll Finish Later"; } else { WorkbookStatusDiv.Attributes.Add("class", "classProgressIcon item48 tasks48"); WorkbookStatusTitleDiv.Attributes.Add("class", "classProgressIcon item48 tasks48"); divIncompleteStatus.Style.Add("Display", "block"); divCompleteStatus.Style.Add("Display", "none"); //ImFinishedButton.Text = "I'm Finished"; } /* Binding Class & course info */ if (this.ClassID > 0) { // get the class _selectedClass = ClassroomController.GetClass(this.ClassID); // get the course //_selectedCourse = ClassroomController.GetCourse(_selectedClass.CourseId); _selectedCourse = CourseInfo.GetCourse(_selectedClass.CourseId); // get sku of user enrollment for course UserEnrollment u = new UserEnrollment(); u = (UserEnrollment)ClassroomController.GetUserEnrollmentByCourse(_selectedClass.CourseId, this.UserId)[0]; ; _courseSku = u.SKU; DataBind(); } ///* Assignin navigate url to go back to class detail */ //if (SelectedWorkbook != null) // lnkBack.NavigateUrl = "~/Classroom/Class.aspx?id=" + SelectedWorkbook.ClassID; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.BindPage(); ViewState["ClassID"] = _entity.ClassId.ToString(); /* Show appropriate image according to user audio status */ if (AudioCompleted(AudioId)) { AudioStatusDiv.Attributes.Add("class", "classProgressIcon item48 audio48complete"); //FinishedListeningButton.Text = "I'll Finish Later"; } else { AudioStatusDiv.Attributes.Add("class", "classProgressIcon item48 audio48"); //FinishedListeningButton.Text = "I'm Finished Listening"; } /* Binding Class & course info */ if (this.ClassID > 0) { // get the class _selectedClass = ClassroomController.GetClass(this.ClassID); // get the course //_selectedCourse = ClassroomController.GetCourse(_selectedClass.CourseId); _selectedCourse = CourseInfo.GetCourse(_selectedClass.CourseId); // get sku of user enrollment for course Monaco.ELearning.Entities.UserEnrollment u = new Monaco.ELearning.Entities.UserEnrollment(); u = (Monaco.ELearning.Entities.UserEnrollment)ClassroomController.GetUserEnrollmentByCourse(_selectedClass.CourseId, this.UserId)[0]; ; _courseSku = u.SKU; DataBind(); } } /* Assignin navigate url to go back to class detail */ if (SelectedAudio != null) lnkBack.NavigateUrl = "~/Classroom/Class.aspx?id=" + SelectedAudio.ClassId; }
/// <summary> /// Updates an existing course /// </summary> /// <param name="entity"></param> /// <returns></returns> public static bool UpdateCourse(CourseInfo entity) { DbCommand cmd = SqlHelpers.CreateCommand(DataHelpers.ConnectionString); cmd.CommandText = "dbo.mon_elrn_UPDATE_COURSE"; cmd.AddInputParam("@Id", DbType.Int32, entity.Id); cmd.AddInputParam("@Title", DbType.AnsiString, entity.Title); cmd.AddInputParam("@Description", DbType.AnsiString, entity.Description); cmd.AddInputParam("@Visible", DbType.Boolean, entity.Visible); cmd.AddInputParam("@ImageXml", DbType.String, entity.ImageXml); cmd.AddInputParam("@InstructorID", DbType.Int32, entity.InstructorID); cmd.AddInputParam("@ShortDescription", DbType.String, entity.ShortDescription); try { Convert.ToBoolean(SqlHelpers.ExecuteNonQuery(cmd)); } catch (Exception ex) { //throw; } return false; }
protected void Page_Load(object sender, EventArgs e) { //FinishedWatchingButton.Click += new EventHandler(FinishedWatchingButton_Click); this.BindPage(); if (!IsPostBack) { //this.BindPage(); ViewState["ClassID"] = _entity.ClassId.ToString(); } /* Show appropriate image according to user video status */ if (VideoCompleted(VideoId)) { VideoStatusDiv.Attributes.Add("class", "classProgressIcon item48 video48complete"); VideoStatusTitleDiv.Attributes.Add("class", "classProgressIcon item48 video48complete"); divCompleteStatus.Style.Add("Display", "block"); divIncompleteStatus.Style.Add("Display", "none"); //FinishedWatchingButton.Text = "I'll Finish Later"; } else { VideoStatusDiv.Attributes.Add("class", "classProgressIcon item48 video48"); VideoStatusTitleDiv.Attributes.Add("class", "classProgressIcon item48 video48"); divIncompleteStatus.Style.Add("Display", "block"); divCompleteStatus.Style.Add("Display", "none"); //FinishedWatchingButton.Text = "I'm Finished Watching"; } /* Assignin navigate url to go back to class detail */ if (SelectedVideo != null) //lnkBack.NavigateUrl = "~/Classroom/Class.aspx?id=" + SelectedVideo.ClassId; /* Binding Class & course info */ if (this.ClassID > 0) { // get the class _selectedClass = ClassroomController.GetClass(this.ClassID); // get the course //_selectedCourse = ClassroomController.GetCourse(_selectedClass.CourseId); _selectedCourse = CourseInfo.GetCourse(_selectedClass.CourseId); // get sku of user enrollment for course Monaco.ELearning.Entities.UserEnrollment u = new Monaco.ELearning.Entities.UserEnrollment(); u = (Monaco.ELearning.Entities.UserEnrollment)ClassroomController.GetUserEnrollmentByCourse(_selectedClass.CourseId, this.UserId)[0]; ; _courseSku = u.SKU; DataBind(); } }
private void BindDialog() { //_entity = ClassroomController.GetCourse(this.Id); _entity = CourseInfo.GetCourse(this.Id); }
protected void Page_Load(object sender, EventArgs e) { //acrdnClass.ItemDataBound += new EventHandler<AjaxControlToolkit.AccordionItemEventArgs>(acrdnClass_ItemDataBound); if (!IsPostBack) { if (this.ClassID > 0) { // get the class _selectedClass = ClassroomController.GetClass(this.ClassID); // get the course //_selectedCourse = ClassroomController.GetCourse(_selectedClass.CourseId); _selectedCourse = CourseInfo.GetCourse(_selectedClass.CourseId); // get sku of user enrollment for course UserEnrollment u = new UserEnrollment(); u = (UserEnrollment)ClassroomController.GetUserEnrollmentByCourse(_selectedClass.CourseId, this.UserId)[0]; ; _courseSku = u.SKU; DataBind(); } } }
public void GetCourseDetailsById() { //_entity = ClassroomController.GetCourse(this.Id); _entity = CourseInfo.GetCourse(this.Id); }