示例#1
0
 public void updateCost(string currencyName, string style, float rates)
 {
     Datum[] costList = apiManager.GetCost();
     foreach (var cost in costList)
     {
         if (cost.category_id == "0")
         {
             lblCost6.Text   = currencyName + " " + Math.Round(float.Parse(returnPrice(style, cost)) / sgdRate * rates, 2).ToString();
             lblCost2_6.Text = currencyName + " " + Math.Round(day * float.Parse(returnPrice(style, cost)) / sgdRate * rates, 2).ToString();
         }
         else if (cost.category_id == "1")
         {
             lblCost1.Text   = currencyName + " " + Math.Round(float.Parse(returnPrice(style, cost)) / sgdRate * rates, 2).ToString();
             lblCost2_1.Text = currencyName + " " + Math.Round(day * float.Parse(returnPrice(style, cost)) / sgdRate * rates, 2).ToString();
         }
         else if (cost.category_id == "3")
         {
             lblCost2.Text   = currencyName + " " + Math.Round(float.Parse(returnPrice(style, cost)) / sgdRate * rates, 2).ToString();
             lblCost2_2.Text = currencyName + " " + Math.Round(day * float.Parse(returnPrice(style, cost)) / sgdRate * rates, 2).ToString();
         }
         else if (cost.category_id == "4")
         {
             lblCost3.Text   = currencyName + " " + Math.Round(float.Parse(returnPrice(style, cost)) / sgdRate * rates, 2).ToString();
             lblCost2_3.Text = currencyName + " " + Math.Round(day * float.Parse(returnPrice(style, cost)) / sgdRate * rates, 2).ToString();
         }
         else if (cost.category_id == "6")
         {
             lblCost4.Text   = currencyName + " " + Math.Round(float.Parse(returnPrice(style, cost)) / sgdRate * rates, 2).ToString();
             lblCost2_4.Text = currencyName + " " + Math.Round(day * float.Parse(returnPrice(style, cost)) / sgdRate * rates, 2).ToString();
         }
         else if (cost.category_id == "5")
         {
             lblCost5.Text   = currencyName + " " + Math.Round(float.Parse(returnPrice(style, cost)) / sgdRate * rates, 2).ToString();
             lblCost2_5.Text = currencyName + " " + Math.Round(day * float.Parse(returnPrice(style, cost)) / sgdRate * rates, 2).ToString();
         }
     }
 }