Beispiel #1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Pickup"))
     {
         Weight = other.GetComponent <weight> ();
         Win();
     }
 }
Beispiel #2
0
 void OnEnable()
 {
     Weight     = FindObjectOfType <weight> ();
     previousRB = hook;
     if (generateOnStart)
     {
         GenerateRope();
     }
 }
Beispiel #3
0
        public void WeightReaderTestLastWeek()
        {
            // arrange
            IList <weight> lastWeek    = weightController.GetWeightAsync(5).Result;
            IList <weight> currentWeek = weightController.GetWeightAsync(2).Result;

            // act
            weight dage1   = currentWeek[0];
            weight forDag1 = lastWeek[0];

            // assert
            Assert.AreEqual(dage1.id, (forDag1.id + 13));
        }
Beispiel #4
0
        private static weight ReadWeight(IDataRecord reader)
        {
            int    id            = reader.GetInt32(0);
            string dato          = reader.GetString(1);
            string weightMeasure = reader.GetString(2);

            weight weight = new weight
            {
                id            = id,
                dato          = dato,
                weightMeasure = weightMeasure
            };

            return(weight);
        }
Beispiel #5
0
        public int Post([FromBody] weight w)
        {
            const string postString = "INSERT INTO weight(dato, weight) VALUES (@dato, @weight)";

            using (SqlConnection databaseConnection = new SqlConnection(connectionString))
            {
                databaseConnection.Open();
                using (SqlCommand insertCommand = new SqlCommand(postString, databaseConnection))
                {
                    insertCommand.Parameters.AddWithValue("@dato", w.dato);
                    insertCommand.Parameters.AddWithValue("@weight", w.weightMeasure);
                    int rowsAffected = insertCommand.ExecuteNonQuery();

                    return(rowsAffected);
                }
            }
        }
        static void Main(string[] args)
        {
            Pokemon aPokemon = new Pokemon()
            {
                 name = "妙蛙種子";
                 hp = "60/60";
                 gender = "男";
                 weight kg = "5.94";
                 type = "草/毒";
                 height m = "0.67";
                 Stardust = "271484";
                 Candy = "27";
                 strengthen = "3000, 3";
                 EVO = "25";
                 skill(1) = "藤編";
                 skill(01) = "7";
                 skill(2) = "汙泥炸彈";
                 skill(02) = "80";
             };
             Console.WriteLine(
                  "名稱:{0}, 強度:{1}, 性別:{2}, 體重:{3}, 屬性:{4}, 身高:{5}, 星星沙子:{6}, 妙娃種子的糖果:{7}, 強化:{8}{9}, 進化:{10}, 技能(01):{11}, 技能(02):{12}"
                 , aPokemon.name 
                 , aPokemon.hp 
                 , aPokemon.gender 
                 , aPokemon.weight 
                 , aPokemon.type 
                 , aPokemon.height 
                 , aPokemon.stardust 
                 , aPokemon.candy 
                 , aPokemon.strengthen 
                 , aPokemon.EVO 
                 , aPokemon.skill(1) 
                 , aPokemon.skill(01)
                 , aPokemon.skill(2) 
                 , aPokemon.skill(02)
             };




}
 public string fromweightunit(weight enumval)
 {
     if (enumval == weight.Kilogram)
     {
         if (lang == Language.English)
         {
             return("Kilogram");
         }
         else
         {
             return("公斤");
         }
     }
     else
     if (lang == Language.English)
     {
         return("Pounds");
     }
     else
     {
         return("磅");
     }
 }
Beispiel #8
0
 ComputeWeights(weight, weightThresholds, ref outputWeights);
