コード例 #1
0
        private void addButton_Click(object sender, EventArgs e)
        {
            if (_itemManager.isNameExist(itemNameTextBox.Text))
            {
                MessageBox.Show(itemNameTextBox.Text + " Already exist!!!");
                return;
            }
            if (String.IsNullOrEmpty(itemPriceTextBox.Text))
            {
                MessageBox.Show(" Price must be Added !!!");
                return;
            }

            bool isAdded = _itemManager.AddData(itemNameTextBox.Text, Convert.ToDouble(itemPriceTextBox.Text));

            if (isAdded)
            {
                MessageBox.Show(" Saved.");
            }

            else
            {
                MessageBox.Show(" Not Saved !!!.");
            }

            showDataGridView.DataSource = _itemManager.ShowData();
        }