Esempio n. 1
0
    protected void pivotCallback_OnCallback(object sender, EventArgs e)
    {
        Debug.Print("pivotCallback_OnCallback " + System.DateTime.Now.ToString());

        RefreshSelectedSubj();
        PivotSelSubj.DataSource = (DataView)Session["ss_selsubj"];
        PivotSelSubj.DataBind();
        PivotSelSubj.ReloadData();

        PivotUnselSubj.DataSource = (DataView)Session["ss_unselsubj"];
        PivotUnselSubj.DataBind();
        PivotUnselSubj.ReloadData();
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Debug.Print("Page_Load " + System.DateTime.Now.ToString());

        if (!IsPostBack)
        {
            // Not a postback and there is a defined DataProject - preload the selected Measures and Variables
            if (Request.QueryString["subjset_pk"] != null)
            {
                int  subjset_pk;
                bool have_pk = int.TryParse(Request.QueryString["subjset_pk"], out subjset_pk);
                if (have_pk)
                {
                    SQL_utils sql = new SQL_utils("data");

                    int    studyID        = sql.IntScalar_from_SQLstring("select studyID from dp.SubjSet where subjset_pk = " + Request.QueryString["subjset_pk"].ToString());
                    string subjset        = sql.StringScalar_from_SQLstring("select coalesce(subjset,'') subjset from dp.SubjSet where subjset_pk = " + Request.QueryString["subjset_pk"].ToString());
                    string subjsetdetails = sql.StringScalar_from_SQLstring("select coalesce(subjsetdetails,'') subjsetdetails  from dp.SubjSet where subjset_pk = " + Request.QueryString["subjset_pk"].ToString());

                    txtSubjset.Text        = subjset;
                    txtSubjsetdetails.Text = subjsetdetails;


                    if (Master.Master_studyID != studyID)
                    {
                        Master.Master_studyID = studyID;
                    }

                    DataTable dts = sql.DataTable_from_SQLstring("select subjID from dp.Subj where subjset_pk = " + subjset_pk.ToString());
                    selected_subjlist = dts.AsEnumerable().Select(f => f.Field <int>("subjID").ToString()).ToList();

                    sql.Close();

                    lblTitle.Text = "Edit Subject Set: " + subjset;
                    btnSave.Text  = "Update Subject Set";
                }
            }
            else
            {
                lblTitle.Text = "Create New Subject Set";
                btnSave.Text  = "Create Subject Set";
            }

            gridLkupSubj.DataBind();
            RefreshSelectedSubj();


            PivotSelSubj.DataSource = (DataView)Session["ss_selsubj"];
            PivotSelSubj.DataBind();

            PivotUnselSubj.DataSource = (DataView)Session["ss_unselsubj"];
            PivotUnselSubj.DataBind();
        }
        else
        {
            Debug.Print("   --- is Postback " + System.DateTime.Now.ToString());
            PivotSelSubj.DataSource = (DataView)Session["ss_selsubj"];
            PivotSelSubj.DataBind();

            PivotUnselSubj.DataSource = (DataView)Session["ss_unselsubj"];
            PivotUnselSubj.DataBind();
        }


        var selsubj = gridLkupSubj.GridView.GetSelectedFieldValues(gridLkupSubj.KeyFieldName);

        selected_subjlist = selsubj.ConvertAll(x => Convert.ToString(x));


        // Process visibility
        if (selsubj.Count > 0)
        {
            string txt = String.Format("({0} selected)", selsubj.Count);
            selsubj_n.Text         = txt;
            PivotSelSubj.Visible   = true;
            PivotUnselSubj.Visible = true;
        }
        else
        {
            PivotSelSubj.Visible   = false;
            PivotUnselSubj.Visible = false;
        }


        Debug.Print("   --- Page_Load complete " + System.DateTime.Now.ToString());
    }