private void button3_Click_1(object sender, EventArgs e) { try { var secondNumber = decimal.Parse(textBox1.Text); var productId = cbxGoods.SelectedValue.ToString(); decimal number = 0; if (dClienGoods.ContainsKey(productId)) { number = dClienGoods[productId] = dClienGoods[productId] + (ClientUtil.GetNumberBySecondNumber(mClientGoods, secondNumber) ?? 0); } else { dClienGoods.Add(cbxGoods.SelectedValue.ToString(), number = (ClientUtil.GetNumberBySecondNumber(mClientGoods, secondNumber) ?? 0)); } txtNumber.Text = number.ToString(); textBox1.Text = ""; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void button3_Click(object sender, EventArgs e) { try { var secondNumber = decimal.Parse(textBox1.Text); var number = ClientUtil.GetNumberBySecondNumber(mClientGoods, secondNumber); mSumNumber += number ?? 0; txtNumber.Text = mSumNumber.ToString(); textBox1.Text = ""; } catch (Exception ex) { MessageBox.Show(ex.Message); } }