📄 zjyj.cs
字号:
// textBox10
//
this.textBox10.Location = new System.Drawing.Point(80, 197);
this.textBox10.Name = "textBox10";
this.textBox10.ReadOnly = true;
this.textBox10.TabIndex = 74;
this.textBox10.Text = "";
//
// label19
//
this.label19.Location = new System.Drawing.Point(8, 200);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(72, 23);
this.label19.TabIndex = 85;
this.label19.Text = "提醒日期:";
//
// textBox11
//
this.textBox11.Location = new System.Drawing.Point(264, 197);
this.textBox11.Name = "textBox11";
this.textBox11.ReadOnly = true;
this.textBox11.TabIndex = 75;
this.textBox11.Text = "";
//
// label17
//
this.label17.Location = new System.Drawing.Point(192, 164);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(72, 23);
this.label17.TabIndex = 84;
this.label17.Text = "预住天数:";
//
// textBox9
//
this.textBox9.Location = new System.Drawing.Point(264, 161);
this.textBox9.Name = "textBox9";
this.textBox9.ReadOnly = true;
this.textBox9.TabIndex = 73;
this.textBox9.Text = "";
//
// label15
//
this.label15.Location = new System.Drawing.Point(8, 164);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(72, 23);
this.label15.TabIndex = 83;
this.label15.Text = "住宿日期:";
//
// label14
//
this.label14.Location = new System.Drawing.Point(8, 92);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(72, 23);
this.label14.TabIndex = 82;
this.label14.Text = "房 间 号:";
//
// textBox8
//
this.textBox8.Location = new System.Drawing.Point(80, 161);
this.textBox8.Name = "textBox8";
this.textBox8.ReadOnly = true;
this.textBox8.TabIndex = 81;
this.textBox8.Text = "";
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(264, 125);
this.textBox7.Name = "textBox7";
this.textBox7.ReadOnly = true;
this.textBox7.TabIndex = 72;
this.textBox7.Text = "";
//
// label11
//
this.label11.Location = new System.Drawing.Point(192, 200);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(72, 23);
this.label11.TabIndex = 80;
this.label11.Text = "退宿日期:";
//
// label8
//
this.label8.Location = new System.Drawing.Point(192, 128);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(72, 23);
this.label8.TabIndex = 79;
this.label8.Text = "房间价格:";
//
// label7
//
this.label7.Location = new System.Drawing.Point(8, 128);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(72, 23);
this.label7.TabIndex = 78;
this.label7.Text = "客房类型:";
//
// button2
//
this.button2.Location = new System.Drawing.Point(8, 32);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(48, 23);
this.button2.TabIndex = 19;
this.button2.Text = "确定";
this.button2.Click += new System.EventHandler(this.button2_Click_1);
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(80, 89);
this.textBox4.Name = "textBox4";
this.textBox4.ReadOnly = true;
this.textBox4.TabIndex = 88;
this.textBox4.Text = "";
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(80, 125);
this.textBox6.Name = "textBox6";
this.textBox6.ReadOnly = true;
this.textBox6.TabIndex = 89;
this.textBox6.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(264, 253);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(88, 23);
this.label4.TabIndex = 90;
//
// label6
//
this.label6.Location = new System.Drawing.Point(192, 253);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(72, 23);
this.label6.TabIndex = 91;
this.label6.Text = "增款日期:";
//
// zjyj
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(480, 283);
this.Name = "zjyj";
this.Text = "追加押金";
this.Load += new System.EventHandler(this.zjyj_Load);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
} #endregion
private void button2_Click(object sender, System.EventArgs e)
{
MessageBox.Show (opername);
}
DataConn dc=new DataConn ();
private void zjyj_Load(object sender, System.EventArgs e)
{
this.AcceptButton =this.button2 ;
this.label12 .Text ="操作员:"+this.opername ;
this.label4.Text =System.DateTime .Today.Date.ToShortDateString();
string str=dc.connstr ;
SqlConnection conn=new SqlConnection (str);
string sql="select 凭证号码 from tabdjb where 是否结帐='0'";
SqlDataAdapter adapter=new SqlDataAdapter (sql,conn);
DataSet dataset=new DataSet ();
adapter.Fill (dataset,"tabdjb");
this.comboBox1 .DisplayMember="凭证号码";
this.comboBox1 .DataSource =dataset.Tables ["tabdjb"];
conn.Dispose ();
adapter.Dispose ();
dataset.Dispose ();
}
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
string str=dc.connstr ;
SqlConnection conn=new SqlConnection (str);
string sql="select * from tabdjb where 凭证号码='"+this.comboBox1 .Text +"'";
SqlDataAdapter adapter=new SqlDataAdapter (sql,conn);
DataSet dataset=new DataSet ();
adapter.Fill (dataset,"tabdjb");
this.textBox2 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.姓名"));
this.textBox3 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.预付金额"));
this.textBox4 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.房间号"));
this.textBox5 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.应交宿费"));
this.textBox6 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.客房类型"));
this.textBox7 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.房间价格"));
this.textBox8 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.住宿日期"));
this.textBox9 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.预住天数"));
this.textBox10 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.提醒日期"));
this.textBox11 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.退宿日期"));
this.textBox8.Text =(Convert.ToDateTime (this.textBox8.Text)).ToShortDateString();
this.textBox10.Text =(Convert.ToDateTime (this.textBox10.Text)).ToShortDateString();
this.textBox11.Text =(Convert.ToDateTime (this.textBox11.Text)).ToShortDateString();
//释放所有绑定
this.textBox2 .DataBindings .Clear ();
this.textBox3 .DataBindings .Clear ();
this.textBox4 .DataBindings .Clear ();
this.textBox5 .DataBindings .Clear ();
this.textBox6 .DataBindings .Clear ();
this.textBox7 .DataBindings .Clear ();
this.textBox8 .DataBindings .Clear ();
this.textBox9 .DataBindings .Clear ();
this.textBox10 .DataBindings .Clear ();
this.textBox11 .DataBindings .Clear ();
conn.Dispose ();
adapter.Dispose ();
dataset.Dispose ();
}
private void button1_Click(object sender, System.EventArgs e)
{
}
private void textBox1_TextChanged(object sender, System.EventArgs e)
{
string str=this.textBox1.Text ;
int f=1;
for(int i=0;i<str.Length ;i++)
{
if(str[i]<'0'|str[i]>'9'|textBox1.Text.Length >7)
f=0;
break;
}
if(f!=1)
{
MessageBox.Show ("对不起,您的输入有误!","注意",MessageBoxButtons.OK ,MessageBoxIcon.Error );
this.textBox1.Text ="";
}
}
private void button2_Click_1(object sender, System.EventArgs e)
{
if(textBox1.Text .Length >0&textBox1.Text .Length<7)
{
this.textBox3 .Text =Convert.ToString((Convert.ToUInt32 (this.textBox1 .Text )+Convert.ToUInt32 (this.textBox3 .Text )));
string str=dc.connstr ;
SqlConnection conn=new SqlConnection (str);
string sql="update tabdjb set 预付金额='"+this.textBox3.Text +"'";
SqlCommand cmd=new SqlCommand (sql,conn);
conn.Open ();
cmd.ExecuteNonQuery ();
conn.Close ();
MessageBox.Show ("您已经成功追加了"+this.textBox1.Text+"元的押金","注意",MessageBoxButtons.OK ,MessageBoxIcon.Information);
}
else
{
MessageBox.Show ("输入有误!");
textBox1.Text ="";
}
}
}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -