Beispiel #1
0
 private void cbFoodCategory_SelectedIndexChanged(object sender, EventArgs e)
 {
     cbFoodName.Items.Clear();
     daftarMakanan = Makanan.ReadMakanan(cbFoodCategory.Text);
     foreach (Makanan makanan in daftarMakanan)
     {
         cbFoodName.Items.Add(makanan.Nama);
     }
 }
Beispiel #2
0
 private void cbFoodName_SelectedIndexChanged(object sender, EventArgs e)
 {
     makanan                   = daftarMakanan.Find(x => x.Nama.Contains(cbFoodName.Text));
     lblFoodName.Text          = makanan.Nama;
     lblFoodCategory.Text      = makanan.Kategori;
     lblEnergiAmount.Text      = makanan.KandunganGizi.energi.ToString() + " kkal";
     lblProteinAmount.Text     = makanan.KandunganGizi.protein.ToString() + " gr";
     lblLemakAmount.Text       = makanan.KandunganGizi.lemak.ToString() + " gr";
     lblKarbohidratAmount.Text = makanan.KandunganGizi.lemak.ToString() + " gr";
     lblKalsiumAmount.Text     = makanan.KandunganGizi.kalsium.ToString() + " gr";
     lblVitAAmount.Text        = makanan.KandunganGizi.VitA.ToString() + " gr";
     lblVitCAmount.Text        = makanan.KandunganGizi.VitC.ToString() + " gr";
     lblZatBesiAmount.Text     = makanan.KandunganGizi.ZatBesi.ToString() + " gr";
     panelFoodInfo.Visible     = true;
 }
Beispiel #3
0
        private void FormFood_Load(object sender, EventArgs e)
        {
            using (var db = new UserModel())
            {
                var query =
                    from makan in db.MakananDimakans where makan.FoodUser == FormMain.penggunaGlobal.Name select makan;
                if (query.Count() > 0)
                {
                    btnFoodList.Enabled = true;
                }
            }
            Makanan.SetConnectionString(ConfigurationManager
                                        .ConnectionStrings["PenghitungGiziMakanan.Properties.Settings.connString"]
                                        .ConnectionString);
            List <string> daftarKategori = Makanan.ReadKategori();

            foreach (string kategori in daftarKategori)
            {
                cbFoodCategory.Items.Add(kategori);
            }
        }