Esempio n. 1
0
        private void tabControl1_Click(object sender, EventArgs e)//更改个人信息时的事件
        {
            Login   l  = new Login();
            DataSet ds = DBOperate.readDB("select * from UserInfo where UserAccount='" + s + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                lblNum.Text    = (ds.Tables[0].Rows[0][0]).ToString();
                txtName.Text   = (ds.Tables[0].Rows[0][2]).ToString();
                txtMobile.Text = (ds.Tables[0].Rows[0][3]).ToString();
                txtEmail.Text  = (ds.Tables[0].Rows[0][4]).ToString();
            }
            string webpic = "你的oss路径" + lblNum.Text + ".jpg";

            pictureUser.ImageLocation = webpic;
        }
Esempio n. 2
0
        private void btnGUpdate_Click(object sender, EventArgs e)
        {
            Users u = new Users();

            u.Account = txtGAccount.Text.Trim();
            u.Mobile  = txtGMobile.Text.Trim();
            u.Email   = txtGEmail.Text.Trim();
            if (DBOperate.writeDB("update UserInfo set UserMobile='" + u.Mobile + "',UserEmail='" + u.Email + "' where UserAccount = '" + u.Account + "'") > 0)
            {
                MessageBox.Show("修改成功!");
            }
            else
            {
                MessageBox.Show("修改失败!");
            }
        }
Esempio n. 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Users u = new Users();

            u.Account = lblNum.Text;
            u.Name    = txtName.Text.Trim();
            u.Mobile  = txtMobile.Text.Trim();
            u.Email   = txtEmail.Text.Trim();
            if (DBOperate.writeDB("update UserInfo set UserName='******',UserMobile='" + u.Mobile + "',UserEmail='" + u.Email + "' where UserAccount='" + u.Account + "'") > 0)
            {
                MessageBox.Show("保存成功!");
            }
            else
            {
                MessageBox.Show("保存失败!");
            }
        }
Esempio n. 4
0
        private void btnEmailReset_Click(object sender, EventArgs e)
        {
            Random rd = new Random();

            newpassword = (rd.Next(10000000, 100000000)).ToString();//随机生成一个8位数字密码
            DataSet ds = DBOperate.readDB("select * from UserInfo where UserEmail='" + txtEmailReset.Text.Trim() + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (DBOperate.writeDB("update UserInfo set UserPassword='******' where UserEmail='" + txtEmailReset.Text.Trim() + "'") > 0)
                {
                    IClientProfile        profile = DefaultProfile.GetProfile("cn-hangzhou", "阿里云", "密钥");
                    IAcsClient            client  = new DefaultAcsClient(profile);
                    SingleSendMailRequest request = new SingleSendMailRequest();
                    try
                    {
                        String pass = "******";width:99.8%;height:99.8%\";><tbody><tr><td style=\";background:#fafafa url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAAAy0lEQVQY0x2PsQtAYBDFP1keKZfBKIqNycCERUkMKLuSgZnRarIpJX8s3zfcDe9+794du+8bRVHQOI4wDAOmaULTNDDGYFkWMVVVQUTQdZ3iOMZxHCjLElVV0TRNYHVdC7ptW6RpSn3f4wdJkiTs+w6WJAl4DcOAbdugKAq974umaRAEARgXn+cRW3zfFxuiKCJZloXGHMeBbdv4Beq6Duu6Issy7iYB8Jbnucg8zxPLsggnj/zvIxaGIXmeB9d1wSE+nOeZf4HruvABUtou5ypjMF4AAAAASUVORK5CYII=)\";><div style=\";border-radius:10px;font-size:13px;color:#555;width:666px;font-family:'Century Gothic','Trebuchet MS','Hiragino Sans GB','微软雅黑','Microsoft Yahei',Tahoma,Helvetica,Arial,SimSun,sans-serif;margin:50px auto;border:1px solid #eee;max-width:100%;background:#fff repeating-linear-gradient(-45deg,#fff,#fff 1.125rem,transparent 1.125rem,transparent 2.25rem);box-shadow:0 1px 5px rgba(0,0,0,.15)\";><div style=\";width:100%;background:#49BDAD;color:#fff;border-radius:10px 10px 0 0;background-image:-moz-linear-gradient(0deg,#43c6b8,#ffd1f4);background-image:-webkit-linear-gradient(0deg,#43c6b8,#ffd1f4);height:66px\";><p style=\";font-size:15px;word-break:break-all;padding:23px 32px;margin:0;background-color:hsla(0,0%,100%,.4);border-radius:10px 10px 0 0\";>尊敬的图书馆管理系统用户您好:</p></div><div style=\";margin:40px auto;width:90%\";><p>" + newpassword + "是您的新密码,请牢记</p><p>请注意:此邮件自动发送,请勿直接回复。</p></div></div></td></tr></tbody></table>";
                        request.AccountName    = "你的发信域名";
                        request.FromAlias      = "图书管理系统";
                        request.AddressType    = 1;
                        request.TagName        = "BackPassword";
                        request.ReplyToAddress = true;
                        request.ToAddress      = (txtEmailReset.Text.Trim()).ToString();
                        request.Subject        = "图书管理系统的重置后密码";
                        request.HtmlBody       = pass;
                        SingleSendMailResponse httpResponse = client.GetAcsResponse(request);
                    }
                    finally
                    {
                        MessageBox.Show("邮件发送成功,如未收到请联系系统管理员或者在垃圾箱中寻找");
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show("重置失败,请联系系统管理员!");
                }
            }
            else
            {
                MessageBox.Show("请输入注册过该平台的电子邮箱");
            }
        }
Esempio n. 5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            Users r = new Users();

            r.Account  = txtName.Text.Trim();
            r.Password = txtPassword.Text.Trim();
            DataSet ds = DBOperate.readDB("select * from UserInfo where UserAccount='" + r.Account + "' and UserPassword='******' and UserType='管理员'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                Main m = new Main();
                m.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("账号或者密码错误!");
            }
        }
