예제 #1
0
        private void AddItemBtn_Click(object sender, EventArgs e)
        {
            if (nameTb.Text == null || descTb.Text == null || quantNUD.Value == 0 || typeCb.SelectedIndex == -1 || feeNUD.Value == 0)
            {
                timer1.Start();
                label6.Text = "Values for item cannot be empty, please fill every box";
            }
            else
            {
                string name       = nameTb.Text;
                string desciption = descTb.Text;
                double fee        = Convert.ToDouble(feeNUD.Value);
                int    quantity   = Convert.ToInt32(quantNUD.Value);
                string type       = typeCb.Text;

                client.AddData(newStand.Id, name, desciption, fee, quantity, type);
                mainApp.UpdateListMethod();
                ActiveForm.Refresh();
                nameTb.Clear();
                descTb.Clear();
                typeCb.SelectedIndex = -1;
                feeNUD.Value         = 0;
                quantNUD.Value       = 0;
                mainApp.ClearGUI();
            }
        }
예제 #2
0
 private void AddItemBtn_Click(object sender, EventArgs e)
 {
     if (IdNameCb.SelectedIndex == -1)
     {
         MessageBox.Show("Please select an item before updating!");
     }
     else
     {
         client.UpdateData(IdNameCb.SelectedIndex + 1, NameTb.Text, descTb.Text, Convert.ToDouble(feeNUD.Value), Convert.ToInt32(quantNUD.Value));
         newStand.Items = client.RequestItems();
         mainApp.UpdateListMethod();
         newStand.Items = client.RequestItems();
         IdNameCb.Items.Clear();
         foreach (Item item in newStand.Items)
         {
             IdNameCb.Items.Add(item.ID + " " + item.Name);
         }
         NameTb.Clear();
         descTb.Clear();
         IdNameCb.SelectedIndex = -1;
         feeNUD.Value           = 0;
         quantNUD.Value         = 0;
         mainApp.ClearGUI();
     }
 }