Exemplo n.º 1
0
        private void signup_Click(object sender, EventArgs e)
        {
            int allisok = 0;

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


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

            if (password.Text == "")
            {
                label8.Visible = true;
            }
            else
            {
                label8.Visible = false;
                allisok       += 1;
            }
            if (confirmpassword.Text != password.Text)
            {
                label3.Visible = true;
            }
            else
            {
                label3.Visible = false;
                allisok       += 1;
            }
            if (allisok == 4)
            {
                WindowsFormsApplication1.Resources.UserDB user = new WindowsFormsApplication1.Resources.UserDB();
                if (user.find_the_user(email.Text.ToString()) == false)
                {
                    user.InsertOne(username.Text.ToString(), email.Text.ToString(), password.Text.ToString());
                    this.Close();
                }
                else
                {
                    label7.Visible  = false;
                    label10.Visible = true;
                }
            }
        }
Exemplo n.º 2
0
        private async void ok_Click(object sender, EventArgs e)
        {
            int allisok = 0;

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


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

            if (confirmp.Text == "" || confirmp.Text != newp.Text)
            {
                label3.Visible = true;
            }
            else
            {
                label3.Visible = false;
                allisok       += 1;
            }

            if (allisok == 3)
            {
                WindowsFormsApplication1.Resources.UserDB user = new WindowsFormsApplication1.Resources.UserDB();
                if (current.Text == await user.get_password(this.email.Text))
                {
                    await user.change_password(this.email.Text, newp.Text);

                    DialogResult result = MessageBox.Show("密碼更改完畢!", "完成", MessageBoxButtons.OK);
                    this.Close();
                }
                else
                {
                    label7.Visible  = false;
                    label10.Visible = true;
                }
            }
        }
Exemplo n.º 3
0
        private async void set_pic()
        {
            WindowsFormsApplication1.Resources.UserDB user = new WindowsFormsApplication1.Resources.UserDB();
            String inputString = await user.get_picture(this.mail.ToString());

            byte[] imageBytes         = Convert.FromBase64String(inputString);
            System.IO.MemoryStream ms = new System.IO.MemoryStream(imageBytes);

            Image  image = Image.FromStream(ms, true, true);
            Bitmap img2  = new Bitmap(image, 80, 80);

            pictureBox1.Image = img2;
        }
Exemplo n.º 4
0
        private async void button1_Click_1(object sender, EventArgs e)
        {
            if (openFileDialog1.ShowDialog() == DialogResult.OK)  // 開啟影像檔
            {
                String input = openFileDialog1.FileName;
                WindowsFormsApplication1.Resources.UserDB user = new WindowsFormsApplication1.Resources.UserDB();
                await user.add_picture(this.email.Text.ToString(), input);

                DialogResult result = MessageBox.Show("大頭貼更新完成!", "成功", MessageBoxButtons.OK);

                set_pic();
            }
        }
        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);
            }
        }
Exemplo n.º 6
0
        private void login_Click(object sender, EventArgs e)
        {
            WindowsFormsApplication1.Resources.UserDB user = new WindowsFormsApplication1.Resources.UserDB();
            if (user.login_success(email.Text.ToString(), password.Text.ToString()) == 0)
            {
                mainform f = new mainform(email.Text.ToString());
                f.Show(this);
                this.Visible = false;
            }
            else if (user.login_success(email.Text.ToString(), password.Text.ToString()) == 1)
            {
                login_error1.Visible = true;
                login_error2.Visible = false;
            }
            else
            {
                login_error1.Visible = false;
                login_error2.Visible = true;
            }

/*
 *          SocketClient sc = SocketClient.GetInstance();
 *          int returnCode = sc.doLogin(email.Text.ToString(), password.Text.ToString());
 *          if (returnCode == 0)
 *          {
 *              mainform f = new mainform(email.Text.ToString());
 *              f.Show(this);
 *              this.Visible = false;
 *          }
 *          else if (returnCode == 1)
 *          {
 *              login_error1.Visible = true;
 *              login_error2.Visible = false;
 *          }
 *          else
 *          {
 *              login_error1.Visible = false;
 *              login_error2.Visible = true;
 *          }*/
        }
Exemplo n.º 7
0
 private async void settext(String email)
 {
     WindowsFormsApplication1.Resources.UserDB user = new WindowsFormsApplication1.Resources.UserDB();
     this.email.Text = email;
     username.Text   = await user.get_user_name(email);
 }