示例#1
0
        private void BindSubj(Rubric rub)
        {
            Rubrics rubda = new Rubrics(Globals.CurrentIdentity);
            Result.ResultList ress = rubda.GetResults(rub.ID, GetSubID());

            //Update the rubric
            ucRubric.UpdateRubric();

            //Reset to 0 if page index greater than numpages
            if (dgResults.CurrentPageIndex >= dgResults.PageCount)
                dgResults.CurrentPageIndex = 0;

            dgResults.DataSource = ress;
            dgResults.DataBind();

            if (!IsStudent()) {

                ddlCanned.Visible = true;
                lnkCreate.Visible = true;
                dgResults.Columns[0].Visible = true;
                dgResults.Columns[6].Visible = true;

                dgResults.Style["TOP"] = "58px";

                CannedResponse.CannedResponseList cans = rubda.GetCannedResponses(rub.ID);
                ddlCanned.Items.Clear();

                foreach (CannedResponse can in cans) {
                    string canstr = can.Comment.Substring(0, Math.Min(80, can.Comment.Length));
                    if (canstr.Length == 80)
                        canstr += " ...";
                    ListItem item = new ListItem(canstr, can.ID.ToString());

                    ddlCanned.Items.Add(item);
                }
                ddlCanned.Items.Add(new ListItem("Custom", "-1"));
            } else {
                ddlCanned.Visible = false;
                lnkCreate.Visible = false;
                dgResults.Columns[0].Visible = false;
                dgResults.Columns[6].Visible = false;

                lnkRefresh.Style["TOP"] = "0px";
                imgRefresh.Style["TOP"] = "0px";
                dgResults.Style["TOP"] = "20px";
            }

            lblRubID.Text = rub.ID.ToString();
            mpViews.SelectedIndex = 0;
        }
示例#2
0
        private void ucRubric_RubricSelect(object sender, RubricViewSelectEventArgs args)
        {
            Rubrics rubda = new Rubrics(Globals.CurrentIdentity);
            Rubric rub = args.SelectedRubric;

            ddlType.Items.Clear();
            ddlComments.Items.Clear();
            txtLines.Text = ""; txtCustom.Text = ""; txtPoints.Text = "";
            if (rubda.IsHeading(rub))
                cmdCreate.Enabled = false;
            else {
                CannedResponse.CannedResponseList cans = rubda.GetCannedResponses(rub.ID);
                foreach (CannedResponse can in cans) {
                    string canstr = can.Comment.Substring(0, Math.Min(80, can.Comment.Length));
                    if (canstr.Length == 80)
                        canstr += " ...";
                    ListItem item = new ListItem(canstr, can.ID.ToString());
                    ddlComments.Items.Add(item);
                }
                ddlComments.Items.Add(new ListItem("Custom", "-1"));
                cmdCreate.Enabled = true;

                ddlType.Items.Add(new ListItem("Error", Rubric.ERROR.ToString()));
                ddlType.Items.Add(new ListItem("Warning", Rubric.WARNING.ToString()));
                ddlType.Items.Add(new ListItem("Good", Rubric.GOOD.ToString()));
            }

            BindData(GetWindow());
        }