Пример #1
0
 private void btnSend_Click(object sender, EventArgs e)
 {
     if (AccessOperation.Exists("Select * From Login where UserName = '******'") == false)
     {
         MessageBox.Show("该用户不存在!");
         txtUser.Text  = "";
         txtEmail.Text = "";
         return;
     }
     if (AccessOperation.Exists("Select * From Login where UserName = '******' and Email = '" + txtEmail.Text + "'") == false)
     {
         MessageBox.Show("邮箱未与该用户绑定!");
         txtEmail.Text = "";
         return;
     }
     try
     {
         string sendName   = "*****@*****.**";
         string sendPass   = "******";
         string reciveName = txtEmail.Text;
         string title      = "电影爱好者平台验证码";
         Random rd         = new Random();
         code1 = rd.Next(100000, 999999);
         string content = code1.ToString();
         SendEmail(sendName, sendPass, reciveName, title, content, "smtp.qq.com");
         timer1.Start();
         t = 60;
     }
     catch
     {
         MessageBox.Show("验证码发送失败!");
     }
 }
Пример #2
0
        private void btnYes_Click(object sender, EventArgs e)
        {
            Regex pattern_password = new Regex(@"[\da-zA-Z0-9]{6,15}");

            if (!pattern_password.IsMatch(txtUser.Text))
            {
                MessageBox.Show("密码应为6到15位字母或数字!");
                txtPs1.Text = "";
                txtPs2.Text = "";
                return;
            }
            if (!txtPs1.Text.Equals(txtPs2.Text))
            {
                MessageBox.Show("两次输入的新密码不同!");
                txtPs1.Text = "";
                txtPs2.Text = "";
                return;
            }
            try
            {
                AccessOperation.ExecuteNonQuery("Update [Login] Set [Password]='" + txtPs1.Text + "' Where [UserName]='" + txtUser.Text + "'");
                MessageBox.Show("密码更改成功!");
                this.Hide();
                new Login().Show();
            }
            catch
            {
                MessageBox.Show("未知错误未能更新密码!");
            }
        }
Пример #3
0
 private void textChanged(object sender, EventArgs e)
 {
     if (sender.Equals(cbUser))
     {
         labelUser.Visible = cbUser.Text.Length < 1;
         string s = "";
         try
         {
             s = AccessOperation.ExecuteScalar("Select Image From Messages where UserName = '******'").ToString();
         }
         catch
         {
             Bitmap bmp = new Bitmap("timg.jpg");
             pictureBox1.Image = bmp;
         }
         if (s != "")
         {
             if (File.Exists("D://image//" + s + ".bmp"))
             {
                 Bitmap bmp = new Bitmap("D://image//" + s + ".bmp");
                 pictureBox1.Image = bmp;
             }
             else
             {
                 Bitmap bmp = new Bitmap("timg.jpg");
                 pictureBox1.Image = bmp;
             }
         }
     }
     else if (sender.Equals(txtPwd))
     {
         labelPwd.Visible = txtPwd.Text.Length < 1;
     }
 }
Пример #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Bitmap   bmp = new Bitmap(pictureBox1.Image, pictureBox1.Width, pictureBox1.Height);
            Graphics g   = Graphics.FromImage(bmp);

            //检查是否存在文件夹
            string subPath = "D://image";

            if (false == System.IO.Directory.Exists(subPath))
            {
                //创建pic文件夹
                System.IO.Directory.CreateDirectory(subPath);
            }
            try {
                bmp.Save("D://image//" + strFilePath + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp);
                Bitmap bmps = new Bitmap("D://image//" + strFilePath + ".bmp");
                pictureBox1.Image = bmps;
                AccessOperation.ExecuteNonQuery("Update [Messages] Set [Image]='" + strFilePath + "' Where [UserName]='" + username + "'");
            }
            catch
            {
                MessageBox.Show("保存失败(尝试更改文件名后上传)");
                return;
            }
            MessageBox.Show("保存成功!");
        }
Пример #5
0
        public UserMessages(string u)
        {
            InitializeComponent();
            username        = u;
            UserName.Text   = u;
            btnSave.Enabled = false;
            txtSign.Text    = AccessOperation.ExecuteScalar("Select Sign From Messages Where UserName='******'").ToString();
            try
            {
                s = AccessOperation.ExecuteScalar("Select Image From Messages Where UserName='******'").ToString();
            }
            catch
            {
                s = "";
            }
            try
            {
                Bitmap bmp = new Bitmap("D://image//" + s + ".bmp");
                pictureBox1.Image = bmp;
            }
            catch
            {
                Bitmap bmp = new Bitmap("timg.jpg");
                pictureBox1.Image = bmp;
            }
            txtSign2.Text = txtSign.Text;
            txtName.Text  = AccessOperation.ExecuteScalar("Select RealName From Messages Where UserName='******'").ToString();
            txtOld.Text   = AccessOperation.ExecuteScalar("Select Old From Messages Where UserName='******'").ToString();
            cbSex.Text    = AccessOperation.ExecuteScalar("Select Sex From Messages Where UserName='******'").ToString();
            cbStyle.Text  = AccessOperation.ExecuteScalar("Select Style From Messages Where UserName='******'").ToString();

            DataSet myDataSet = AccessOperation.Query("Select * From Record Where UserName='******'", "Record");

            dataGridView1.DataSource = myDataSet.Tables["Record"];
        }
Пример #6
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         //MessageBox.Show("");
         AccessOperation.ExecuteNonQuery("Insert Into [Record] ([Movie], [UserName], [Link]) VALUES('" + MovieName + "', '" + username + "', '" + textBox1.Text + "')");
         MessageBox.Show("收藏成功!");
     }
     catch
     {
         MessageBox.Show("收藏失败!");
     }
 }
Пример #7
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (movies != "")
     {
         AccessOperation.ExecuteNonQuery("Delete * From Record Where Movie = '" + movies + "' and UserName='******'");
         MessageBox.Show("删除成功!");
         DataSet myDataSet = AccessOperation.Query("Select * From Record Where UserName='******'", "Record");
         dataGridView1.DataSource = myDataSet.Tables["Record"];
     }
     else
     {
         MessageBox.Show("未选中行!");
     }
 }
Пример #8
0
 private void btnSavemessage_Click(object sender, EventArgs e)
 {
     try
     {
         AccessOperation.ExecuteNonQuery("Insert Into [Messages] ([UserName], [RealName], [Sign],[Sex],[Old],[Style]) VALUES('" + username + "', '" + txtName.Text + "', '" + txtSign2.Text + "','" + cbSex.Text + "','" + txtOld.Text + "','" + cbStyle.Text + "')");
         MessageBox.Show("信息插入成功!");
         this.Hide();
         new Login().Show();
     }
     catch
     {
         MessageBox.Show("信息插入失败(未知错误)!");
     }
 }
Пример #9
0
        private void btnSavemessage_Click(object sender, EventArgs e)
        {
            try
            {
                AccessOperation.ExecuteNonQuery("Update Messages Set Sex='" + cbSex.Text + "' Where UserName='******'");
                AccessOperation.ExecuteNonQuery("Update Messages Set Sign='" + txtSign2.Text + "' Where UserName='******'");
                AccessOperation.ExecuteNonQuery("Update Messages Set Old='" + txtOld.Text + "' Where UserName='******'");
                AccessOperation.ExecuteNonQuery("Update Messages Set RealName='" + txtName.Text + "' Where UserName='******'");
                AccessOperation.ExecuteNonQuery("Update Messages Set Style='" + cbStyle.Text + "' Where UserName='******'");
                MessageBox.Show("信息更新成功,界面主题会在下次开启本软件时更新!");

                skinEngine1.SkinFile = @"Skins\" + AccessOperation.ExecuteScalar("Select Style From Messages Where UserName='******'").ToString();
            }
            catch
            {
                MessageBox.Show("信息更新失败(未知错误)!");
            }
        }
Пример #10
0
 public Login()
 {
     InitializeComponent();
     this.skinEngine1.SkinFile = @"Skins\Calmness.ssk";
     try
     {
         OleDbDataReader reader = AccessOperation.ExecuteReader("Select UserName From UsedUser");
         List <string>   list   = new List <string>();
         while (reader.Read())
         {
             list.Add(reader.GetString(0));
         }
         cbUser.DataSource = list;
     }
     catch
     {
         MessageBox.Show("数据库无法打开!");
         Application.Exit();
     }
 }
Пример #11
0
        private void btnPost_Click(object sender, EventArgs e)
        {
            if (AccessOperation.Exists("Select * From Login where Password = '******' and UserName = '******'") == false)
            {
                MessageBox.Show("原密码错误!");
                txtps1.Text = "";
                txtps2.Text = "";
                txtps3.Text = "";
                return;
            }
            if (txtps1.Text == "" || txtps2.Text == "" || txtps3.Text == "")
            {
                MessageBox.Show("更改密码所需信息不能为空!");
                return;
            }
            Regex pattern_password = new Regex(@"[\da-zA-Z0-9]{6,15}");

            if (!pattern_password.IsMatch(txtps2.Text))
            {
                MessageBox.Show("密码应为6到15位字母或数字!");
                txtps2.Text = "";
                txtps3.Text = "";
                return;
            }
            if (!txtps2.Text.Equals(txtps3.Text))
            {
                MessageBox.Show("两次输入的新密码不同!");
                txtps2.Text = "";
                txtps3.Text = "";
                return;
            }
            try
            {
                AccessOperation.ExecuteNonQuery("Update [Login] Set [Password]='" + txtps2.Text + "' Where [UserName]='" + username + "'");
                MessageBox.Show("修改完成!");
            }catch
            {
                MessageBox.Show("修改失败!");
            }
        }