Beispiel #9
0
        public IEnumerable <weight> Get(int id)
        {
            if (id == 1)
            {
                const string selectString = "SELECT top 1 * FROM Weight order by id DESC";
                using (SqlConnection databaseConnection = new SqlConnection(connectionString))
                {
                    databaseConnection.Open();
                    using (SqlCommand selectCommand = new SqlCommand(selectString, databaseConnection))
                    {
                        using (SqlDataReader reader = selectCommand.ExecuteReader())
                        {
                            List <weight> weightList = new List <weight>();
                            while (reader.Read())
                            {
                                weight weight = ReadWeight(reader);
                                weightList.Add(weight);
                            }
                            return(weightList);
                        }
                    }
                }
            }
            if (id == 2)
            {
                const string selectString = "SELECT top 7 * FROM Weight order by id DESC";
                using (SqlConnection databaseConnection = new SqlConnection(connectionString))
                {
                    databaseConnection.Open();
                    using (SqlCommand selectCommand = new SqlCommand(selectString, databaseConnection))
                    {
                        using (SqlDataReader reader = selectCommand.ExecuteReader())
                        {
                            List <weight> weightList = new List <weight>();
                            while (reader.Read())
                            {
                                weight weight = ReadWeight(reader);
                                weightList.Add(weight);
                            }
                            return(weightList);
                        }
                    }
                }
            }
            if (id == 3)
            {
                const string selectString = "SELECT top 30 * FROM Weight order by id DESC";
                using (SqlConnection databaseConnection = new SqlConnection(connectionString))
                {
                    databaseConnection.Open();
                    using (SqlCommand selectCommand = new SqlCommand(selectString, databaseConnection))
                    {
                        using (SqlDataReader reader = selectCommand.ExecuteReader())
                        {
                            List <weight> weightList = new List <weight>();
                            while (reader.Read())
                            {
                                weight weight = ReadWeight(reader);
                                weightList.Add(weight);
                            }
                            return(weightList);
                        }
                    }
                }
            }
            if (id == 4)
            {
                const string selectString = "SELECT top 365 * FROM Weight order by id DESC";
                using (SqlConnection databaseConnection = new SqlConnection(connectionString))
                {
                    databaseConnection.Open();
                    using (SqlCommand selectCommand = new SqlCommand(selectString, databaseConnection))
                    {
                        using (SqlDataReader reader = selectCommand.ExecuteReader())
                        {
                            List <weight> weightList = new List <weight>();
                            while (reader.Read())
                            {
                                weight weight = ReadWeight(reader);
                                weightList.Add(weight);
                            }
                            return(weightList);
                        }
                    }
                }
            }

            if (id == 5)
            {
                const string selectString = "SELECT top 7 * FROM  ( SELECT TOP 14 * FROM Weight ORDER BY ID desc) z ORDER BY ID ";
                using (SqlConnection databaseConnection = new SqlConnection(connectionString))
                {
                    databaseConnection.Open();
                    using (SqlCommand selectCommand = new SqlCommand(selectString, databaseConnection))
                    {
                        using (SqlDataReader reader = selectCommand.ExecuteReader())
                        {
                            List <weight> weightList = new List <weight>();
                            while (reader.Read())
                            {
                                weight weight = ReadWeight(reader);
                                weightList.Add(weight);
                            }
                            return(weightList);
                        }
                    }
                }
            }
            else
            {
                List <weight> weightList = new List <weight>();
                return(weightList);
            }
        }
