コード例 #1
0
ファイル: splash.xaml.cs プロジェクト: jkevinp/ergoMC
        public splash()
        {
            
            _user = new User();
            InitializeComponent();
            this.DataContext = _user;

            Model m = new Model(CONFIG.DB_NAME);
            m.CreateDatabase(CONFIG.DB_NAME);
            txt_username.Focus();
        }
コード例 #2
0
ファイル: Summary.xaml.cs プロジェクト: jkevinp/ergoMC
          //case 1:
          //         this.description = "Neglible risk, no action required.";
          //         break;
          //     case 2:
          //     case 3:
          //         this.description = "Low risk, change may be needed.";
          //         break;
          //     case 4:
          //     case 5:
          //     case 6:
          //     case 7:
          //         this.description = "Medium risk,further investigation and change soon.";
          //     break;
          //     case 8:
          //     case 9:
          //     case 10:
          //     this.description = "High risk,investigate and implement change.";
          //     break;
          //     default:
          //         this.description = "Very high risk, implement change.";
          //         break;

        public Summary()
        {
            Model m = new Model();
            m.table = "reba";
            float total = 0;
            System.Data.DataTable t = m.selectQuery("SELECT final_score ,count(1) as number from reba GROUP By final_score");
            foreach (DataRow row in t.Rows)
            {
                switch (Helpers.Convert(row["final_score"].ToString()))
                {
                    case 1:
                        Number1 += Helpers.Convert(row["number"].ToString());
                        break;
                    case 2:
                    case 3:
                        Number2 += Helpers.Convert(row["number"].ToString());
                        break;
                    case 4:
                    case 5:
                    case 6:
                    case 7:
                        Number3 += Helpers.Convert(row["number"].ToString());
                        break;
                    case 8:
                    case 9:
                    case 10:
                        Number4 += Helpers.Convert(row["number"].ToString());
                        break;
                    default:
                        Number5 += Helpers.Convert(row["number"].ToString());
                        break;
                }

            }
            total = (float)(num1 + num2 + num3 + num4 + num5);
            pNumber1 = Number1 / total * 100;
            pNumber2 = Number2 / total * 100;
            pNumber3 = Number3 / total * 100;
            pNumber4 = Number4 / total * 100;
            pNumber5 = Number5 / total * 100;


            float rulatotal = 0;
            System.Data.DataTable rt = m.selectQuery("SELECT final_score ,count(1) as number from rula GROUP By final_score");
            foreach (DataRow row in rt.Rows)
            {
                switch (Helpers.Convert(row["final_score"].ToString()))
                {
                    case 1:
                    case 2:
                        nnumber1 += Helpers.Convert(row["number"].ToString());
                        break;
                   
                    case 3:
                    case 4:
                        nnumber2 += Helpers.Convert(row["number"].ToString());
                        break;
                 
                    case 5:
                    case 6:
                        nnumber3 += Helpers.Convert(row["number"].ToString());
                        break;

                    default:
                        nnumber4 += Helpers.Convert(row["number"].ToString());
                        break;
                }

            }
            rulatotal = (float)(nnum1 + nnum2 + nnum3 + nnum4);
            npnumber1 = nnumber1 / rulatotal * 100;
            npnumber2 = nnumber2 / rulatotal * 100;
            npnumber3 = nnumber3 / rulatotal * 100;
            npnumber4 = nnumber4 / rulatotal * 100;


            
            InitializeComponent();
            
            DataContext = this;
        }