Пример #1
0
        /// <summary>
        ///  handles the check all control
        /// </summary>
        protected void OnSelectAll_Toggle(object sender, EventArgs e)
        {
            System.Collections.ArrayList arr =
                new ArrayList(CohortIDsToCompare);

            CompareAllCohortsCheckBox_Checked = select_all.Checked;

            if (select_all.Checked)
            {
                //-----
                // bind summary grid data
                System.Data.DataSet   sg = CECWebSrv.GetCohortForSummaryGrid(UserToken, SqlizeFilterCriteria());
                System.Data.DataTable t  = sg.Tables["tbl_web_cohorts_v4_0"];

                foreach (DataRow dr in t.Rows)
                {
                    int acronymIndex = t.Columns.IndexOf("cohort_acronym");
                    int cId          = (int)CECWebSrv.GetCohortDetails(UserToken, dr["cohort_acronym"].ToString()).Tables[0].Rows[0]["cohort_id"];

                    if (!arr.Contains(cId.ToString()))
                    {
                        arr.Add(cId.ToString());
                    }
                }
            }
            else
            {
                arr.Clear();
            }

            CohortIDsToCompare = (string[])arr.ToArray(typeof(string));

            SetSummaryGridForDisplay();

            /// return focus to clicked checkbox
            checkboxToGetFocus = select_all.ID;
        }
Пример #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (Page.Request.QueryString["cohort_id"] != null || Page.Request.QueryString["cohort_acronym"] != null)
            {
                System.Data.DataSet ds1, ds2;
                if (Page.Request.QueryString["cohort_id"] != null)
                {
                    ds1 = CECWebSrv.GetCohortDetails(UserToken, int.Parse(Page.Request.QueryString["cohort_id"]));
                }
                else
                {
                    ds1 = CECWebSrv.GetCohortDetails(UserToken, Page.Request.QueryString["cohort_acronym"]);
                }

                System.Data.DataTable cohort = ds1.Tables["tbl_web_cohorts_v4_0"];

                if (cohort.Rows.Count == 0)
                {
                    cd_errorMsg.InnerText = "cohort not found";
                    return;
                }

                ///----------------------------------------
                /// stopped commenting, code has been hacked to handle changes from the client
                ///  in the time provided. first casualities are comments/documentation.... o.0
                ///
                // grab all columns from the cohort_meta table
                System.Data.DataTable cohort_meta = CECWebSrv.GetFilteredCohortRecords(UserToken, "*", String.Format(" (cohort_id={0})", cohort.Rows[0]["cohort_id"])).Tables["tbl_web_cohorts_v4_0"];
                if (cohort_meta.Rows.Count > 0)
                {
                    //if ((cohort_meta.Rows[0]["attachmentQuestionnairePending"] != DBNull.Value) && (bool)cohort_meta.Rows[0]["attachmentQuestionnairePending"])
                    //    ChangeDefaultAttachmentEmptyText(quest_attachments.ID);

                    //if ((cohort_meta.Rows[0]["attachmentPoliciesPending"] != DBNull.Value) && (bool)cohort_meta.Rows[0]["attachmentPoliciesPending"])
                    //    ChangeDefaultAttachmentEmptyText(pol_attachments.ID);

                    //if ((cohort_meta.Rows[0]["attachmentPublicationsPending"] != DBNull.Value) && (bool)cohort_meta.Rows[0]["attachmentPublicationsPending"])
                    //    ChangeDefaultAttachmentEmptyText(pub_attachments.ID);

                    //if ((cohort_meta.Rows[0]["attachmentGrantsPending"] != DBNull.Value) && (bool)cohort_meta.Rows[0]["attachmentGrantsPending"])
                    //    ChangeDefaultAttachmentEmptyText(grant_attachments.ID);

                    //if ((cohort_meta.Rows[0]["attachmentProtocolsPending"] != DBNull.Value) && (bool)cohort_meta.Rows[0]["attachmentProtocolsPending"])
                    //    ChangeDefaultAttachmentEmptyText(prot_attachments.ID);
                }
                /// hacking ends here...spaghetti code!
                /// -------------------------------------------

                dt_cohort = cohort;

                PopulateWebFieldValues(cohort);

                PopulateOtherSection(cohort);

                ds2 = CECWebSrv.GetCohortAttachmentList(UserToken, (int)cohort.Rows[0]["id"]);
                PopulateAttachmentSection(ds2.Tables[0]);

                PopulateFormURL(cohort);

                if (Page.Request.QueryString["tab"] != null)
                {
                    string clientScr = String.Format("<script>toggleAccordion({0});</script>", helper.HTMLEncode(Page.Request.QueryString["tab"]));
                    Page.ClientScript.RegisterStartupScript(GetType(), "tab", clientScr);
                }

                if (!IsPostBack)
                {
                    CECWebSrv.AuditLog_AddActivity(UserToken.userid, String.Format("cohort {0} details page", cohort.Rows[0]["cohort_acronym"]));
                }
            }

            if (Page.Request.QueryString["download"] != null)
            {
                string savePath = CECWebSrv.GetCohortDocument(UserToken, Convert.ToInt32(Page.Request.QueryString["download"]));
                savePath = savePath.Replace("'", "\\'");
                Page.ClientScript.RegisterStartupScript(GetType(), "download", String.Format("<script>window.open('{0}');</script>", savePath));
            }
        }
