📄 hyxs.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace bggl.fm
{
/// <summary>
/// hyxs 的摘要说明。
/// </summary>
public class hyxs : System.Windows.Forms.Form
{
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.ColumnHeader columnHeader3;
private System.Windows.Forms.ColumnHeader columnHeader7;
private System.Windows.Forms.ColumnHeader columnHeader8;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.ColumnHeader columnHeader2;
private System.Windows.Forms.Button button3;
TextBox tb1;//传过来的控件
ComboBox cb1;
TextBox tb2;
TextBox tb3;
TextBox tb4;
int pd=0;
private System.Windows.Forms.Button button4;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public hyxs(TextBox t1,ComboBox c1,TextBox t2,TextBox t3,TextBox t4,int z)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
tb1=t1;
cb1=c1;
tb2=t2;
tb3=t3;
tb4=t4;
pd=z;
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
public hyxs(TextBox t1,TextBox t2,TextBox t3,int z){
InitializeComponent();
tb1=t1;
tb2=t2;
tb3=t3;
pd=z;
}
public hyxs(TextBox t1,TextBox t2,int z)
{
InitializeComponent();
tb1=t1;
tb2=t2;
pd=z;
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.listView1 = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
this.columnHeader7 = new System.Windows.Forms.ColumnHeader();
this.columnHeader8 = new System.Windows.Forms.ColumnHeader();
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// listView1
//
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1,
this.columnHeader3,
this.columnHeader2,
this.columnHeader7,
this.columnHeader8});
this.listView1.FullRowSelect = true;
this.listView1.GridLines = true;
this.listView1.Location = new System.Drawing.Point(8, 48);
this.listView1.Name = "listView1";
this.listView1.Size = new System.Drawing.Size(456, 152);
this.listView1.TabIndex = 1;
this.listView1.View = System.Windows.Forms.View.Details;
this.listView1.DoubleClick += new System.EventHandler(this.listView1_DoubleClick);
//
// columnHeader1
//
this.columnHeader1.Text = "会员卡号";
this.columnHeader1.Width = 100;
//
// columnHeader3
//
this.columnHeader3.Text = "会员姓名";
this.columnHeader3.Width = 80;
//
// columnHeader2
//
this.columnHeader2.Text = "会员性别";
//
// columnHeader7
//
this.columnHeader7.Text = "会员身份证号码";
this.columnHeader7.Width = 150;
//
// columnHeader8
//
this.columnHeader8.Text = "会员折扣";
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 16);
this.label1.TabIndex = 2;
this.label1.Text = "会员姓名:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(72, 14);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(104, 21);
this.textBox1.TabIndex = 3;
this.textBox1.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(184, 12);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(64, 24);
this.button1.TabIndex = 4;
this.button1.Text = "查询";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(400, 12);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(64, 24);
this.button2.TabIndex = 5;
this.button2.Text = "注册会员";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(328, 12);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(64, 24);
this.button3.TabIndex = 6;
this.button3.Text = "取消";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(256, 12);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(64, 24);
this.button4.TabIndex = 7;
this.button4.Text = "刷新";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// hyxs
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(472, 205);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.listView1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Name = "hyxs";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "会员选择";
this.Load += new System.EventHandler(this.hyxs_Load);
this.ResumeLayout(false);
}
#endregion
private void hyxs_Load(object sender, System.EventArgs e)
{
fz();
}
private void fz(){
cs.hysql hysq=new bggl.cs.hysql();
DataSet objset=hysq.selectexe();
this.listView1.Items.Clear();
foreach(DataRow dr in objset.Tables[0].Rows){
ListViewItem lst=new ListViewItem();
lst.SubItems.Clear();
lst.SubItems[0].Text=dr["hid"].ToString();
lst.SubItems.Add(dr["hname"].ToString());
lst.SubItems.Add(dr["hxb"].ToString());
lst.SubItems.Add(dr["hsfz"].ToString());
lst.SubItems.Add(dr["hzk"].ToString());
this.listView1.Items.Add(lst);
}
}
private void button3_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void listView1_DoubleClick(object sender, System.EventArgs e)
{
string zhi=this.listView1.SelectedItems[0].SubItems[0].Text;
if(pd==1)
{
if(zhi.Trim()!="")
{
tb1.Text=this.listView1.SelectedItems[0].SubItems[1].Text;
if(this.listView1.SelectedItems[0].SubItems[2].Text.Trim()=="男")
{
cb1.SelectedIndex=0;
}
else
{
cb1.SelectedIndex=1;
}
tb2.Text=this.listView1.SelectedItems[0].SubItems[3].Text;
tb3.Text=this.listView1.SelectedItems[0].SubItems[0].Text;
tb4.Text=this.listView1.SelectedItems[0].SubItems[4].Text;
this.Close();
}
}
if(pd==2)
{
tb1.Text=this.listView1.SelectedItems[0].SubItems[1].Text;
tb2.Text=this.listView1.SelectedItems[0].SubItems[4].Text;
tb3.Text=this.listView1.SelectedItems[0].SubItems[0].Text;
this.Close();
}
if(pd==3){
tb1.Text=this.listView1.SelectedItems[0].SubItems[1].Text;
tb2.Text=this.listView1.SelectedItems[0].SubItems[0].Text;
this.Close();
}
}
private void button1_Click(object sender, System.EventArgs e)
{
cs.hysql hysq=new bggl.cs.hysql();
DataSet objset=hysq.selectexe("",this.textBox1.Text.Trim());
this.listView1.Items.Clear();
foreach(DataRow dr in objset.Tables[0].Rows)
{
ListViewItem lst=new ListViewItem();
lst.SubItems.Clear();
lst.SubItems[0].Text=dr["hid"].ToString();
lst.SubItems.Add(dr["hname"].ToString());
lst.SubItems.Add(dr["hxb"].ToString());
lst.SubItems.Add(dr["hsfz"].ToString());
lst.SubItems.Add(dr["hzk"].ToString());
this.listView1.Items.Add(lst);
}
}
private void button2_Click(object sender, System.EventArgs e)
{
hyyw hy=new hyyw();
hy.ShowDialog();
hy.Dispose();
}
private void button4_Click(object sender, System.EventArgs e)
{
fz();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -