示例#1
0
        private async void ok_Click(object sender, EventArgs e)
        {
            WindowsFormsApplication1.Resources.ProductDB product = new WindowsFormsApplication1.Resources.ProductDB();

            String set_info;
            int    allisok = 0;

            if (new_info.Text == "")
            {
                set_info = pro_info1.Text;
            }
            else
            {
                set_info = new_info.Text;
            }

            if (new_price.Value == 0)
            {
                label6.Visible = true;
            }
            else
            {
                label6.Visible = false;
                allisok       += 1;
            }

            if (allisok == 1)
            {
                await product.update_product(mail, pro_name1.Text.ToString(), set_info.ToString(), Convert.ToInt32(new_price.Value), Convert.ToInt32(new_qua.Value), image_path);

                f3.RefreshForm();
                this.Close();
            }
        }
示例#2
0
        private void accept_Click(object sender, EventArgs e)
        {
            int allisok = 0;

            if (item.Text == "")
            {
                label6.Visible  = true;
                label15.Visible = false;
            }
            else
            {
                label15.Visible = false;
                label6.Visible  = false;
                allisok        += 1;
            }

            if (iteminfo.Text == "")
            {
                label7.Visible = true;
            }
            else
            {
                label7.Visible = false;
                allisok       += 1;
            }

            if (price.Value == 0)
            {
                label8.Visible = true;
            }
            else
            {
                label8.Visible = false;
                allisok       += 1;
            }

            if (count.Value == 0)
            {
                label9.Visible = true;
            }
            else
            {
                label9.Visible = false;
                allisok       += 1;
            }

            if (image_path == null)
            {
                label14.Visible = true;
            }
            else
            {
                label14.Visible = false;
                allisok        += 1;
            }

            if (allisok == 5)
            {
                WindowsFormsApplication1.Resources.ProductDB product = new WindowsFormsApplication1.Resources.ProductDB();
                if (product.find_item_is_exist(item.Text.ToString(), email.ToString()) == true)
                {
                    label15.Visible = true;
                }
                else
                {
                    label15.Visible = false;
                    product.add_pro(item.Text.ToString(), iteminfo.Text.ToString(), email.ToString(), Convert.ToInt32(price.Value), Convert.ToInt32(count.Value), image_path);
                    DialogResult result = MessageBox.Show("商品上傳成功!", "完成", MessageBoxButtons.OK);
                    form3.RefreshForm();
                    this.Close();
                }
            }
        }