Esempio n. 6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Book b = new Book();

            b.ISBN      = txtISBN.Text.Trim();
            b.Name      = txtBookName.Text.Trim();
            b.Style     = comboBox1.Text.Trim();
            b.Price     = Convert.ToSingle(txtPrice.Text.Trim());
            b.Press     = txtPress.Text.Trim();
            b.Author    = txtAuthor.Text.Trim();
            b.EnterTime = dateTimePicker1.Value.ToShortDateString();
            if (DBOperate.writeDB("insert into Books values('" + b.ISBN + "','" + b.Name + "','" + b.Style + "','" + b.Price + "','" + b.Press + "','" + b.Author + "','" + b.EnterTime + "','否')") > 0)
            { ///把选择的图片上传给阿里云oss
                if (txtName.Text.Trim() != null)
                {
                    var endpoint        = "oss-cn-beijing.aliyuncs.com";
                    var accessKeyId     = "阿里云";
                    var accessKeySecret = "阿里云密钥";
                    var bucketName      = "c-sharp";
                    var objectName      = @"books/" + txtISBN.Text.Trim() + ".jpg";
                    var localFilename   = @"" + upUserStrBook + "";
                    // 创建OSSClient实例。
                    var client = new OssClient(endpoint, accessKeyId, accessKeySecret);
                    try
                    {
                        // 上传文件。
                        var result = client.PutObject(bucketName, objectName, localFilename);
                        Console.WriteLine("Put object succeeded, ETag: {0} ", result.ETag);
                        MessageBox.Show("上传成功");
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine("Put object failed, {0}", ex.Message);
                    }
                    MessageBox.Show("保存成功!");
                }
                else
                {
                    MessageBox.Show("保存失败!");
                }
            }
        }