Beispiel #10
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            try
            {
                var setting = new SQLiteConnection(App.settingpath)
                              .Table <settingsdata>()
                              .ToList()
                              .First();
                lang = setting.language;
                hieg = setting.height;
                wieg = setting.weight;
                pres = setting.bp;
            }
            finally { }

            try
            {
                if (lang == Language.English)
                {
                    lbl0.Text  = "User Information";
                    lbl1.Text  = "Date of Birth";
                    lbl2.Text  = "Height";
                    lbl3.Text  = "Weight";
                    lbl4.Text  = "Systolic Blood pressure";
                    lbl5.Text  = "Diastolic Blood pressure";
                    lbl6.Text  = "Cholesterol level";
                    lbl7.Text  = "HDL level";
                    lbl8.Text  = "Gender";
                    lbl9.Text  = "Are you a smoker?";
                    lbl10.Text = "Do you have diabetes?";
                    //lbl11.Text = "Are you always taking medicine?";
                    height_text.Placeholder = "(in ";
                    if (hieg == Models.height.Meter)
                    {
                        height_text.Placeholder += "cm)";
                    }
                    else
                    {
                        height_text.Placeholder += "feet)";
                    }
                    weight_text.Placeholder = "(in ";
                    if (wieg == Models.weight.Kilogram)
                    {
                        weight_text.Placeholder += "kg)";
                    }
                    else
                    {
                        weight_text.Placeholder += "lb)";
                    }
                    sybp_text.Placeholder = "(in ";
                    dibp_text.Placeholder = "(in ";
                    if (pres == bp.kPa)
                    {
                        sybp_text.Placeholder += "kPa)";
                        dibp_text.Placeholder += "kPa)";
                    }
                    else
                    {
                        sybp_text.Placeholder += "mmHg)";
                        dibp_text.Placeholder += "mmHg)";
                    }
                    chol_text.Placeholder = "(in mg/dL)";
                    hdl_text.Placeholder  = "(in mg/dL)";
                    gend.ItemsSource      = new string[] { "---Choose an item---", "Male", "Female" };
                    smok.ItemsSource      = new string[] { "---Choose an item---", "Yes", "No" };
                    diab.ItemsSource      = new string[] { "---Choose an item---", "Yes", "No" };
                    //tba.ItemsSource= new string[] { "---Choose an item---", "Yes", "No" };
                    Title    = "User Profile";
                    btn.Text = "Submit";
                }
                else if (lang == Language.trad_chi)
                {
                    lbl0.Text  = "用戶資料";
                    lbl1.Text  = "出生日期";
                    lbl2.Text  = "身高";
                    lbl3.Text  = "體重";
                    lbl4.Text  = "血壓(上壓)";
                    lbl5.Text  = "血壓(下壓)";
                    lbl6.Text  = "膽固醇水平";
                    lbl7.Text  = "HDL水平";
                    lbl8.Text  = "性別";
                    lbl9.Text  = "閣下有沒有吸煙的習慣?";
                    lbl10.Text = "閣下有沒有糖尿病?";
                    //lbl11.Text = "閣下是否長期病患?";
                    height_text.Placeholder = "(";
                    if (hieg == Models.height.Meter)
                    {
                        height_text.Placeholder += "公分)";
                    }
                    else
                    {
                        height_text.Placeholder += "尺)";
                    }
                    weight_text.Placeholder = "(";
                    if (wieg == Models.weight.Kilogram)
                    {
                        weight_text.Placeholder += "kg)";
                    }
                    else
                    {
                        weight_text.Placeholder += "lb)";
                    }
                    sybp_text.Placeholder = "(";
                    dibp_text.Placeholder = "(";
                    if (pres == bp.kPa)
                    {
                        sybp_text.Placeholder += "kPa)";
                        dibp_text.Placeholder += "kPa)";
                    }
                    else
                    {
                        sybp_text.Placeholder += "mmHg)";
                        dibp_text.Placeholder += "mmHg)";
                    }
                    chol_text.Placeholder = "(mg/dL)";
                    hdl_text.Placeholder  = "(mg/dL)";
                    gend.ItemsSource      = new string[] { "---請選擇---", "男", "女" };
                    smok.ItemsSource      = new string[] { "---請選擇---", "有", "沒有" };
                    diab.ItemsSource      = new string[] { "---請選擇---", "有", "沒有" };
                    //tba.ItemsSource = new string[] { "---請選擇---", "是", "否" };
                    Title    = "個人檔案";
                    btn.Text = "提交";
                }

                else
                {
                    lbl0.Text  = "用户资料";
                    lbl1.Text  = "出生日期";
                    lbl2.Text  = "身高";
                    lbl3.Text  = "体重";
                    lbl4.Text  = "血压(上压)";
                    lbl5.Text  = "血压(下压)";
                    lbl6.Text  = "胆固醇水平";
                    lbl7.Text  = "HDL水平";
                    lbl8.Text  = "性別";
                    lbl9.Text  = "阁下有沒有吸烟的习惯?";
                    lbl10.Text = "阁下有沒有糖尿病?";
                    //lbl11.Text = "阁下是否长期病患?";
                    height_text.Placeholder = "(";
                    if (hieg == Models.height.Meter)
                    {
                        height_text.Placeholder += "公分)";
                    }
                    else
                    {
                        height_text.Placeholder += "尺)";
                    }
                    weight_text.Placeholder = "(";
                    if (wieg == Models.weight.Kilogram)
                    {
                        weight_text.Placeholder += "kg)";
                    }
                    else
                    {
                        weight_text.Placeholder += "lb)";
                    }
                    sybp_text.Placeholder = "(";
                    dibp_text.Placeholder = "(";
                    if (pres == bp.kPa)
                    {
                        sybp_text.Placeholder += "kPa)";
                        dibp_text.Placeholder += "kPa)";
                    }
                    else
                    {
                        sybp_text.Placeholder += "mmHg)";
                        dibp_text.Placeholder += "mmHg)";
                    }
                    chol_text.Placeholder = "(mg/dL)";
                    hdl_text.Placeholder  = "(mg/dL)";
                    gend.ItemsSource      = new string[] { "---请选择---", "男", "女" };
                    smok.ItemsSource      = new string[] { "---请选择---", "有", "沒有" };
                    diab.ItemsSource      = new string[] { "---请选择---", "有", "沒有" };
                    //tba.ItemsSource = new string[] { "---请选择---", "是", "否" };
                    Title    = "个人档案";
                    btn.Text = "提交";
                }
            }
            catch (Exception) { }
            using (SQLiteConnection dbim = new SQLiteConnection(App.DBPATH))
            {
                dbim.CreateTable <DB_pdata>();
                List <DB_pdata> dBs;
                try
                {
                    dBs = dbim.Table <DB_pdata>().ToList();
                    height_text.Text   = dBs.First().heig.ToString();
                    weight_text.Text   = dBs.First().weig.ToString();
                    sybp_text.Text     = dBs.First().Sbp.ToString();
                    dibp_text.Text     = dBs.First().Dbp.ToString();
                    chol_text.Text     = dBs.First().Cho.ToString();
                    hdl_text.Text      = dBs.First().hdll.ToString();
                    DOB.Date           = dBs.First().dob;
                    gend.SelectedIndex = bootoint(dBs.First().genD);
                    smok.SelectedIndex = bootoint(dBs.First().smoK);
                    diab.SelectedIndex = bootoint(dBs.First().diaB);
                    //tba.SelectedIndex = bootoint(dBs.First().medic);
                }
                catch (Exception)
                {
                    gend.SelectedIndex = 0;
                    smok.SelectedIndex = 0;
                    diab.SelectedIndex = 0;
                    //tba.SelectedIndex = 0;
                    DOB.Date = DateTime.Today;
                }
            }
            DOB.MaximumDate = DateTime.Today;
        }