/// <summary> /// 根据学号查询学生订单信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button3_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtSearch.Text)) { MessageBox.Show("请输入要查询的学生的学号"); } else { BLL.UserGoodsBLL objU = new BLL.UserGoodsBLL(); dataGridView1.DataSource = objU.GetList(x => x.uid == Convert.ToInt32(txtSearch.Text.ToString())); dataGridView1.Refresh(); } }
private void frmUsers_Load(object sender, EventArgs e) { this.label1.Parent = pictureBox1; this.label1.BackColor = Color.FromArgb(0, Color.Transparent); this.label2.Parent = pictureBox1; this.label2.BackColor = Color.FromArgb(0, Color.Transparent); this.label3.Parent = pictureBox1; this.label3.BackColor = Color.FromArgb(0, Color.Transparent); this.label4.Parent = pictureBox1; this.label4.BackColor = Color.FromArgb(0, Color.Transparent); this.label5.Parent = pictureBox1; this.label5.BackColor = Color.FromArgb(0, Color.Transparent); this.label6.Parent = pictureBox1; this.label6.BackColor = Color.FromArgb(0, Color.Transparent); this.label9.Parent = pictureBox1; this.label9.BackColor = Color.FromArgb(0, Color.Transparent); this.rbMale.Parent = pictureBox1; this.rbMale.BackColor = Color.FromArgb(0, Color.Transparent); this.rbFemale.Parent = pictureBox1; this.rbFemale.BackColor = Color.FromArgb(0, Color.Transparent); BLL.UsersBLL objU = new BLL.UsersBLL(); dataGridView2.DataSource = objU.GetList(x => true); dataGridView2.Refresh(); BLL.UserGoodsBLL objUB = new BLL.UserGoodsBLL(); dataGridView1.DataSource = objUB.GetList(x => true); dataGridView1.Refresh(); dataGridView2.Columns[0].HeaderCell.Value = "学生ID"; dataGridView2.Columns[1].HeaderCell.Value = "姓名"; dataGridView2.Columns[2].HeaderCell.Value = "性别"; dataGridView2.Columns[3].HeaderCell.Value = "密码"; dataGridView2.Columns[4].HeaderCell.Value = "学校"; dataGridView1.Columns[0].HeaderCell.Value = "学生ID"; dataGridView1.Columns[1].HeaderCell.Value = "商品ID"; dataGridView1.Columns[2].HeaderCell.Value = "商品类别"; dataGridView1.Columns[3].HeaderCell.Value = "商品名称"; dataGridView1.Columns[4].HeaderCell.Value = "商品价格"; dataGridView1.Columns[5].HeaderCell.Value = "商品状态"; }
private void button5_Click(object sender, EventArgs e) { int uid = (int)(dataGridView1.SelectedRows[0].Cells["uid"].Value); int gid = (int)(dataGridView1.SelectedRows[0].Cells["gid"].Value); string SQL = String.Format("delete from UserGoods where uid = {0} and gid = {1}", uid, gid); if (SqlHelper.ExcuteSQL(SQL) > 0) { MessageBox.Show("删除成功"); BLL.UserGoodsBLL objUB = new BLL.UserGoodsBLL(); dataGridView1.DataSource = objUB.GetList(x => true); dataGridView1.Refresh(); } else { MessageBox.Show("删除失败"); } }
private void btnUdelete_Click(object sender, EventArgs e) { BLL.UserGoodsBLL objU = new BLL.UserGoodsBLL(); dataGridView1.DataSource = objU.GetList(x => true); dataGridView1.Refresh(); }