Esempio n. 7
0
        private void tabControl4_Click(object sender, EventArgs e)//还书界面自动触发事件
        {
            cmbReturn.Items.Clear();
            DataSet dr = DBOperate.readDB("select Books.BookName 书名,Books.ISBN 书号,Books.BookStyle 类型,BorrowTime 借出时间,ReturnTime 应归还时间 from BRBooks INNER JOIN Books  on BRBooks.ISBN=Books.ISBN where BRBooks.UserAccount='" + s + "'");

            if (dr.Tables[0].Rows.Count > 0)
            {
                btnReturn.Enabled        = true;
                dataGridView3.DataSource = dr.Tables[0];
                for (int i = 0; i < dr.Tables[0].Rows.Count; i++)
                {
                    string str = (dr.Tables[0].Rows[i][0]).ToString();
                    cmbReturn.Items.Add(str);
                }
            }
            else if (dr.Tables[0].Rows.Count == 0)
            {
                btnReturn.Enabled = false;
            }
        }
Esempio n. 8
0
        private void btnAlter_Click(object sender, EventArgs e)
        {
            Book b = new Book();

            b.ISBN      = txtBookISBN1.Text.Trim();
            b.Name      = txtBName1.Text.Trim();
            b.Style     = txtBStyle.Text.Trim();
            b.Price     = Convert.ToSingle(txtPrice1.Text.Trim());
            b.Press     = txtPress1.Text.Trim();
            b.Author    = txtAuthor1.Text.Trim();
            b.EnterTime = dateTimePicker2.Value.ToShortDateString();
            b.IsBorrow  = IsBorrow1.Text.Trim();
            if (DBOperate.writeDB("update Books set BookName='" + b.Name + "',BookStyle='" + b.Style + "',Price='" + b.Price + "',Press='" + b.Press + "',Author='" + b.Author + "',EnterTime='" + b.EnterTime + "',IsBorrow='" + b.IsBorrow + "' where ISBN='" + b.ISBN + "'") > 0)
            {
                MessageBox.Show("修改成功!");
            }
            else
            {
                MessageBox.Show("修改失败!");
            }
        }
Esempio n. 9
0
        private void btnReturn_Click(object sender, EventArgs e)//还书按钮事件
        {
            Book br = new Book();

            br.Name = cmbReturn.SelectedItem.ToString();
            DataSet ds = DBOperate.readDB("select * from BRBooks INNER JOIN Books on BRBooks.ISBN=Books.ISBN where BookName='" + br.Name + "'");

            if (ds.Tables[0].Rows.Count > 0)
            {
                // DBOperate.writeDB("update Books set IsBorrow='否' where ISBN='" + br.ISBN + "'");
                DBOperate.writeDB("update Books set IsBorrow='否' where ISBN=(select ISBN from Books where BookName = '" + br.Name + "')");
                DBOperate.writeDB("delete  from BRBooks where ISBN=(select ISBN from Books where BookName =  '" + br.Name + "')");
                cmbReturn.Items.Remove(cmbReturn.SelectedItem);//移除当前选中项
                cmbReturn.Text = "";
                MessageBox.Show("归还成功");
                DataSet dd = DBOperate.readDB("select * from BRBooks INNER JOIN Books on BRBooks.ISBN=Books.ISBN where BookName='" + br.Name + "'");
                dataGridView3.DataSource = dd.Tables[0];
            }
            else
            {
                MessageBox.Show("请选择你借阅的书");
            }
        }
Esempio n. 10
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            Users   u  = new Users();
            DataSet ds = null;

            u.Name = txtSearch.Text.Trim();
            if (txtNumInfo.Text.Trim() == "")
            {
                ds = DBOperate.readDB("select UserAccount 账号,UserName 姓名,UserMobile 手机号,UserEmail 电子邮箱 from UserInfo where UserType='读者'");
                dataGridView1.DataSource = ds.Tables[0];
            }
            else
            {
                ds = DBOperate.readDB("select UserAccount 账号,UserName 姓名,UserMobile 手机号,UserEmail 电子邮箱 from UserInfo where UserName = '******' and UserType='读者'");
                dataGridView1.DataSource = ds.Tables[0];
                if (ds.Tables[0].Rows.Count > 0)
                {
                    txtNumInfo.Text    = (ds.Tables[0].Rows[0][0]).ToString();
                    txtMobileInfo.Text = (ds.Tables[0].Rows[0][2]).ToString();
                    txtEmailInfo.Text  = (ds.Tables[0].Rows[0][3]).ToString();
                }
            }
        }
