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; } }
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"]; }
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("信息更新失败(未知错误)!"); } }
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; } }
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(); }