Esempio n. 1
0
    //public bool IsDup { get; set; }



    public Calculation_T4(int intResultSectionID, int TransactionID)
    {
        this.ResultSectionID = intResultSectionID;
        this.TransactionID   = TransactionID;



        Model_ReportSectionItem rss = new Model_ReportSectionItem();

        this.ReportSectionItem = rss.GetListItemBySectionID(this.ResultSectionID);

        this.R_UserAss_C = GetUserAss('c').OrderBy(o => o.Priority).ToList();

        Model_ReportItemResult ret = new Model_ReportItemResult();

        this.ReportResultT3 = ret.GetItemReportByTransactionID(this.TransactionID, 3);

        Model_Rule2 ideal = new Model_Rule2();

        this.IdealScore = ideal.GetAll();

        Model_Rule1 r1 = new Model_Rule1();

        this.RuleScore1 = r1.GetAll();

        Model_Rule4 r4 = new Model_Rule4();

        this.RuleScore4 = r4.GetAll();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            Model_Rule1 r1 = new Model_Rule1();

            List <Model_Rule1> rule1 = r1.GetAll();


            Model_Rule1 r1row1 = rule1.Where(o => o.RuleID == 1).FirstOrDefault();

            txtRuleTitle1.Text = r1row1.Title;
            txtRuleScore1.Text = r1row1.Score.ToString();
            txtr1_1.Text       = r1row1.CJRRuleScore1.ToString();
            txtr1_2.Text       = r1row1.CJRRuleScore2.ToString();
            txtr1_3.Text       = r1row1.CJRRuleScore3.ToString();
            txtr1_4.Text       = r1row1.CJRRuleScore4.ToString();
            txtr1_5.Text       = r1row1.CJRRuleScore5.ToString();

            Model_Rule1 r1row2 = rule1.Where(o => o.RuleID == 2).FirstOrDefault();

            txtRuleTitle2.Text = r1row2.Title;
            txtRuleScore2.Text = r1row2.Score.ToString();
            txtr2_1.Text       = r1row2.CJRRuleScore1.ToString();
            txtr2_2.Text       = r1row2.CJRRuleScore2.ToString();
            txtr2_3.Text       = r1row2.CJRRuleScore3.ToString();
            txtr2_4.Text       = r1row2.CJRRuleScore4.ToString();
            txtr2_5.Text       = r1row2.CJRRuleScore5.ToString();

            Model_Rule1 r1row3 = rule1.Where(o => o.RuleID == 3).FirstOrDefault();

            txtRuleTitle3.Text = r1row3.Title;
            txtRuleScore3.Text = r1row3.Score.ToString();
            txtr3_1.Text       = r1row3.CJRRuleScore1.ToString();
            txtr3_2.Text       = r1row3.CJRRuleScore2.ToString();
            txtr3_3.Text       = r1row3.CJRRuleScore3.ToString();
            txtr3_4.Text       = r1row3.CJRRuleScore4.ToString();
            txtr3_5.Text       = r1row3.CJRRuleScore5.ToString();

            Model_Rule1 r1row4 = rule1.Where(o => o.RuleID == 4).FirstOrDefault();

            txtRuleTitle4.Text = r1row4.Title;
            txtRuleScore4.Text = r1row4.Score.ToString();
            txtr4_1.Text       = r1row4.CJRRuleScore1.ToString();
            txtr4_2.Text       = r1row4.CJRRuleScore2.ToString();
            txtr4_3.Text       = r1row4.CJRRuleScore3.ToString();
            txtr4_4.Text       = r1row4.CJRRuleScore4.ToString();
            txtr4_5.Text       = r1row4.CJRRuleScore5.ToString();

            Model_Rule1 r1row5 = rule1.Where(o => o.RuleID == 5).FirstOrDefault();

            txtRuleTitle5.Text = r1row5.Title;
            txtRuleScore5.Text = r1row5.Score.ToString();
            txtr5_1.Text       = r1row5.CJRRuleScore1.ToString();
            txtr5_2.Text       = r1row5.CJRRuleScore2.ToString();
            txtr5_3.Text       = r1row5.CJRRuleScore3.ToString();
            txtr5_4.Text       = r1row5.CJRRuleScore4.ToString();
            txtr5_5.Text       = r1row5.CJRRuleScore5.ToString();


            Model_Rule2        r2    = new Model_Rule2();
            List <Model_Rule2> rule2 = r2.GetAll();


            Model_Rule2 r2row1 = rule2.Where(o => o.RuleID == 1).FirstOrDefault();

            ideal_socore_1.Text = r2row1.Score.ToString();
            ideal_value_1.Text  = r2row1.Value.ToString();

            Model_Rule2 r2row2 = rule2.Where(o => o.RuleID == 2).FirstOrDefault();

            ideal_socore_2.Text = r2row2.Score.ToString();
            ideal_value_2.Text  = r2row2.Value.ToString();

            Model_Rule2 r2row3 = rule2.Where(o => o.RuleID == 3).FirstOrDefault();

            ideal_socore_3.Text = r2row3.Score.ToString();
            ideal_value_3.Text  = r2row3.Value.ToString();

            Model_Rule2 r2row4 = rule2.Where(o => o.RuleID == 4).FirstOrDefault();

            ideal_socore_4.Text = r2row4.Score.ToString();
            ideal_value_4.Text  = r2row4.Value.ToString();

            Model_Rule2 r2row5 = rule2.Where(o => o.RuleID == 5).FirstOrDefault();

            ideal_socore_5.Text = r2row5.Score.ToString();
            ideal_value_5.Text  = r2row5.Value.ToString();



            Model_Rule3        r3    = new Model_Rule3();
            List <Model_Rule3> rule3 = r3.GetAll();

            Model_Rule3 r3row1 = rule3.Where(o => o.RuleID == 1).FirstOrDefault();
            exp_from_1.Text = r3row1.Range_Start.ToString();
            exp_to_1.Text   = r3row1.Range_End.ToString();
            exp_des_1.Text  = r3row1.Description.ToString();

            Model_Rule3 r3row2 = rule3.Where(o => o.RuleID == 2).FirstOrDefault();
            exp_from_2.Text = r3row2.Range_Start.ToString();
            exp_to_2.Text   = r3row2.Range_End.ToString();
            exp_des_2.Text  = r3row2.Description.ToString();

            Model_Rule3 r3row3 = rule3.Where(o => o.RuleID == 4).FirstOrDefault();
            exp_from_3.Text = r3row3.Range_Start.ToString();
            exp_to_3.Text   = r3row3.Range_End.ToString();
            exp_des_3.Text  = r3row3.Description.ToString();

            Model_Rule3 r3row4 = rule3.Where(o => o.RuleID == 5).FirstOrDefault();
            exp_from_4.Text = r3row4.Range_Start.ToString();
            exp_to_4.Text   = r3row4.Range_End.ToString();
            exp_des_4.Text  = r3row4.Description.ToString();

            Model_Rule3 r3row5 = rule3.Where(o => o.RuleID == 6).FirstOrDefault();
            exp_from_5.Text = r3row5.Range_Start.ToString();
            exp_to_5.Text   = r3row5.Range_End.ToString();
            exp_des_5.Text  = r3row5.Description.ToString();

            Model_Rule3 r3row6 = rule3.Where(o => o.RuleID == 11).FirstOrDefault();
            exp_from_6.Text = r3row6.Range_Start.ToString();
            exp_to_6.Text   = r3row6.Range_End.ToString();
            exp_des_6.Text  = r3row6.Description.ToString();

            Model_Rule3 r3row7 = rule3.Where(o => o.RuleID == 14).FirstOrDefault();
            exp_from_7.Text = r3row7.Range_Start.ToString();
            exp_to_7.Text   = r3row7.Range_End.ToString();
            exp_des_7.Text  = r3row7.Description.ToString();



            Model_Rule4        r4    = new Model_Rule4();
            List <Model_Rule4> rule4 = r4.GetAll();

            Model_Rule4 r4row1 = rule4.Where(o => o.RuleID == 1).FirstOrDefault();

            result_from_1.Text    = r4row1.Range_Start.ToString();
            result_to_1.Text      = r4row1.Range_End.ToString();
            result_top7_1.Text    = r4row1.ValueTop.ToString();
            result_other_1.Text   = r4row1.ValueOther.ToString();
            result_bottom4_1.Text = r4row1.ValueBottom.ToString();

            Model_Rule4 r4row2 = rule4.Where(o => o.RuleID == 2).FirstOrDefault();

            result_from_2.Text    = r4row2.Range_Start.ToString();
            result_to_2.Text      = r4row2.Range_End.ToString();
            result_top7_2.Text    = r4row2.ValueTop.ToString();
            result_other_2.Text   = r4row2.ValueOther.ToString();
            result_bottom4_2.Text = r4row2.ValueBottom.ToString();

            Model_Rule4 r4row3 = rule4.Where(o => o.RuleID == 4).FirstOrDefault();

            result_from_3.Text    = r4row3.Range_Start.ToString();
            result_to_3.Text      = r4row3.Range_End.ToString();
            result_top7_3.Text    = r4row3.ValueTop.ToString();
            result_other_3.Text   = r4row3.ValueOther.ToString();
            result_bottom4_3.Text = r4row3.ValueBottom.ToString();

            Model_Rule4 r4row4 = rule4.Where(o => o.RuleID == 5).FirstOrDefault();

            result_from_4.Text    = r4row4.Range_Start.ToString();
            result_to_4.Text      = r4row4.Range_End.ToString();
            result_top7_4.Text    = r4row4.ValueTop.ToString();
            result_other_4.Text   = r4row4.ValueOther.ToString();
            result_bottom4_4.Text = r4row4.ValueBottom.ToString();
        }

        if (!string.IsNullOrEmpty(Request.QueryString["tab"]))
        {
            string tab = Request.QueryString["tab"];

            switch (tab)
            {
            case "2":
                tab1.Attributes.Add("aria-expanded", "false");
                tab2.Attributes.Add("aria-expanded", "true");
                tab3.Attributes.Add("aria-expanded", "false");
                tab4.Attributes.Add("aria-expanded", "false");

                li_tab1.Attributes.Remove("class");
                li_tab2.Attributes.Add("class", "active");
                li_tab3.Attributes.Remove("class");
                li_tab4.Attributes.Remove("class");

                tab_content1.Visible = false;
                tab_content2.Visible = true;
                tab_content3.Visible = false;
                tab_content4.Visible = false;

                break;

            case "3":
                tab1.Attributes.Add("aria-expanded", "false");
                tab2.Attributes.Add("aria-expanded", "false");
                tab3.Attributes.Add("aria-expanded", "true");
                tab4.Attributes.Add("aria-expanded", "false");

                li_tab1.Attributes.Remove("class");
                li_tab3.Attributes.Add("class", "active");
                li_tab2.Attributes.Remove("class");
                li_tab4.Attributes.Remove("class");

                tab_content1.Visible = false;
                tab_content2.Visible = false;
                tab_content3.Visible = true;
                tab_content4.Visible = false;

                break;

            case "4":
                tab1.Attributes.Add("aria-expanded", "false");
                tab2.Attributes.Add("aria-expanded", "false");
                tab3.Attributes.Add("aria-expanded", "false");
                tab4.Attributes.Add("aria-expanded", "true");

                li_tab1.Attributes.Remove("class");
                li_tab4.Attributes.Add("class", "active");
                li_tab3.Attributes.Remove("class");
                li_tab2.Attributes.Remove("class");

                tab_content1.Visible = false;
                tab_content2.Visible = false;
                tab_content3.Visible = false;
                tab_content4.Visible = true;

                break;
            }
        }
        else
        {
            tab_content1.Visible = true;
            tab_content2.Visible = false;
            tab_content3.Visible = false;
            tab_content4.Visible = false;

            tab1.Attributes.Add("aria-expanded", "true");
            tab2.Attributes.Add("aria-expanded", "false");
            tab3.Attributes.Add("aria-expanded", "false");
            tab4.Attributes.Add("aria-expanded", "false");

            li_tab1.Attributes.Add("class", "active");
            li_tab2.Attributes.Remove("class");

            li_tab3.Attributes.Remove("class");
            li_tab4.Attributes.Remove("class");
        }
    }