Пример #3
0
        /// <summary>
        /// called when the summarygridview is bound to data source
        /// </summary>
        protected void summaryGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                e.Row.ID = "summaryHeader";

                foreach (TableCell tc in e.Row.Cells)
                {
                    if (tc.Controls[0] is LinkButton)
                    {
                        string colName = (tc.Controls[0] as LinkButton).Text;
                        tc.ID = (tc.Controls[0] as LinkButton).Text;
                        (tc.Controls[0] as LinkButton).Controls.Add(new LiteralControl(CECWebSrv.GetCohortWebFieldLabelByColumnName(UserToken, colName)));

                        System.Web.UI.HtmlControls.HtmlGenericControl span =
                            new HtmlGenericControl("span");
                        span.Attributes["class"] = "glyphicon glyphicon-sort";
                        (tc.Controls[0] as LinkButton).Controls.Add(span);
                    }

                    tc.CssClass = "sortable ";

                    if (tc.ID == SummaryGridSortColumn)
                    {
                        tc.CssClass += String.Format("columnSorting_{0}", GetSortString(SummaryGridSortDirection));
                    }
                }

                //System.Web.UI.WebControls.TableHeaderCell hc =
                //    new TableHeaderCell();
                //hc.ID = "table-select-col";
                //hc.ClientIDMode = ClientIDMode.Static;
                //hc.ToolTip = "Toggle Select All";

                //hc.Controls.Add(new LiteralControl(String.Format("<label for=\"{0}\" class=\"invisibleLabel\">Toggle Select All</label>", select_all.ID)));

                //hc.Controls.Add(select_all);

                //checkbox
                //e.Row.Cells.AddAt(0, hc);

                e.Row.TableSection = TableRowSection.TableHeader;

                /*//contact
                 * TableHeaderCell con = new TableHeaderCell();
                 * con.ID = "contactCol";
                 * con.ClientIDMode = ClientIDMode.Static;
                 * con.Attributes.Add("scope", "col");
                 * con.Text = "Contact";
                 * e.Row.Cells.Add(con);
                 *
                 * //policies
                 * TableHeaderCell pol = new TableHeaderCell();
                 * pol.ID = "policyCol";
                 * pol.ClientIDMode = ClientIDMode.Static;
                 * pol.Attributes.Add("scope", "col");
                 * pol.Text = "Policies";
                 * e.Row.Cells.Add(pol);
                 *
                 * //more
                 * TableHeaderCell more = new TableHeaderCell();
                 * more.ID = "moreCol";
                 * more.ClientIDMode = ClientIDMode.Static;
                 * more.Attributes.Add("scope", "col");
                 * more.Text = "More";
                 * e.Row.Cells.Add(more);*/
            }
            else if (e.Row.RowType == DataControlRowType.DataRow)
            {
                // get cohort id
                int    acronymIndex = summaryTable.Columns.IndexOf("cohort_acronym");
                string acronym      = (e.Row.DataItem as DataRowView)[acronymIndex].ToString();
                int    cId          = (int)CECWebSrv.GetCohortDetails(UserToken, acronym).Tables[0].Rows[0]["cohort_id"];

                // get cohort name index
                int nameIndex = summaryTable.Columns.IndexOf("cohort_name");

                /// commented out March 5 by SC. Accessibility report did not like
                ///  multiple labels for one input control
                //----------------------
                // create label control for each field
                //foreach (TableCell tc in e.Row.Cells)
                //{
                //    System.Web.UI.WebControls.Label lb =
                //        new Label();
                //    lb.AssociatedControlID = "compare_" + cId.ToString();
                //    lb.Text = tc.Text;

                //    tc.Controls.Add(lb);
                //}

                // get the cohort name to link
                System.Web.UI.WebControls.HyperLink nm =
                    new HyperLink();
                nm.Text        = e.Row.Cells[nameIndex].Text;
                nm.NavigateUrl = String.Format("./cohortDetails.aspx?cohort_id={0}", cId);
                //nm.Target = "_blank";

                e.Row.Cells[nameIndex].Controls.Add(nm);
                //------------------------------------------

                System.Web.UI.WebControls.HyperLink ac =
                    new HyperLink();
                ac.Text        = e.Row.Cells[acronymIndex].Text;
                ac.NavigateUrl = String.Format("./cohortDetails.aspx?cohort_id={0}", cId);

                e.Row.Cells[acronymIndex].Controls.Add(ac);
                //------------------------------------------


                //---
                // now lets add the custom columns:
                // checkbox control column
                //System.Web.UI.WebControls.CheckBox ckbx =
                //    new CheckBox();
                //ckbx.CssClass = "select-checkbox";
                //ckbx.ID = "compare_" + cId.ToString();
                //ckbx.ClientIDMode = ClientIDMode.Static;
                //if (CohortIDsToCompare.Contains(cId.ToString()))
                //    ckbx.Checked = true;

                //ckbx.Attributes.Add("onclick", String.Format("javascript:__doPostBack('cohortCompare', '{0}');", cId));

                //System.Web.UI.WebControls.TableCell tc1 =
                //    new TableCell();
                //tc1.Attributes["headers"] = String.Format("{0} {1}", acronym, "table-select-col");

                //tc1.Controls.Add(new LiteralControl(String.Format("<label for=\"{0}\" class=\"invisibleLabel\">Select {1} Cohort</label>", ckbx.ID, acronym)));
                //tc1.Controls.Add(ckbx);
                //e.Row.Cells.AddAt(0, tc1);

                ////--
                //// contact link column
                //System.Web.UI.WebControls.HyperLink con =
                //    new HyperLink();
                //con.Text = String.Format("contact {0}", acronym);
                ////con.Target = "_blank";
                //con.CssClass = "tableIcons contact";
                //con.NavigateUrl = String.Format("/cohortDetails.aspx?cohort_id={0}", cId);

                ////con.Controls.Add((new Image() { ImageUrl = "/images/ico_contact.png" }));

                //System.Web.UI.WebControls.TableCell tc2 =
                //    new TableCell();
                //tc2.Attributes["headers"] = String.Format("{0} {1}", acronym, "contactCol");
                //tc2.Controls.Add(con);
                //e.Row.Cells.Add(tc2);

                ////--
                //// policies
                //System.Web.UI.WebControls.HyperLink pro =
                //    new HyperLink();
                //pro.Text = String.Format("policies {0}", acronym);
                ////pro.Target = "_blank";
                //pro.CssClass = "tableIcons policies";
                //pro.NavigateUrl = String.Format("/cohortDetails.aspx?cohort_id={0}&tab=policies", cId);

                ////pro.Controls.Add((new Image() { ImageUrl="/images/ico_policies.png" }));

                //System.Web.UI.WebControls.TableCell tc3 =
                //    new TableCell();
                //tc3.Attributes["headers"] = String.Format("{0} {1}", acronym, "policyCol");
                //tc3.Controls.Add(pro);
                //e.Row.Cells.Add(tc3);

                ////---
                //// more
                //System.Web.UI.WebControls.HyperLink more =
                //    new HyperLink();
                //more.Text = String.Format("more {0}", acronym);
                ////more.Target = "_blank";
                //more.CssClass = "tableIcons more";
                //more.NavigateUrl = String.Format("/cohortDetails.aspx?cohort_id={0}&tab=more", cId);

                ////more.Controls.Add((new Image() { ImageUrl = "/images/ico_more.png" }));

                //System.Web.UI.WebControls.TableCell tc4 =
                //    new TableCell();
                //tc4.Attributes["headers"] = String.Format("{0} {1}", acronym, "moreCol");
                //tc4.Controls.Add(more);
                //e.Row.Cells.Add(tc4);

                ///--------------------------------------------------
                /// the data cells: add header cell ids.
                for (int _i = 0; _i < e.Row.Cells.Count; _i++)
                {
                    if (e.Row.Cells[_i].Attributes["headers"] == null && _i <= summaryTable.Columns.Count)
                    {
                        e.Row.Cells[_i].Attributes["headers"] = String.Format("{0}", summaryTable.Columns[_i].ColumnName);
                    }
                }
            }
        }