コード例 #1
0
        private void bttnadd_Click(object sender, EventArgs e)
        {
            int parsedvalue;
            BLLProduct blll = new BLLProduct();
            DataTable dt = blll.checkallproducts(txtproduct.Text);
            if (txtproduct.Text=="" ||  txtprice.Text=="") {
                MessageBox.Show("input the required fields...");
            }

            else if (!int.TryParse(txtprice.Text, out parsedvalue))
            {

                lblmsg.Text = ("the input in price is invalid type integers...");
            }

            else if (dt.Rows.Count > 0)
                {

                    MessageBox.Show("product already exists");

                }
                else
                {
                    // values check condition is not finished..
                    int i = blp.addproduct(Convert.ToInt32(cbocategory.SelectedValue.ToString()), txtproduct.Text, Convert.ToDecimal(txtprice.Text));
                    if (i > 0)
                    {
                        MessageBox.Show("Product Has Been Added");
                    gridview1();
                    }
                }
            }  
コード例 #2
0
        private void bttnadd_Click(object sender, EventArgs e)
        {
            BLLProduct blll = new BLLProduct();
            DataTable dt = blll.checkallproducts(txtproduct.Text);

            if (dt.Rows.Count > 0)
            {

                MessageBox.Show("product already exists");

            }
            else
            {
                // values check condition is not finished..
                int i = blp.addproduct(Convert.ToInt32(cbocategory.SelectedValue.ToString()), txtproduct.Text, Convert.ToDecimal(txtprice.Text));
                if (i > 0)
                {
                    MessageBox.Show("Product Has Been Added");
                }
            }
        }