Exemple #1
0
        public Form1()
        {
            InitializeComponent();
            cardCB.DisplayMember  = "email";
            cardCB.ValueMember    = "CardId";
            BillsCB.DisplayMember = "DateTime";
            BillsCB.ValueMember   = "BillId";
            var response = CallApi.Get("token", "cards").Content.ReadAsStringAsync().Result;
            var des      = JsonConvert.DeserializeObject <List <Card> >(response);

            cardCB.DataSource = des;
        }
Exemple #2
0
        private void CardCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((sender as ComboBox).SelectedValue != null)
            {
                textBox1.Text = JsonConvert.DeserializeObject <Card>(CallApi.Get("", "cards",
                                                                                 (sender as ComboBox).SelectedValue.ToString()).Content.ReadAsStringAsync().Result).Balance.ToString();
                BillsCB.DataSource = JsonConvert.DeserializeObject <List <Bill> >(CallApi.Get("", "bills/uncompleted")
                                                                                  .Content.ReadAsStringAsync().Result).ToList();


                dataGridView1.Rows.Clear();
                foreach (CardWaste waste in JsonConvert.DeserializeObject <List <CardWaste> >(CallApi.Get("", "cardWastes/CardId", (sender as ComboBox).SelectedValue.ToString())
                                                                                              .Content.ReadAsStringAsync().Result).ToList())
                {
                    dataGridView1.Rows.Add(waste.Waste.Name, waste.Waste.RecyclingPrice, waste.Amount);
                }
            }
        }
Exemple #3
0
 private void BillsCB_SelectedValueChanged(object sender, EventArgs e)
 {
     if ((sender as ComboBox).SelectedValue != null)
     {
         billProducts.Rows.Clear();
         foreach (ProductDetails product in JsonConvert.DeserializeObject <BillDetails>(CallApi.Get("", "bills/details", (sender as ComboBox).SelectedValue.ToString())
                                                                                        .Content.ReadAsStringAsync().Result).ProductDetails.ToList())
         {
             billProducts.Rows.Add(product.Product.Name, product.Product.BasePrice, product.Amount);
         }
     }
 }