//按卡号\账户名称查询 private void btnSelect_Click(object sender, EventArgs e) { string userInfoName = this.txtidno.Text; if (string.IsNullOrEmpty(this.txtidno.Text)) { this.dgvUser.DataSource = UserInfoManage.GetAllUserinfos(); } else { this.dgvUser.DataSource = UserInfoManage.GetSelectUserinfoByIDOrName(userInfoName); } }
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { if (tabControl1.SelectedTab == tpplus) //创建新卡选项卡 { ReadInfo(txtxiaofeiID, txtxiaofeiName); } else if (tabControl1.SelectedTab == tpplus)//账户充值选项卡 { while (getinvatehandle && string.IsNullOrEmpty(txtxiaofeiID.Text)) { ReadInfo(txtxiaofeiID, txtxiaofeiName); } } else if (tabControl1.SelectedTab == tpselect)//账户查询选项卡 { this.dgvUser.DataSource = UserInfoManage.GetAllUserinfos(); } else if (tabControl1.SelectedTab == tpMinus) //消费记录选项卡 { this.dgv.DataSource = UserInfoxiaofeiManage.SelectUserxiaofeiinfo(); } else if (tabControl1.SelectedTab == tpgoods) //商品购物选项卡 { this.listView1.Items.Clear(); //清空列表 this.listView1.View = View.LargeIcon; //视图样式 List <GoodsInfo> list = GoodsInfoManage.AllGoodsInfo(); foreach (GoodsInfo model in list) { ListViewItem item = new ListViewItem(); item.SubItems[0].Text = model.GoodsName + "\n\t¥" + Math.Round(Convert.ToDecimal(model.GoodsPrice), 2); item.Name = model.GoodsID.ToString(); item.ImageIndex = model.GoodsID - 1000; this.listView1.Items.Add(item); } if (listView1.Items.Count > 0) { listView1.Select(); listView1.Items[0].Selected = true; } while (getinvatehandle && string.IsNullOrEmpty(txtGoodsuserID.Text)) { ReadInfo(txtGoodsuserID, txtGoodsuserName); } } }