Esempio n. 11
0
        private void btnBorrow_Click(object sender, EventArgs e)//借书的按钮的事件
        {
            Book br = new Book();

            br.Name = textBox2.Text.Trim();
            DataSet ds = DBOperate.readDB("select * from Books where BookName='" + textBox2.Text.Trim() + "'");

            if (dataGridView2.RowCount >= 1)
            {
                br.IsBorrow = ds.Tables[0].Rows[0][7].ToString();
                if (br.IsBorrow == "是")
                {
                    MessageBox.Show("该书已被借阅");
                    return;
                }
                else
                {
                    br.ISBN = ds.Tables[0].Rows[0][0].ToString();
                    if (DBOperate.writeDB("insert into BRBooks values( '" + br.ISBN + "' ,'" + s + "','" + DateTime.Now.ToShortDateString() + "','" + dateTimePicker1.Value.ToShortDateString() + "')") > 0)
                    {
                        if (DBOperate.writeDB("update Books set IsBorrow='是' where ISBN='" + br.ISBN + "'") > 0)
                        {
                            MessageBox.Show("借阅成功");
                        }
                        else
                        {
                            MessageBox.Show("该书已被借阅");
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("请先输入书名后点击查询!");
            }
        }
Esempio n. 12
0
        int index;                                               //定义下面用于接收是选中的第几行
        private void btnSearch_Click(object sender, EventArgs e) //按类型或者作者查书的事件
        {
            DataSet ds = null;
            Book    b  = new Book();

            b.Style  = txtSearch.Text.Trim();
            b.Author = txtSearch.Text.Trim();
            b.Name   = txtSearch.Text.Trim();
            if (comboBox1.Text == "类型")
            {
                ds = DBOperate.readDB("select ISBN,BookName 书名,BookStyle 类型,Price 价格,Press 出版社,Author 作者,EnterTime 入库时间,IsBorrow 是否借出 from Books where BookStyle like '%" + b.Style + "%'");
                dataGridView1.DataSource = ds.Tables[0];
            }
            else if (comboBox1.Text == "作者")
            {
                ds = DBOperate.readDB("select ISBN,BookName 书名,BookStyle 类型,Price 价格,Press 出版社,Author 作者,EnterTime 入库时间,IsBorrow 是否借出 from Books where Author like '%" + b.Author + "%'");
                dataGridView1.DataSource = ds.Tables[0];
            }
            else
            {
                ds = DBOperate.readDB("select ISBN,BookName 书名,BookStyle 类型,Price 价格,Press 出版社,Author 作者,EnterTime 入库时间,IsBorrow 是否借出 from Books where BookName like '%" + b.Name + "%'");
                dataGridView1.DataSource = ds.Tables[0];
            }
        }
Esempio n. 13
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            Book b = new Book();

            b.ISBN = txtBookISBN1.Text.Trim();
            b.Name = txtBName1.Text.Trim();
            DataSet ds = null;

            if (txtBSearch.Text.Trim() == "")
            {
                ds = DBOperate.readDB("select ISBN,BookName 书籍名称,BookStyle 书籍类型,Price 价格,Press 出版社,Author 作者,EnterTime 购入时间,IsBorrow 是否借出 from Books");
                dataGridView2.DataSource = ds.Tables[0];
            }
            else if (cboBook.Text == "ISBN")
            {
                ds = DBOperate.readDB("select ISBN,BookName 书籍名称,BookStyle 书籍类型,Price 价格,Press 出版社,Author 作者,EnterTime 购入时间,IsBorrow 是否借出 from Books where ISBN = '" + txtBSearch.Text.Trim() + "'");
                dataGridView2.DataSource = ds.Tables[0];
            }
            else if (cboBook.Text == "图书名称")
            {
                ds = DBOperate.readDB("select ISBN,BookName 书籍名称,BookStyle 书籍类型,Price 价格,Press 出版社,Author 作者,EnterTime 购入时间,IsBorrow 是否借出 from Books where BookName= '" + txtBSearch.Text.Trim() + "'");
                dataGridView2.DataSource = ds.Tables[0];
            }
        }
Esempio n. 14
0
        private void btnSelectBooks_Click(object sender, EventArgs e)
        {
            DataSet ds = DBOperate.readDB("select ISBN,BookName 书名,BookStyle 类型,Price 价格,Press 出版社,Author 作者,EnterTime 入库时间,IsBorrow 是否借出 from Books");

            dataGridView1.DataSource = ds.Tables[0];
        }
Esempio n. 15
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (!account.IsMatch(txtANum.Text.Trim()))
            {
                pictureBox10.Visible = true;
            }
            else
            {
                pictureBox10.Visible = false;
            }
            if (!passWord.IsMatch(txtAPass.Text.Trim()))
            {
                pictureBox9.Visible = true;
            }
            else
            {
                pictureBox9.Visible = false;
            }
            if (!name.IsMatch(txtAName.Text.Trim()))
            {
                pictureBox8.Visible = true;
            }
            else
            {
                pictureBox8.Visible = false;
            }
            if (!tel.IsMatch(txtAMobile.Text.Trim()))
            {
                pictureBox7.Visible = true;
            }
            else
            {
                pictureBox7.Visible = false;
            }
            if (!mail.IsMatch(txtAEmail.Text.Trim()))
            {
                pictureBox1.Visible = true;
            }
            else
            {
                pictureBox1.Visible = false;
            }
            Users u = new Users();

            u.Account  = txtANum.Text.Trim();
            u.Password = txtAPass.Text.Trim();
            u.Name     = txtAName.Text.Trim();
            u.Mobile   = txtAMobile.Text.Trim();
            u.Email    = txtAEmail.Text.Trim();
            DataSet ds  = DBOperate.readDB("select * from UserInfo where UserAccount='" + u.Account + "'");
            DataSet ds1 = DBOperate.readDB("select * from UserInfo where UserMobile='" + u.Mobile + "' and UserEmail='" + u.Email + "'");

            if (txtAPass.Text.Trim() != txtAPass2.Text.Trim())
            {
                MessageBox.Show("两次密码输入不一致!");
                return;
            }
            if (ds.Tables[0].Rows.Count > 0)
            {
                MessageBox.Show("当前用户已被注册!");
            }
            else
            {
                if (pictureBox10.Visible || pictureBox9.Visible || pictureBox8.Visible || pictureBox7.Visible || pictureBox1.Visible)
                {
                    MessageBox.Show("信息填写错误!");
                    return;
                }
                else
                {
                    if (ds1.Tables[0].Rows.Count > 0)
                    {
                        MessageBox.Show("当前用户的手机号或者邮箱已被注册!");
                    }
                    else
                    {
                        if (DBOperate.writeDB("insert into UserInfo values('" + u.Account + "','" + u.Password + "','" + u.Name + "','" + u.Mobile + "','" + u.Email + "','管理员')") > 0)
                        {
                            MessageBox.Show("注册成功!");
                        }
                        else
                        {
                            MessageBox.Show("注册失败!");
                        }
                    }
                }
            }
        }
Esempio n. 16
0
        string upUserStr;//设置一个用于接收上传图片路径的字符串
        private void btnUp_Click(object sender, EventArgs e)
        {
            if (!account.IsMatch(txtNum.Text.Trim()))
            {
                pictureBox2.Visible = true;
            }
            else
            {
                pictureBox2.Visible = false;
            }
            if (!passWord.IsMatch(txtPass.Text.Trim()))
            {
                pictureBox3.Visible = true;
            }
            else
            {
                pictureBox3.Visible = false;
            }
            if (!name.IsMatch(txtName.Text.Trim()))
            {
                pictureBox4.Visible = true;
            }
            else
            {
                pictureBox4.Visible = false;
            }
            if (!tel.IsMatch(textPhone.Text.Trim()))
            {
                pictureBox5.Visible = true;
            }
            else
            {
                pictureBox5.Visible = false;
            }
            if (!mail.IsMatch(txtEmail.Text.Trim()))
            {
                pictureBox6.Visible = true;
            }
            else
            {
                pictureBox6.Visible = false;
            }
            Users u = new Users();

            u.Account  = txtNum.Text.Trim();
            u.Password = txtPass.Text.Trim();
            u.Name     = txtName.Text.Trim();
            u.Mobile   = textPhone.Text.Trim();
            u.Email    = txtEmail.Text.Trim();
            DataSet ds  = DBOperate.readDB("select * from UserInfo where UserAccount='" + u.Account + "'");
            DataSet ds1 = DBOperate.readDB("select * from UserInfo where UserMobile='" + u.Mobile + "' and UserEmail='" + u.Email + "'");

            if (txtPass.Text.Trim() != textPass2.Text.Trim())
            {
                MessageBox.Show("两次密码输入不一致!");
                return;
            }
            if (ds.Tables[0].Rows.Count > 0)
            {
                MessageBox.Show("当前用户已被注册!");
            }
            else
            {
                if (pictureBox2.Visible || pictureBox3.Visible || pictureBox4.Visible || pictureBox5.Visible || pictureBox6.Visible)
                {
                    MessageBox.Show("信息填写错误!");
                    return;
                }
                else
                {
                    if (ds1.Tables[0].Rows.Count > 0)
                    {
                        MessageBox.Show("当前用户的手机号或者邮箱已被注册!");
                    }
                    else
                    {
                        if (DBOperate.writeDB("insert into UserInfo values('" + u.Account + "','" + u.Password + "','" + u.Name + "','" + u.Mobile + "','" + u.Email + "','读者')") > 0)
                        {
                            ///传图
                            if (txtName.Text.Trim() != null)
                            {
                                var endpoint        = "oss-cn-beijing.aliyuncs.com";
                                var accessKeyId     = "阿里云";
                                var accessKeySecret = "阿里云密钥";
                                var bucketName      = "c-sharp";
                                var objectName      = @"users/" + u.Account + ".jpg";
                                var localFilename   = @"" + upUserStr + "";
                                // 创建OSSClient实例。
                                var client = new OssClient(endpoint, accessKeyId, accessKeySecret);
                                try
                                {
                                    // 上传文件。
                                    var result = client.PutObject(bucketName, objectName, localFilename);
                                    Console.WriteLine("Put object succeeded, ETag: {0} ", result.ETag);
                                    MessageBox.Show("上传成功");
                                }
                                catch (Exception ex)
                                {
                                    Console.WriteLine("Put object failed, {0}", ex.Message);
                                }
                            }
                            else
                            {
                                MessageBox.Show("图片上传失败,请联系管理员");
                            }
                            MessageBox.Show("注册成功!");
                        }
                        else
                        {
                            MessageBox.Show("注册失败!");
                        }
                    }
                }
            }
        }
Esempio n. 17
0
        private void btnWhole_Click(object sender, EventArgs e)
        {
            DataSet ds = DBOperate.readDB("select Books.ISBN,bookname 书名,bookstyle 类型,price 价格,press 出版社,author 作者,entertime 购入时间,isborrow 是否借出,UserAccount 账号,borrowtime 借出时间,returntime 归还时间 from Books left outer join BRBooks on Books.ISBN=BRBooks.ISBN");

            dataGridView2.DataSource = ds.Tables[0];
        }
Esempio n. 18
0
        string upUserStr;//设置一个用于接收上传图片路径的字符串
        private void btnUp_Click(object sender, EventArgs e)
        {
            Regex account  = new Regex(@"^[a-zA-Z][a-zA-Z0-9]{6,14}$");
            Regex passWord = new Regex(@"^[a-zA-Z0-9]{4,10}$");
            Regex name     = new Regex(@"^[\u4e00-\u9fa5]{2,}$");
            Regex tel      = new Regex(@"^0?(13|14|15|17|18|19)[0-9]{9}$");
            Regex mail     = new Regex(@"^[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?$");
            Users u        = new Users();

            u.Account  = txtNum.Text.Trim();
            u.Password = txtPass.Text.Trim();
            u.Name     = txtName.Text.Trim();
            u.Mobile   = textPhone.Text.Trim();
            u.Email    = txtEmail.Text.Trim();
            if (!account.IsMatch(txtNum.Text.Trim()))
            {
                pictureBox2.Visible = true;
            }
            else
            {
                pictureBox2.Visible = false;
            }
            if (!passWord.IsMatch(txtPass.Text.Trim()))
            {
                pictureBox3.Visible = true;
            }
            else
            {
                pictureBox3.Visible = false;
            }
            if (!name.IsMatch(txtName.Text.Trim()))
            {
                pictureBox4.Visible = true;
            }
            else
            {
                pictureBox4.Visible = false;
            }
            if (!tel.IsMatch(textPhone.Text.Trim()))
            {
                pictureBox5.Visible = true;
            }
            else
            {
                pictureBox5.Visible = false;
            }
            if (!mail.IsMatch(txtEmail.Text.Trim()))
            {
                pictureBox6.Visible = true;
            }
            else
            {
                pictureBox6.Visible = false;
            }
            DataSet ds  = DBOperate.readDB("select * from UserInfo where UserAccount='" + u.Account + "'");
            DataSet ds1 = DBOperate.readDB("select * from UserInfo where UserMobile='" + u.Mobile + "' and UserEmail='" + u.Email + "'");

            if (txtPass.Text.Trim() != textPass2.Text.Trim())
            {
                MessageBox.Show("两次密码输入不一致!");
                return;
            }
            if (ds.Tables[0].Rows.Count > 0)
            {
                MessageBox.Show("当前用户已被注册!");
            }
            else
            {
                if (pictureBox2.Visible || pictureBox3.Visible || pictureBox4.Visible || pictureBox5.Visible || pictureBox6.Visible)
                {
                    MessageBox.Show("信息填写错误!");
                    return;
                }
                else
                {
                    if (ds1.Tables[0].Rows.Count > 0)
                    {
                        MessageBox.Show("当前用户的手机号或者邮箱已被注册!");
                    }
                    else
                    {
                        if (num == textVerificationCode.Text.Trim())
                        {
                            if (DBOperate.writeDB("insert into UserInfo values('" + u.Account + "','" + u.Password + "','" + u.Name + "','" + u.Mobile + "','" + u.Email + "','读者')") > 0)
                            {
                                ///把选择的图片上传给阿里云oss
                                if (txtName.Text.Trim() != null)
                                {
                                    var endpoint        = "oss-cn-beijing.aliyuncs.com";
                                    var accessKeyId     = "你的阿里云";
                                    var accessKeySecret = "你的密钥";
                                    var bucketName      = "c-sharp";
                                    var objectName      = @"users/" + txtNum.Text.Trim() + ".jpg";
                                    var localFilename   = @"" + upUserStr + "";
                                    // 创建OSSClient实例。
                                    var client = new OssClient(endpoint, accessKeyId, accessKeySecret);
                                    try
                                    {
                                        // 上传文件。
                                        var result = client.PutObject(bucketName, objectName, localFilename);
                                        Console.WriteLine("Put object succeeded, ETag: {0} ", result.ETag);
                                        MessageBox.Show("上传成功");
                                    }
                                    catch (Exception ex)
                                    {
                                        Console.WriteLine("Put object failed, {0}", ex.Message);
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("图片上传失败,请联系管理员");
                                }
                                MessageBox.Show("注册成功!");
                                this.Close();
                            }
                            else
                            {
                                MessageBox.Show("注册失败!");
                            }
                        }
                        else
                        {
                            MessageBox.Show("请输入验证码,或验证码不正确!");
                        }
                    }
                }
            }
        }