📄 searchform.cs
字号:
this.textBox6.Location = new System.Drawing.Point(312, 296);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(112, 21);
this.textBox6.TabIndex = 15;
this.textBox6.Text = "";
//
// label8
//
this.label8.Location = new System.Drawing.Point(56, 296);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(64, 16);
this.label8.TabIndex = 14;
this.label8.Text = "内容简介";
//
// label7
//
this.label7.Location = new System.Drawing.Point(56, 264);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(64, 16);
this.label7.TabIndex = 13;
this.label7.Text = "价格";
//
// label6
//
this.label6.Location = new System.Drawing.Point(280, 232);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(16, 16);
this.label6.TabIndex = 12;
this.label6.Text = "至";
//
// dtp2
//
this.dtp2.Location = new System.Drawing.Point(312, 232);
this.dtp2.Name = "dtp2";
this.dtp2.Size = new System.Drawing.Size(112, 21);
this.dtp2.TabIndex = 11;
//
// dtp1
//
this.dtp1.Location = new System.Drawing.Point(160, 232);
this.dtp1.Name = "dtp1";
this.dtp1.Size = new System.Drawing.Size(112, 21);
this.dtp1.TabIndex = 10;
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(312, 264);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(112, 21);
this.textBox5.TabIndex = 9;
this.textBox5.Text = "";
//
// label5
//
this.label5.Location = new System.Drawing.Point(56, 200);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(56, 16);
this.label5.TabIndex = 8;
this.label5.Text = "出版时间";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(312, 168);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(112, 21);
this.textBox4.TabIndex = 7;
this.textBox4.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(56, 168);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(64, 16);
this.label4.TabIndex = 6;
this.label4.Text = "出版社";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(312, 136);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(112, 21);
this.textBox3.TabIndex = 5;
this.textBox3.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(56, 136);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 16);
this.label3.TabIndex = 4;
this.label3.Text = "作者";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(312, 104);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(112, 21);
this.textBox2.TabIndex = 3;
this.textBox2.Text = "";
//
// label2
//
this.label2.Location = new System.Drawing.Point(56, 104);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(64, 16);
this.label2.TabIndex = 2;
this.label2.Text = "名称";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(312, 72);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(112, 21);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(56, 72);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(64, 16);
this.label1.TabIndex = 0;
this.label1.Text = "编号";
//
// SearchForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(496, 390);
this.Controls.Add(this.groupBox1);
this.Name = "SearchForm";
this.Text = "图书查询窗口";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 载入初始信息
/// </summary>
private void LoadOffer()
{
try
{
this.comboBox1.SelectedIndex=1;
this.comboBox2.SelectedIndex=1;
this.comboBox3.SelectedIndex=1;
this.comboBox4.SelectedIndex=1;
this.comboBox5.SelectedIndex=1;
this.comboBox6.SelectedIndex=0;
this.comboBox8.SelectedIndex=0;
this.comboBox9.SelectedIndex=0;
this.textBox1.Text ="";
this.textBox2.Text ="";
this.textBox3.Text ="";
this.textBox4.Text ="";
this.textBox5.Text ="";
this.textBox6.Text ="";
this.dtp1.Value=System.DateTime.Now;
this.dtp2.Value=System.DateTime.Now;
this.dtp1.Enabled =false;
this.dtp2.Enabled =false;
this.comboBox7.Enabled=false;
this.textBox5.Enabled =false;
}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
return;
}
}
private void LoadSelectItem()
{
//载入类别
DataSet ds = Public.GetDireItem( );
if(ds != null)
{
for(int i=0;i<ds.Tables[0].Rows.Count;i++)
{
DataRow row = ds.Tables[0].Rows[i];
this.comboBox7.Items.Add(row["name"].ToString());
}
comboBox7.SelectedIndex=0;
}
}
private void comboBox6_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (this.comboBox6.SelectedIndex==0)
{
this.textBox5.Enabled =false;
}
else{ this.textBox5.Enabled =true;}
}
private void comboBox8_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (this.comboBox8.SelectedIndex==0)
{
this.comboBox7.Enabled=false;
}
else{ this.comboBox7.Enabled=true;}
}
private void comboBox9_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (this.comboBox9.SelectedIndex==0)
{
this.dtp1.Enabled =false;
this.dtp2.Enabled =false;
}
else
{
this.dtp1.Enabled =true;
this.dtp2.Enabled =true; }
}
private void button2_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, System.EventArgs e)
{
Newbook newbookfrm = new Newbook(0);
if (this.textBox1.Text.Trim()!="" )
{
switch(this.comboBox1.Text )
{
case "等于": newbookfrm.codeStr = " a.code ='" + this.textBox1.Text.Trim() +"'";break;
case "包涵于":newbookfrm.codeStr = " a.code like'*" + this.textBox1.Text.Trim() +"*'";break;
case "不包涵":newbookfrm.codeStr = " a.code not like'*" + this.textBox1.Text.Trim() +"*'";break;
default : break;
}
}
if (this.textBox2.Text.Trim()!="" )
{
switch(this.comboBox2.Text )
{
case "等于": newbookfrm.nameStr = " a.name ='" + this.textBox2.Text.Trim() +"'";break;
case "包涵于":newbookfrm.nameStr = " a.name like'*" + this.textBox2.Text.Trim() +"*'";break;
case "不包涵":newbookfrm.nameStr = " a.name not like'*" + this.textBox2.Text.Trim() +"*'";break;
default : break;
}
}
if (this.textBox3.Text.Trim()!="" )
{
switch(this.comboBox3.Text )
{
case "等于": newbookfrm.authorStr = " a.author ='" + this.textBox3.Text.Trim() +"'";break;
case "包涵于":newbookfrm.authorStr = " a.author like'*" + this.textBox3.Text.Trim() +"*'";break;
case "不包涵":newbookfrm.authorStr = " a.author not like'*" + this.textBox3.Text.Trim() +"*'";break;
default : break;
}
}
if (this.textBox4.Text.Trim()!="" )
{
switch(this.comboBox4.Text )
{
case "等于": newbookfrm.pressStr = " a.press ='" + this.textBox4.Text.Trim() +"'";break;
case "包涵于":newbookfrm.pressStr = " a.press like'*" + this.textBox4.Text.Trim() +"*'";break;
case "不包涵":newbookfrm.pressStr = " a.press not like'*" + this.textBox4.Text.Trim() +"*'";break;
default : break;
}
}
switch(this.comboBox9.Text )
{
case "范围从":newbookfrm.outdateStr = " a.outdate between '" + this.dtp1.Text +"' and '" +this.dtp2.Text + "' ";break;
default : break;
}
if (this.textBox5.Text.Trim()!="" )
{
switch(this.comboBox6.Text )
{
case "等于": newbookfrm.codeStr = " a.cost =" + Convert.ToInt32(this.textBox5.Text.Trim()) ;break;
case "大于":newbookfrm.codeStr = " a.cost >" + Convert.ToInt32(this.textBox5.Text.Trim());break;
case "等于或大于":newbookfrm.codeStr = " a.cost >=" + Convert.ToInt32(this.textBox5.Text.Trim());break;
case "小于":newbookfrm.codeStr = " a.cost <" + Convert.ToInt32(this.textBox5.Text.Trim());break;
case "等于或小于":newbookfrm.codeStr = " a.cost <=" + Convert.ToInt32(this.textBox5.Text.Trim());break;
default : break;
}
}
if (this.textBox6.Text.Trim()!="" )
{
switch(this.comboBox5.Text )
{
case "等于": newbookfrm.memotxtStr = " a.memotxt ='" + this.textBox6.Text.Trim() +"'";break;
case "包涵于":newbookfrm.memotxtStr = " a.memotxt like'*" + this.textBox6.Text.Trim() +"*'";break;
case "不包涵":newbookfrm.memotxtStr = " a.memotxt not like'*" + this.textBox6.Text.Trim() +"*'";break;
default : break;
}
}
switch(this.comboBox8.Text )
{
case "等于":
try
{
string sql = "select * from orders where name='"+ comboBox7.SelectedItem.ToString().Trim() +"'";
OleDbDataAdapter ad = new OleDbDataAdapter(sql,Public.conn);
DataSet ds = new DataSet();
ad.Fill(ds,"orders");
if(ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count == 1)
{
DataRow row = ds.Tables[0].Rows[0];
newbookfrm.ordernameStr = " a.ordercode = '" + row["id"].ToString() + "' ";
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}break;
default : break;
}
newbookfrm.LoadListForList();
newbookfrm.Show();
//this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -