Ejemplo n.º 1
0
        private void set_notify()
        {
            WindowsFormsApplication1.Resources.BuyDB buy = new WindowsFormsApplication1.Resources.BuyDB();
            int counting = buy.howmanybuyer(this.mail.ToString());

            if (counting > counting_product)
            {
                number.Text      = (counting - counting_product).ToString();
                counting_product = counting;
                number.Visible   = true;
            }
            else
            {
                number.Visible = false;
            }
        }
Ejemplo n.º 2
0
        private async void set_order()
        {
            List <Resources.Buy> orders;

            WindowsFormsApplication1.Resources.BuyDB buy = new WindowsFormsApplication1.Resources.BuyDB();
            orders = await buy.get_order(mail);

            int count = buy.order_count(mail);

            for (int i = 0; i < count; i++)
            {
                String[] row  = { orders[i].ProductName, orders[i].Count.ToString(), (orders[i].Price * orders[i].Count).ToString() };
                var      item = new ListViewItem(row);
                listView1.Items.Add(item);
            }
        }
        private async void set_order()
        {
            List <Resources.Buy> orders;

            WindowsFormsApplication1.Resources.BuyDB  buy  = new WindowsFormsApplication1.Resources.BuyDB();
            WindowsFormsApplication1.Resources.UserDB user = new WindowsFormsApplication1.Resources.UserDB();
            orders = await buy.order_notify(mail);

            int count = buy.howmanybuyer(mail);

            for (int i = 0; i < count; i++)
            {
                String username = await user.get_user_name(orders[i].BuyerEmail);

                String[] row  = { orders[i].ProductName, username, orders[i].BuyerEmail, orders[i].Count.ToString() };
                var      item = new ListViewItem(row);
                listView1.Items.Add(item);
            }
        }
Ejemplo n.º 4
0
        private async void button1_Click(object sender, EventArgs e)
        {
            WindowsFormsApplication1.Resources.ProductDB product = new WindowsFormsApplication1.Resources.ProductDB();
            var product_list = await product.get_allproduct();

            int          buyone = product_list[digiger].Count - (int)buy_howmuch.Value;
            DialogResult result = MessageBox.Show("總金額為: " + (int)buy_howmuch.Value * product_list[digiger].Price + "元\n是否確定要購買此商品", "注意", MessageBoxButtons.YesNo);

            if (DialogResult.Yes == result)
            {
                WindowsFormsApplication1.Resources.BuyDB buy = new WindowsFormsApplication1.Resources.BuyDB();

                buy.add_buy(buyeremail, product_list[digiger].ProductName.ToString(), product_list[digiger].Price, int.Parse(buy_howmuch.Value.ToString()), owneremail);

                await product.buy_product(product_list[digiger].OwnerEmail, product_list[digiger].ProductName, buyone);

                DialogResult result1 = MessageBox.Show("您可以在\"我的資料\"中的\"訂單查詢\"\n持續追蹤您的訂單資訊!", "購買成功", MessageBoxButtons.OK);
                form.RefreshForm();
                this.Close();
            }
        }
