コード例 #1
0
    public static void SetGraphData(string DropDownList1Text, string DropDownList2Text, string DropDownList3Text, string PassSpecificScoreF)
    {
        SprintAthleteEdit sae     = new SprintAthleteEdit();
        DataTable         dtTable = new DataTable();

        dtTable = sae.GetSprintVariable();
        var session_Initial  = DropDownList1Text;
        var session_Final    = DropDownList3Text;
        var SummaryCheckPage = DropDownList2Text;

        HttpContext.Current.Session["GRAPH_DATA_Name"] = SummaryCheckPage;
        DataRow sprintDataFinal      = HttpContext.Current.Session["SPRINT_DATA_Final"] as DataRow;
        DataRow sprintDataFinalModel = HttpContext.Current.Session["SPRINT_DATA_FinalModel"] as DataRow;
        DataRow dtVariablesSD        = HttpContext.Current.Session["SPRINT_DATA_SD_variable"] as DataRow;

        DataRow sprintDataInitial      = HttpContext.Current.Session["SPRINT_DATA_Initial"] as DataRow;
        DataRow sprintDataInitialModel = HttpContext.Current.Session["SPRINT_DATA_InitialModel"] as DataRow;
        DataRow SprintSDVariable       = HttpContext.Current.Session["GetAllSprintAND_SDValue"] as DataRow;

        Decimal valAthVel  = 1;
        Decimal valModAt   = 1;
        Decimal valAthAtLR = 1;
        Decimal valAthAtRL = 1;
        Decimal valAthAtAv = 1;

        string graphDataChart1 = "['Element', '', { role: 'style'},\"ModelValue\"],";
        string graphDataChart2 = "['Element', '', { role: 'style'},\"ModelValue\"],";
        string Code            = string.Empty;
        string sd          = string.Empty;
        string Chart       = string.Empty;
        string GroupNo     = string.Empty;
        string ChartNo     = string.Empty;
        string result      = string.Empty;
        string sessionName = string.Empty;

        foreach (DataRow dtRow in SprintSDVariable.Table.Rows)
        {
            Chart = dtRow["ChartNo"].ToString();
            Code  = dtRow["Code"].ToString();
            sd    = dtRow["SD"].ToString();
            Decimal sdvalue = Convert.ToDecimal(sd);

            if (DropDownList3Text.Contains("Initial"))
            {
                sessionName = "Intial";
                Decimal valIntial      = Convert.ToDecimal(sprintDataInitial[Code]);
                Decimal valIntialModel = Convert.ToDecimal(sprintDataInitialModel[Code]);

                if (Code == "Velocity")
                {
                    valAthVel = valIntial;
                }
                if (Code == "Air Time Left to Right")
                {
                    valAthAtLR = valIntial;
                }
                if (Code == "Air Time Right to Left")
                {
                    valAthAtRL = valIntial;
                }
                if (Code == "Air Time Average")
                {
                    valAthAtAv = valIntial;
                    valModAt   = valIntialModel;
                }

                if (Chart == "1")
                {
                    string chartDataIntial = getChartData(Code, valIntial, valIntialModel, sdvalue, valAthVel, valModAt, valAthAtLR, valAthAtRL, valAthAtAv);

                    if (dtRow["GroupNo"].ToString().Trim().ToUpper() != GroupNo.Trim().ToUpper())
                    {
                        graphDataChart1 += "['',0,'',\"\"],";
                        graphDataChart1 += chartDataIntial;
                        GroupNo          = dtRow["GroupNo"].ToString();
                    }
                    else
                    {
                        graphDataChart1 += chartDataIntial;
                        GroupNo          = dtRow["GroupNo"].ToString();
                    }
                }
                else
                {
                    string chartDataIntialModel = getChartData(Code, valIntial, valIntialModel, sdvalue, valAthVel, valModAt, valAthAtLR, valAthAtRL, valAthAtAv);
                    if (dtRow["GroupNo"].ToString().Trim().ToUpper() != GroupNo.Trim().ToUpper())
                    {
                        graphDataChart2 += "['',0,'',\"\"],";
                        graphDataChart2 += chartDataIntialModel;
                        GroupNo          = dtRow["GroupNo"].ToString();
                    }
                    else
                    {
                        graphDataChart2 += chartDataIntialModel;
                        GroupNo          = dtRow["GroupNo"].ToString();
                    }
                }
            }
            else
            {
                sessionName = "Final";
                Decimal valFinal      = Convert.ToDecimal(sprintDataFinal[Code]);
                Decimal valFinalModel = Convert.ToDecimal(sprintDataFinalModel[Code]);

                if (Code == "Velocity")
                {
                    valAthVel = valFinal;
                }
                if (Code == "Air Time Left to Right")
                {
                    valAthAtLR = valFinal;
                }
                if (Code == "Air Time Right to Left")
                {
                    valAthAtRL = valFinal;
                }
                if (Code == "Air Time Average")
                {
                    valAthAtAv = valFinal;
                    valModAt   = valFinalModel;
                }

                if (Chart == "1")
                {
                    string chartDataFinal = getChartData(Code, valFinal, valFinalModel, sdvalue, valAthVel, valModAt, valAthAtLR, valAthAtRL, valAthAtAv);

                    if (dtRow["GroupNo"].ToString().Trim().ToUpper() != GroupNo.Trim().ToUpper())
                    {
                        graphDataChart1 += "['',0,'',\"\"],";
                        graphDataChart1 += chartDataFinal;
                        GroupNo          = dtRow["GroupNo"].ToString();
                    }
                    else
                    {
                        graphDataChart1 += chartDataFinal;
                        GroupNo          = dtRow["GroupNo"].ToString();
                    }
                }
                else
                {
                    string chartDataFinalModel = getChartData(Code, valFinal, valFinalModel, sdvalue, valAthVel, valModAt, valAthAtLR, valAthAtRL, valAthAtAv);
                    if (dtRow["GroupNo"].ToString().Trim().ToUpper() != GroupNo.Trim().ToUpper())
                    {
                        graphDataChart2 += "['',0,'',\"\"],";
                        graphDataChart2 += chartDataFinalModel;
                        GroupNo          = dtRow["GroupNo"].ToString();
                    }
                    else
                    {
                        graphDataChart2 += chartDataFinalModel;
                        GroupNo          = dtRow["GroupNo"].ToString();
                    }
                }
            }
            HttpContext.Current.Session["GRAPH_DATA_CHART1"] = graphDataChart1.TrimEnd(",".ToCharArray());
            HttpContext.Current.Session["GRAPH_DATA_CHART2"] = graphDataChart2.TrimEnd(",".ToCharArray());
        }
        HttpContext.Current.Session["Session_Name"] = sessionName;
    }