/// <summary> /// Handles the Click event of the btnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e"> /// The <see cref="EventArgs" /> instance containing the event data. /// </param> protected void btnSave_Click(object sender, EventArgs e) { try { var oRoleController = new RoleController(); var oInfo = new QuizInfo { QuizId = _quizId, ModuleId = ModuleId, QuizTitle = txtQuizTitle.Text, RoleName = ddlViewRole.SelectedValue, RoleId = oRoleController.GetRoleByName(PortalId, ddlViewRole.SelectedValue) .RoleID, PassPercentage = decimal.Parse(ddlPassPercentage.SelectedValue), IsPublished = chkIsPublished.Checked, CanExpire = chkExpires.Checked, RoleToAdd = ddlAddRole.SelectedValue, AllowRetake = chkAllowRetake.Checked }; oInfo.ExpireDuration = oInfo.CanExpire ? int.Parse(txtExpireDuration.Text) : 0; var quizId = QuizController.SaveQuiz(oInfo); //Redirect Response.Redirect(EditUrl("quizId", quizId.ToString(), "Edit", "saved=y")); } catch (Exception ex) { Exceptions.ProcessModuleLoadException(this, ex); } }
/// <summary> /// Saves the quiz. /// </summary> /// <param name="oInfo">The o info.</param> /// <returns></returns> public static int SaveQuiz(QuizInfo oInfo) { return DataProvider.Instance().SaveQuiz(oInfo.QuizId, oInfo.ModuleId, oInfo.QuizTitle, oInfo.RoleName, oInfo.RoleId, oInfo.PassPercentage, oInfo.IsPublished, oInfo.CanExpire, oInfo.ExpireDuration, oInfo.RoleToAdd, oInfo.AllowRetake); }