private ArrayList GetStock() { Shirts shirtShortMao = new Shirts(true, true, 200); Shirts shirtShort = new Shirts(true, false, 300); Shirts shirtLongMao = new Shirts(false, true, 150); Shirts shirtLong = new Shirts(false, false, 350); Pants pantNormal = new Pants(false, 1500); Pants pantChupin = new Pants(true, 500); ArrayList stock = new ArrayList { shirtShortMao, shirtShort, shirtLongMao, shirtLong, pantNormal, pantChupin, }; return(stock); }
private void UpdateStock() { ArrayList stock = GetStock(); Shirts first = (Shirts)stock[0]; Shirts second = (Shirts)stock[1]; Shirts third = (Shirts)stock[2]; Shirts four = (Shirts)stock[3]; Pants five = (Pants)stock[4]; Pants six = (Pants)stock[5]; int total; if (radioBtnShirt.Checked) { total = first.quantity + second.quantity + third.quantity + four.quantity; txtStock.Text = total.ToString(); } if (radioBtnShort.Checked) { total = first.quantity + second.quantity; txtStock.Text = total.ToString(); } if (radioBtnLong.Checked) { total = third.quantity + four.quantity; txtStock.Text = total.ToString(); } if (radioBtnCommon.Checked && radioBtnShort.Checked) { total = second.quantity; txtStock.Text = total.ToString(); } if (radioBtnMao.Checked && radioBtnShort.Checked) { total = first.quantity; txtStock.Text = total.ToString(); } if (radioBtnCommon.Checked && radioBtnLong.Checked) { total = third.quantity; txtStock.Text = total.ToString(); } if (radioBtnMao.Checked && radioBtnLong.Checked) { total = four.quantity; txtStock.Text = total.ToString(); } // PANTS if (radioBtnPant.Checked) { total = five.quantity + six.quantity; txtStock.Text = total.ToString(); } if (radioBtnChupin.Checked) { total = five.quantity; txtStock.Text = total.ToString(); } if (radioBtnCommonPant.Checked) { total = six.quantity; txtStock.Text = total.ToString(); } }