Пример #12
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (txtPwd.Text.Length == 0 || cbUser.Text.Length == 0)
     {
         MessageBox.Show("用户名或密码不能为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (AccessOperation.Exists("Select * From Login where UserName='******'") == false)
     {
         MessageBox.Show("用户不存在!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (AccessOperation.Exists("Select * From Login where Password = '******' and UserName = '******'") == false)
     {
         MessageBox.Show("密码错误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     if (AccessOperation.Exists("Select * From Login where Password = '******' and UserName = '******'"))
     {
         username = cbUser.Text;
         MessageBox.Show("欢迎使用电影爱好者平台!");
         if (!AccessOperation.Exists("Select * From UsedUser where UserName = '******'"))
         {
             try
             {
                 AccessOperation.ExecuteNonQuery("Insert Into [UsedUser] VALUES('" + cbUser.Text + "')");
             }catch
             {
                 MessageBox.Show("未能插入本次登陆记录");
             }
         }
         this.Hide();
         this.skinEngine1.SkinFile = @"Skins\" + AccessOperation.ExecuteScalar("Select Style From Messages where UserName = '******'");
         new Main(username).Show();
         return;
     }
 }
Пример #13
0
        public Main(string u)
        {
            InitializeComponent();
            //MessageBox.Show(skin);
            //MessageBox.Show(skinEngine1.SkinFile);
            this.username = u;
            UserName.Text = u;

            try
            {
                txtSign.Text = AccessOperation.ExecuteScalar("Select Sign From Messages Where UserName='******'").ToString();
            }catch (Exception ex) {
                MessageBox.Show(ex.ToString());
            }
            try
            {
                string s   = AccessOperation.ExecuteScalar("Select Image From Messages Where UserName='******'").ToString();
                Bitmap bmp = new Bitmap("D://image//" + s + ".bmp");
                pictureBox1.Image = bmp;
            }
            catch
            {
                Bitmap bmp = new Bitmap("timg.jpg");
                pictureBox1.Image = bmp;
            }

            LvHot.Columns.Add("片名", 178, HorizontalAlignment.Center);
            LvHot.Columns.Add("时间", 65, HorizontalAlignment.Center);
            LvHot.Columns.Add("评分", 65, HorizontalAlignment.Center);
            LvHot.Columns.Add("时长", 114, HorizontalAlignment.Center);
            LvHot.Columns.Add("产地", 94, HorizontalAlignment.Center);
            LvHot.Columns.Add("演员", 315, HorizontalAlignment.Center);

            LvHot.BeginUpdate();

            cn.smallfunny.web.model_movies[] HotMovies = null;

            try
            {
                HotMovies = Movies.Message();
            }
            catch
            {
                MessageBox.Show("初始化失败!");
                this.Hide();
                new Login().Show();
                return;
            }

            for (int i = 0; i < HotMovies.Length; i++)
            {
                ListViewItem item = new ListViewItem();
                HotLinks[i] = HotMovies[i].Link;
                item.Text   = HotMovies[i].Name;
                item.SubItems.Add(HotMovies[i].Times);
                item.SubItems.Add(HotMovies[i].Rate);
                item.SubItems.Add(HotMovies[i].Duration);
                item.SubItems.Add(HotMovies[i].Place);
                item.SubItems.Add(HotMovies[i].Actor);
                LvHot.Items.Add(item);
            }

            LvHot.EndUpdate();
        }
Пример #14
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            Regex pattern_email    = new Regex(@"^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$");
            Regex pattern_username = new Regex(@"[\da-zA-Z0-9]{2,10}");
            Regex pattern_password = new Regex(@"[\da-zA-Z0-9]{6,15}");

            if (txtUser.Text.Length == 0)
            {
                MessageBox.Show("用户名不能为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (txtEmail.Text.Length == 0)
            {
                MessageBox.Show("邮箱不能为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (txtPwd.Text.Length == 0)
            {
                MessageBox.Show("密码不能为空!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (AccessOperation.Exists("Select * From Login where UserName='******'") != false)
            {
                MessageBox.Show("用户名重复!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUser.Text = "";
                return;
            }
            if (!pattern_username.IsMatch(txtUser.Text))
            {
                MessageBox.Show("用户名应为2到10位字母或数字!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUser.Text = "";
                return;
            }
            if (AccessOperation.Exists("Select * From Login where Email='" + txtEmail.Text + "'"))
            {
                MessageBox.Show("邮箱已使用!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEmail.Text = "";
                return;
            }
            if (!pattern_email.IsMatch(txtEmail.Text))
            {
                MessageBox.Show("邮箱格式错误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEmail.Text = "";
                return;
            }
            if (!pattern_password.IsMatch(txtUser.Text))
            {
                MessageBox.Show("密码应为6到15位字母或数字!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPwd.Text    = "";
                txtRepeat.Text = "";
                return;
            }
            if (txtRepeat.Text.Equals(txtPwd.Text) == false)
            {
                MessageBox.Show("密码两次输入不相同!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPwd.Text    = "";
                txtRepeat.Text = "";
                return;
            }
            AccessOperation.ExecuteNonQuery("Insert Into [Login] ([UserName], [Password], [Email]) VALUES('" + txtUser.Text + "', '" + txtPwd.Text + "', '" + txtEmail.Text + "')");
            MessageBox.Show("注册成功!");
            this.Hide();
            new InputMessages(txtUser.Text).Show();
            return;
        }