Ejemplo n.º 5
0
        private async void set_product()
        {
            flowLayoutPanel1.VerticalScroll.Visible = true;
            flowLayoutPanel1.AutoScroll             = true;
            WindowsFormsApplication1.Resources.ProductDB product = new WindowsFormsApplication1.Resources.ProductDB();
            WindowsFormsApplication1.Resources.BuyDB     buy     = new WindowsFormsApplication1.Resources.BuyDB();
            int count = product.sell_product(this.mail.ToString());

            if (count > 0)
            {
                var product_list = await product.get_product(this.mail.ToString());

                List <Button> btns  = new List <Button>();
                List <Button> btns2 = new List <Button>();
                for (int i = 0; i < count; i++)
                {
                    GroupBox gb = new GroupBox();
                    gb.Width  = 200;
                    gb.Height = 335;
                    gb.Margin = new Padding(15, 20, 0, 20);


                    PictureBox picbox = new PictureBox();
                    picbox.Width  = 200;
                    picbox.Height = 200;

                    Label l1 = new Label();
                    l1.Font     = new Font("Arial", 12, FontStyle.Regular);
                    l1.AutoSize = true;
                    l1.Location = new Point(5, 205);
                    l1.Visible  = true;
                    l1.Text     = "商品名稱:";

                    Label pro_name = new Label();
                    pro_name.Font     = new Font("Arial", 12, FontStyle.Regular);
                    pro_name.AutoSize = true;
                    pro_name.Location = new Point(80, 205);
                    pro_name.Visible  = true;
                    pro_name.Text     = product_list[i].ProductName;

                    Label l2 = new Label();
                    l2.Font     = new Font("Arial", 12, FontStyle.Regular);
                    l2.AutoSize = true;
                    l2.Location = new Point(5, 225);
                    l2.Visible  = true;
                    l2.Text     = "商品資訊:";

                    Label pro_info = new Label();
                    pro_info.Font     = new Font("Arial", 12, FontStyle.Regular);
                    pro_info.AutoSize = true;
                    pro_info.Location = new Point(80, 225);
                    pro_info.Visible  = true;
                    pro_info.Text     = product_list[i].Infomation;

                    Label l3 = new Label();
                    l3.Font     = new Font("Arial", 12, FontStyle.Regular);
                    l3.AutoSize = true;
                    l3.Location = new Point(5, 245);
                    l3.Visible  = true;
                    l3.Text     = "商品價格:";

                    Label pro_price = new Label();
                    pro_price.Font     = new Font("Arial", 12, FontStyle.Regular);
                    pro_price.AutoSize = true;
                    pro_price.Location = new Point(80, 245);
                    pro_price.Visible  = true;
                    pro_price.Text     = "$ " + Convert.ToString(product_list[i].Price);

                    Label l4 = new Label();
                    l4.Font     = new Font("Arial", 12, FontStyle.Regular);
                    l4.AutoSize = true;
                    l4.Location = new Point(5, 265);
                    l4.Visible  = true;
                    l4.Text     = "剩餘數量:";

                    Label pro_count = new Label();
                    pro_count.Font     = new Font("Arial", 12, FontStyle.Regular);
                    pro_count.AutoSize = true;
                    pro_count.Location = new Point(80, 265);
                    pro_count.Visible  = true;
                    pro_count.Text     = Convert.ToString(product_list[i].Count) + "件";

                    Button btn = new Button();
                    btn.BackColor = Color.GreenYellow;
                    btn.Width     = 85;
                    btn.Height    = 35;
                    btn.Text      = "修改!";
                    btn.Location  = new Point(10, 290);
                    btns.Add(btn);
                    btns[i].Tag    = i;
                    btns[i].Click += new EventHandler(this.btns_Click);

                    Button btn2 = new Button();
                    btn2.BackColor = Color.OrangeRed;
                    btn2.Width     = 85;
                    btn2.Height    = 35;
                    btn2.Text      = "刪除!";
                    btn2.Location  = new Point(105, 290);
                    btns2.Add(btn2);
                    btns2[i].Tag    = i;
                    btns2[i].Click += new EventHandler(this.btns2_Click);

                    //picbox.Image = WindowsFormsApplication1.Properties.Resources.face_photo;
                    set_pro_pic(picbox, product_list[i].Product_image);
                    picbox.Size     = new System.Drawing.Size(200, 200);
                    picbox.SizeMode = PictureBoxSizeMode.Zoom;


                    gb.Controls.Add(picbox);
                    gb.Controls.Add(l1);
                    gb.Controls.Add(pro_name);
                    gb.Controls.Add(l2);
                    gb.Controls.Add(pro_info);
                    gb.Controls.Add(l3);
                    gb.Controls.Add(pro_price);
                    gb.Controls.Add(l4);
                    gb.Controls.Add(pro_count);
                    gb.Controls.Add(btn);
                    gb.Controls.Add(btn2);
                    flowLayoutPanel1.Controls.Add(gb);
                }
            }
        }