protected void LoadData() { var patron = (Patron)Session["Curr_Patron"]; if (Session["PSRID"] != null) { SRID.Text = Session["PSRID"].ToString(); } if (Session["PSRID"] == null && SRID.Text == "") { Response.Redirect("PatronSurveys.aspx"); } Session["PSRID"] = null; var sr = SurveyResults.FetchObject(int.Parse(SRID.Text)); var s = Survey.FetchObject(sr.SID); Name.Text = string.Format("{0} ({1})", s.Name, s.LongName); C.Text = string.Format("{0}", sr.IsComplete.ToYesNo()); S.Text = string.Format("{0}", sr.IsComplete && sr.IsScorable ? sr.Score.ToString() : ""); P.Text = string.Format("{0}", sr.IsComplete && sr.IsScorable ? sr.ScorePct.ToString() : ""); D.Text = string.Format("{0}", sr.IsComplete && sr.IsScorable ? sr.EndDate.ToWidgetDisplayDate() : ""); var ds = DAL.SurveyAnswers.GetAllExpanded(sr.SRID); rptr.DataSource = ds; rptr.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SetPageRibbon(StandardModuleRibbons.SetupRibbon()); SID.Text = Session["SID"] == null ? "" : Session["SID"].ToString(); if (SID.Text == "") { Response.Redirect("SurveyList.aspx"); } var s = Survey.FetchObject(int.Parse(SID.Text)); lblSurvey.Text = string.Format("{0} - {1}", s.Name, s.LongName); var j = Survey.GetNumQuestions(s.SID); for (var i = 1; i <= j; i++) { JumpToQuestion2.Items.Add(i.ToString()); JumpToQuestion4.Items.Add(i.ToString()); } Session["tmpQ2"] = null; Session["tmpC2"] = 0; Session["tmpQ4"] = null; Session["tmpC4"] = 0; Session["tmpL4"] = null; Session["tmpLC4"] = 0; } MasterPage.RequiredPermission = 5200; MasterPage.IsSecure = true; MasterPage.PageTitle = string.Format("{0}", "Survey/Test Question Add"); }
protected void LoadData() { var sid = int.Parse(SID.SelectedValue); string SourceType = string.Empty; int SourceID = 0; int SchoolID = 0; if (ddSource.SelectedValue == "0") { SourceType = string.Empty; SourceID = 0; } else { string[] stringSeparators = new string[] { "_|_" }; var arr = ddSource.SelectedValue.Split(stringSeparators, StringSplitOptions.None); SourceType = arr[0]; SourceID = int.Parse(arr[1]); } int.TryParse(ddSchool.SelectedValue, out SchoolID); var s = Survey.FetchObject(sid); var sr = DAL.SurveyResults.GetStats(sid, SourceType, SourceID, SchoolID); lblInfo.Text = string.Format("The test/survey has been taken {0} times by {1} different patrons.", Convert.ToInt32(sr.Tables[0].Rows[0][0]), Convert.ToInt32(sr.Tables[1].Rows[0][0])); rptr.DataSource = sr.Tables[2]; rptr.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SetPageRibbon(StandardModuleRibbons.SetupRibbon()); SID.Text = Session["SID"] == null ? "" : Session["SID"].ToString(); if (SID.Text == "") { Response.Redirect("SurveyList.aspx"); } var s = Survey.FetchObject(int.Parse(SID.Text)); lblSurvey.Text = string.Format("{0} - {1}", s.Name, s.LongName); } MasterPage.RequiredPermission = 5200; MasterPage.IsSecure = true; MasterPage.PageTitle = string.Format("{0}", "Survey/Test Clone"); }
protected void btnClone_Click(object sender, ImageClickEventArgs e) { var so = Survey.FetchObject(int.Parse(SID.Text)); var sn = Survey.FetchObject(int.Parse(SID.Text)); sn.SID = 0; sn.Name = txtNewName.Text; sn.Status = 1; sn.Insert(); var ds1 = SurveyQuestion.GetAll(so.SID); foreach (DataRow r1 in ds1.Tables[0].Rows) { var QID = Convert.ToInt32(r1["QID"]); var q = SurveyQuestion.FetchObject(QID); q.SID = sn.SID; q.QID = 0; q.Insert(); var ds2 = SQChoices.GetAll(QID); foreach (DataRow r2 in ds2.Tables[0].Rows) { var SQCID = Convert.ToInt32(r2["SQCID"]); var c = SQChoices.FetchObject(SQCID); c.SQCID = 0; c.QID = q.QID; c.Insert(); } var ds3 = SQMatrixLines.GetAll(QID); foreach (DataRow r3 in ds3.Tables[0].Rows) { var SQMLID = Convert.ToInt32(r3["SQMLID"]); var l = SQMatrixLines.FetchObject(SQMLID); l.SQMLID = 0; l.QID = q.QID; l.Insert(); } } Session["SID"] = sn.SID; Response.Redirect("SurveyList.aspx"); Response.Redirect("SurveyAddEdit.aspx"); }
protected void Page_Load(object sender, EventArgs e) { MasterPage.RequiredPermission = 5200; MasterPage.IsSecure = true; MasterPage.PageTitle = string.Format("{0}", "Survey/Test Question Edit"); if (!IsPostBack) { SetPageRibbon(StandardModuleRibbons.SetupRibbon()); SID.Text = Session["SID"] == null ? "" : Session["SID"].ToString(); if (SID.Text == "") { Response.Redirect("SurveyList.aspx"); } var s = Survey.FetchObject(int.Parse(SID.Text)); lblSurvey.Text = string.Format("{0} - {1}", s.Name, s.LongName); if (s.Status > 1) { ReadOnly.Text = "true"; } //var j = Survey.GetNumQuestions(s.SID); //for (var i = 1; i <= j; i++) //{ // JumpToQuestion2.Items.Add(i.ToString()); // JumpToQuestion4.Items.Add(i.ToString()); //} lblPK.Text = Session["QID"] == null ? "" : Session["QID"].ToString(); dv.ChangeMode(lblPK.Text.Length == 0 ? DetailsViewMode.Insert : DetailsViewMode.Edit); Page.DataBind(); if (Request["M"] == "K") { MasterPage.DisplayMessageOnLoad = true; MasterPage.PageMessage = "Item was saved successfully! "; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SetPageRibbon(StandardModuleRibbons.SetupRibbon()); SID.Text = Session["SID"] == null ? "" : Session["SID"].ToString(); if (SID.Text == "") { Response.Redirect("SurveyList.aspx"); } var s = Survey.FetchObject(int.Parse(SID.Text)); lblSurvey.Text = string.Format("{0} - {1}", s.Name, s.LongName); if (s.Status > 1) { ReadOnly.Text = "true"; } } MasterPage.RequiredPermission = 5200; MasterPage.IsSecure = true; MasterPage.PageTitle = string.Format("{0}", "Survey/Test Question List"); _mStrSortExp = String.Empty; if (!IsPostBack) { _mStrSortExp = String.Empty; } else { if (null != ViewState["_SortExp_"]) { _mStrSortExp = ViewState["_SortExp_"] as String; } if (null != ViewState["_Direction_"]) { _mSortDirection = (SortDirection)ViewState["_Direction_"]; } } }
protected void GvRowCommand(object sender, GridViewCommandEventArgs e) { string editpage = "~/ControlRoom/Modules/Setup/SurveyAddEdit.aspx"; if (e.CommandName.ToLower() == "addrecord") { Session["SID"] = string.Empty; Response.Redirect(editpage); } if (e.CommandName.ToLower() == "editrecord") { int key = Convert.ToInt32(e.CommandArgument); Session["SID"] = key; Response.Redirect(editpage); } if (e.CommandName.ToLower() == "questions") { int key = Convert.ToInt32(e.CommandArgument); Session["SID"] = key; Response.Redirect("~/ControlRoom/Modules/Setup/SurveyQuestionList.aspx"); } if (e.CommandName.ToLower() == "results") { int key = Convert.ToInt32(e.CommandArgument); Session["SID"] = key; Response.Redirect("~/ControlRoom/Modules/Setup/SurveyResults.aspx"); } if (e.CommandName.ToLower() == "clone") { int key = Convert.ToInt32(e.CommandArgument); Session["SID"] = key; Response.Redirect("~/ControlRoom/Modules/Setup/SurveyClone.aspx"); } if (e.CommandName.ToLower() == "deleterecord") { var key = Convert.ToInt32(e.CommandArgument); try { var obj = Survey.FetchObject(key); if (obj.IsValid(BusinessRulesValidationMode.DELETE)) { obj.Delete(); LoadData(); var masterPage = (IControlRoomMaster)Master; if (masterPage != null) { masterPage.PageMessage = SRPResources.DeleteOK; } } else { var masterPage = (IControlRoomMaster)Master; string message = String.Format(SRPResources.ApplicationError1, "<ul>"); foreach (BusinessRulesValidationMessage m in obj.ErrorCodes) { message = string.Format(String.Format("{0}<li>{{0}}</li>", message), m.ErrorMessage); } message = string.Format("{0}</ul>", message); if (masterPage != null) { masterPage.PageError = message; } } } catch (Exception ex) { var masterPage = (IControlRoomMaster)Master; if (masterPage != null) { masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message); } } } if (e.CommandName.ToLower() == "embed") { Response.Redirect("SurveyEmbedCode.aspx"); } }
protected void GvRowCommand(object sender, GridViewCommandEventArgs e) { string editpage = "~/ControlRoom/Modules/Setup/SurveyQuestionAddEdit.aspx"; if (e.CommandName.ToLower() == "addrecord") { var s = Survey.FetchObject(int.Parse(SID.Text)); if (s.Status == 2) { MasterPage.PageError = String.Format("<font color=red>{0}", "This Survey/Test is 'Locked / Active' and cannot be modified."); return; } Response.Redirect("~/ControlRoom/Modules/Setup/SurveyQuestionAddWizard.aspx"); } if (e.CommandName.ToLower() == "editrecord") { int key = Convert.ToInt32(e.CommandArgument); Session["QID"] = key; Response.Redirect(editpage); } if (e.CommandName.ToLower() == "deleterecord") { var key = Convert.ToInt32(e.CommandArgument); try { var obj = SurveyQuestion.FetchObject(key); if (obj.IsValid(BusinessRulesValidationMode.DELETE)) { obj.Delete(); LoadData(); var masterPage = (IControlRoomMaster)Master; if (masterPage != null) { masterPage.PageMessage = SRPResources.DeleteOK; } } else { var masterPage = (IControlRoomMaster)Master; string message = String.Format(SRPResources.ApplicationError1, "<ul>"); foreach (BusinessRulesValidationMessage m in obj.ErrorCodes) { message = string.Format(String.Format("{0}<li>{{0}}</li>", message), m.ErrorMessage); } message = string.Format("{0}</ul>", message); if (masterPage != null) { masterPage.PageError = message; } } } catch (Exception ex) { var masterPage = (IControlRoomMaster)Master; if (masterPage != null) { masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message); } } } if (e.CommandName.ToLower() == "moveup") { var key = Convert.ToInt32(e.CommandArgument); SurveyQuestion.MoveUp(key); MasterPage.PageMessage = "Survey/Test Question Moved Up!"; LoadData(); } if (e.CommandName.ToLower() == "movedn") { var key = Convert.ToInt32(e.CommandArgument); SurveyQuestion.MoveDn(key); MasterPage.PageMessage = "Survey/Test Question Moved Down"; LoadData(); } if (e.CommandName.ToLower() == "back") { Response.Redirect("~/ControlRoom/Modules/Setup/SurveyList.aspx"); } if (e.CommandName.ToLower() == "preview") { Session["QNum"] = null; Session["TextReturnPage"] = "~/ControlRoom/Modules/Setup/SurveyQuestionList.aspx"; Response.Redirect("~/ControlRoom/Modules/Setup/SurveyPreview.aspx"); } if (e.CommandName.ToLower() == "results") { int key = Convert.ToInt32(e.CommandArgument); Response.Redirect("~/ControlRoom/Modules/Setup/SurveyResults.aspx"); } }