tsjz.cs
上传用户:toshiba_01
上传日期:2007-06-08
资源大小:306k
文件大小:23k
源码类别:

酒店行业

开发平台:

C#

  1. using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using System.Data ; using System.Data .SqlClient ; namespace RoomManage { public class tsjz : RoomManage.pub {
  2. private System.Windows.Forms.Label label1;
  3. private System.Windows.Forms.Button button2;
  4. private System.Windows.Forms.Label label2;
  5. private System.Windows.Forms.GroupBox groupBox4;
  6. private System.Windows.Forms.GroupBox groupBox5;
  7. private System.Windows.Forms.ComboBox comboBox1;
  8. private System.Windows.Forms.Label label5;
  9. private System.Windows.Forms.Label label3;
  10. private System.Windows.Forms.TextBox textBox1;
  11. private System.Windows.Forms.TextBox textBox2;
  12. private System.Windows.Forms.Label label6;
  13. private System.Windows.Forms.Label label14;
  14. private System.Windows.Forms.Label label8;
  15. private System.Windows.Forms.Label label7;
  16. private System.Windows.Forms.Label label17;
  17. private System.Windows.Forms.Label label15;
  18. private System.Windows.Forms.Label label9;
  19. private System.Windows.Forms.Label label4;
  20. private System.Windows.Forms.Label label10;
  21. private System.Windows.Forms.Label label12;
  22. private System.Windows.Forms.Label label18;
  23. private System.Windows.Forms.Label label19;
  24. private System.Windows.Forms.Label label20;
  25. private System.Windows.Forms.Label label13;
  26. private System.Windows.Forms.Label label16;
  27. private System.Windows.Forms.Label label11;
  28. private System.Windows.Forms.TextBox textBox3;
  29. private System.Windows.Forms.TextBox textBox4;
  30. private System.Windows.Forms.TextBox textBox5;
  31. private System.Windows.Forms.TextBox textBox7;
  32. private System.Windows.Forms.TextBox textBox10;
  33. private System.Windows.Forms.TextBox textBox8;
  34. private System.Windows.Forms.TextBox textBox9;
  35. private System.Windows.Forms.TextBox textBox6;
  36. private System.Windows.Forms.TextBox textBox11;
  37. private System.Windows.Forms.TextBox textBox12;
  38. private System.Windows.Forms.TextBox textBox13;
  39. private System.Windows.Forms.TextBox textBox15;
  40. private System.Windows.Forms.TextBox textBox14;
  41. private System.Windows.Forms.TextBox textBox16;
  42. private System.Windows.Forms.TextBox textBox17; private System.ComponentModel.IContainer components = null; public tsjz(string s) { // 该调用是 Windows 窗体设计器所必需的。 InitializeComponent(); this.opername =s; // TODO: 在 InitializeComponent 调用后添加任何初始化 } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null)  { components.Dispose(); } } base.Dispose( disposing ); } #region 设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(tsjz));
  43. this.label1 = new System.Windows.Forms.Label();
  44. this.button2 = new System.Windows.Forms.Button();
  45. this.label2 = new System.Windows.Forms.Label();
  46. this.groupBox4 = new System.Windows.Forms.GroupBox();
  47. this.groupBox5 = new System.Windows.Forms.GroupBox();
  48. this.comboBox1 = new System.Windows.Forms.ComboBox();
  49. this.label5 = new System.Windows.Forms.Label();
  50. this.label3 = new System.Windows.Forms.Label();
  51. this.textBox1 = new System.Windows.Forms.TextBox();
  52. this.textBox2 = new System.Windows.Forms.TextBox();
  53. this.label6 = new System.Windows.Forms.Label();
  54. this.textBox3 = new System.Windows.Forms.TextBox();
  55. this.label14 = new System.Windows.Forms.Label();
  56. this.textBox4 = new System.Windows.Forms.TextBox();
  57. this.textBox5 = new System.Windows.Forms.TextBox();
  58. this.label8 = new System.Windows.Forms.Label();
  59. this.label7 = new System.Windows.Forms.Label();
  60. this.textBox7 = new System.Windows.Forms.TextBox();
  61. this.label17 = new System.Windows.Forms.Label();
  62. this.label15 = new System.Windows.Forms.Label();
  63. this.textBox10 = new System.Windows.Forms.TextBox();
  64. this.textBox8 = new System.Windows.Forms.TextBox();
  65. this.textBox9 = new System.Windows.Forms.TextBox();
  66. this.label9 = new System.Windows.Forms.Label();
  67. this.label4 = new System.Windows.Forms.Label();
  68. this.label10 = new System.Windows.Forms.Label();
  69. this.label12 = new System.Windows.Forms.Label();
  70. this.textBox6 = new System.Windows.Forms.TextBox();
  71. this.textBox11 = new System.Windows.Forms.TextBox();
  72. this.textBox12 = new System.Windows.Forms.TextBox();
  73. this.textBox13 = new System.Windows.Forms.TextBox();
  74. this.label18 = new System.Windows.Forms.Label();
  75. this.label19 = new System.Windows.Forms.Label();
  76. this.label20 = new System.Windows.Forms.Label();
  77. this.textBox15 = new System.Windows.Forms.TextBox();
  78. this.textBox14 = new System.Windows.Forms.TextBox();
  79. this.label13 = new System.Windows.Forms.Label();
  80. this.textBox16 = new System.Windows.Forms.TextBox();
  81. this.label16 = new System.Windows.Forms.Label();
  82. this.textBox17 = new System.Windows.Forms.TextBox();
  83. this.label11 = new System.Windows.Forms.Label();
  84. this.groupBox2.SuspendLayout();
  85. this.groupBox3.SuspendLayout();
  86. // 
  87. // button1
  88. // 
  89. this.button1.Location = new System.Drawing.Point(8, 80);
  90. this.button1.Name = "button1";
  91. this.button1.TabIndex = 2;
  92. // 
  93. // groupBox1
  94. // 
  95. this.groupBox1.Name = "groupBox1";
  96. // 
  97. // groupBox2
  98. // 
  99. this.groupBox2.Controls.Add(this.button2);
  100. this.groupBox2.Name = "groupBox2";
  101. this.groupBox2.Controls.SetChildIndex(this.button2, 0);
  102. this.groupBox2.Controls.SetChildIndex(this.button1, 0);
  103. // 
  104. // pictureBox1
  105. // 
  106. this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
  107. this.pictureBox1.Name = "pictureBox1";
  108. // 
  109. // groupBox3
  110. // 
  111. this.groupBox3.Controls.Add(this.textBox17);
  112. this.groupBox3.Controls.Add(this.label11);
  113. this.groupBox3.Controls.Add(this.textBox16);
  114. this.groupBox3.Controls.Add(this.label16);
  115. this.groupBox3.Controls.Add(this.label20);
  116. this.groupBox3.Controls.Add(this.textBox15);
  117. this.groupBox3.Controls.Add(this.textBox14);
  118. this.groupBox3.Controls.Add(this.label13);
  119. this.groupBox3.Controls.Add(this.textBox12);
  120. this.groupBox3.Controls.Add(this.textBox13);
  121. this.groupBox3.Controls.Add(this.label18);
  122. this.groupBox3.Controls.Add(this.label19);
  123. this.groupBox3.Controls.Add(this.label10);
  124. this.groupBox3.Controls.Add(this.label12);
  125. this.groupBox3.Controls.Add(this.textBox6);
  126. this.groupBox3.Controls.Add(this.textBox11);
  127. this.groupBox3.Controls.Add(this.textBox9);
  128. this.groupBox3.Controls.Add(this.label9);
  129. this.groupBox3.Controls.Add(this.label4);
  130. this.groupBox3.Controls.Add(this.label15);
  131. this.groupBox3.Controls.Add(this.textBox7);
  132. this.groupBox3.Controls.Add(this.label17);
  133. this.groupBox3.Controls.Add(this.textBox4);
  134. this.groupBox3.Controls.Add(this.textBox5);
  135. this.groupBox3.Controls.Add(this.label8);
  136. this.groupBox3.Controls.Add(this.label7);
  137. this.groupBox3.Controls.Add(this.textBox3);
  138. this.groupBox3.Controls.Add(this.label14);
  139. this.groupBox3.Controls.Add(this.textBox2);
  140. this.groupBox3.Controls.Add(this.label6);
  141. this.groupBox3.Controls.Add(this.textBox1);
  142. this.groupBox3.Controls.Add(this.label3);
  143. this.groupBox3.Controls.Add(this.comboBox1);
  144. this.groupBox3.Controls.Add(this.label5);
  145. this.groupBox3.Controls.Add(this.groupBox5);
  146. this.groupBox3.Controls.Add(this.groupBox4);
  147. this.groupBox3.Controls.Add(this.label2);
  148. this.groupBox3.Controls.Add(this.label1);
  149. this.groupBox3.Controls.Add(this.textBox8);
  150. this.groupBox3.Controls.Add(this.textBox10);
  151. this.groupBox3.Name = "groupBox3";
  152. // 
  153. // label1
  154. // 
  155. this.label1.Location = new System.Drawing.Point(8, 253);
  156. this.label1.Name = "label1";
  157. this.label1.Size = new System.Drawing.Size(72, 16);
  158. this.label1.TabIndex = 0;
  159. this.label1.Text = "操 作 员:";
  160. // 
  161. // button2
  162. // 
  163. this.button2.Location = new System.Drawing.Point(8, 32);
  164. this.button2.Name = "button2";
  165. this.button2.Size = new System.Drawing.Size(48, 23);
  166. this.button2.TabIndex = 1;
  167. this.button2.Text = "确定";
  168. this.button2.Click += new System.EventHandler(this.button2_Click);
  169. // 
  170. // label2
  171. // 
  172. this.label2.Location = new System.Drawing.Point(72, 253);
  173. this.label2.Name = "label2";
  174. this.label2.Size = new System.Drawing.Size(100, 16);
  175. this.label2.TabIndex = 1;
  176. // 
  177. // groupBox4
  178. // 
  179. this.groupBox4.Location = new System.Drawing.Point(0, 243);
  180. this.groupBox4.Name = "groupBox4";
  181. this.groupBox4.Size = new System.Drawing.Size(384, 3);
  182. this.groupBox4.TabIndex = 2;
  183. this.groupBox4.TabStop = false;
  184. // 
  185. // groupBox5
  186. // 
  187. this.groupBox5.Location = new System.Drawing.Point(0, 34);
  188. this.groupBox5.Name = "groupBox5";
  189. this.groupBox5.Size = new System.Drawing.Size(384, 8);
  190. this.groupBox5.TabIndex = 3;
  191. this.groupBox5.TabStop = false;
  192. // 
  193. // comboBox1
  194. // 
  195. this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  196. this.comboBox1.Location = new System.Drawing.Point(80, 13);
  197. this.comboBox1.Name = "comboBox1";
  198. this.comboBox1.Size = new System.Drawing.Size(128, 20);
  199. this.comboBox1.TabIndex = 0;
  200. this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
  201. // 
  202. // label5
  203. // 
  204. this.label5.Location = new System.Drawing.Point(8, 16);
  205. this.label5.Name = "label5";
  206. this.label5.Size = new System.Drawing.Size(72, 16);
  207. this.label5.TabIndex = 54;
  208. this.label5.Text = "凭证号码:";
  209. // 
  210. // label3
  211. // 
  212. this.label3.Location = new System.Drawing.Point(224, 16);
  213. this.label3.Name = "label3";
  214. this.label3.Size = new System.Drawing.Size(24, 23);
  215. this.label3.TabIndex = 56;
  216. this.label3.Text = "NO:";
  217. // 
  218. // textBox1
  219. // 
  220. this.textBox1.Location = new System.Drawing.Point(248, 13);
  221. this.textBox1.Name = "textBox1";
  222. this.textBox1.ReadOnly = true;
  223. this.textBox1.Size = new System.Drawing.Size(128, 21);
  224. this.textBox1.TabIndex = 57;
  225. this.textBox1.Text = "";
  226. // 
  227. // textBox2
  228. // 
  229. this.textBox2.Location = new System.Drawing.Point(80, 48);
  230. this.textBox2.Name = "textBox2";
  231. this.textBox2.ReadOnly = true;
  232. this.textBox2.TabIndex = 129;
  233. this.textBox2.Text = "";
  234. // 
  235. // label6
  236. // 
  237. this.label6.Location = new System.Drawing.Point(8, 51);
  238. this.label6.Name = "label6";
  239. this.label6.Size = new System.Drawing.Size(72, 23);
  240. this.label6.TabIndex = 130;
  241. this.label6.Text = "姓  名:";
  242. // 
  243. // textBox3
  244. // 
  245. this.textBox3.Location = new System.Drawing.Point(272, 48);
  246. this.textBox3.Name = "textBox3";
  247. this.textBox3.ReadOnly = true;
  248. this.textBox3.TabIndex = 145;
  249. this.textBox3.Text = "";
  250. // 
  251. // label14
  252. // 
  253. this.label14.Location = new System.Drawing.Point(200, 51);
  254. this.label14.Name = "label14";
  255. this.label14.Size = new System.Drawing.Size(72, 23);
  256. this.label14.TabIndex = 144;
  257. this.label14.Text = "房 间 号:";
  258. // 
  259. // textBox4
  260. // 
  261. this.textBox4.Location = new System.Drawing.Point(80, 72);
  262. this.textBox4.Name = "textBox4";
  263. this.textBox4.ReadOnly = true;
  264. this.textBox4.TabIndex = 149;
  265. this.textBox4.Text = "";
  266. // 
  267. // textBox5
  268. // 
  269. this.textBox5.Location = new System.Drawing.Point(272, 72);
  270. this.textBox5.Name = "textBox5";
  271. this.textBox5.ReadOnly = true;
  272. this.textBox5.TabIndex = 146;
  273. this.textBox5.Text = "";
  274. // 
  275. // label8
  276. // 
  277. this.label8.Location = new System.Drawing.Point(200, 75);
  278. this.label8.Name = "label8";
  279. this.label8.Size = new System.Drawing.Size(72, 23);
  280. this.label8.TabIndex = 148;
  281. this.label8.Text = "房间价格:";
  282. // 
  283. // label7
  284. // 
  285. this.label7.Location = new System.Drawing.Point(8, 75);
  286. this.label7.Name = "label7";
  287. this.label7.Size = new System.Drawing.Size(72, 23);
  288. this.label7.TabIndex = 147;
  289. this.label7.Text = "客房类型:";
  290. // 
  291. // textBox7
  292. // 
  293. this.textBox7.Location = new System.Drawing.Point(272, 96);
  294. this.textBox7.Name = "textBox7";
  295. this.textBox7.ReadOnly = true;
  296. this.textBox7.TabIndex = 151;
  297. this.textBox7.Text = "";
  298. // 
  299. // label17
  300. // 
  301. this.label17.Location = new System.Drawing.Point(200, 99);
  302. this.label17.Name = "label17";
  303. this.label17.Size = new System.Drawing.Size(72, 23);
  304. this.label17.TabIndex = 150;
  305. this.label17.Text = "住宿天数:";
  306. // 
  307. // label15
  308. // 
  309. this.label15.Location = new System.Drawing.Point(8, 99);
  310. this.label15.Name = "label15";
  311. this.label15.Size = new System.Drawing.Size(72, 23);
  312. this.label15.TabIndex = 153;
  313. this.label15.Text = "住宿日期:";
  314. // 
  315. // textBox10
  316. // 
  317. this.textBox10.Location = new System.Drawing.Point(80, 144);
  318. this.textBox10.Name = "textBox10";
  319. this.textBox10.ReadOnly = true;
  320. this.textBox10.TabIndex = 152;
  321. this.textBox10.Text = "";
  322. // 
  323. // textBox8
  324. // 
  325. this.textBox8.Location = new System.Drawing.Point(80, 120);
  326. this.textBox8.Name = "textBox8";
  327. this.textBox8.ReadOnly = true;
  328. this.textBox8.TabIndex = 157;
  329. this.textBox8.Text = "";
  330. // 
  331. // textBox9
  332. // 
  333. this.textBox9.Location = new System.Drawing.Point(272, 120);
  334. this.textBox9.Name = "textBox9";
  335. this.textBox9.ReadOnly = true;
  336. this.textBox9.TabIndex = 155;
  337. this.textBox9.Text = "";
  338. // 
  339. // label9
  340. // 
  341. this.label9.Location = new System.Drawing.Point(8, 123);
  342. this.label9.Name = "label9";
  343. this.label9.Size = new System.Drawing.Size(72, 23);
  344. this.label9.TabIndex = 156;
  345. this.label9.Text = "应收宿费:";
  346. // 
  347. // label4
  348. // 
  349. this.label4.Location = new System.Drawing.Point(200, 123);
  350. this.label4.Name = "label4";
  351. this.label4.Size = new System.Drawing.Size(72, 23);
  352. this.label4.TabIndex = 154;
  353. this.label4.Text = "预收宿费:";
  354. // 
  355. // label10
  356. // 
  357. this.label10.Location = new System.Drawing.Point(8, 147);
  358. this.label10.Name = "label10";
  359. this.label10.Size = new System.Drawing.Size(72, 23);
  360. this.label10.TabIndex = 161;
  361. this.label10.Text = "增补宿费:";
  362. // 
  363. // label12
  364. // 
  365. this.label12.Location = new System.Drawing.Point(200, 147);
  366. this.label12.Name = "label12";
  367. this.label12.Size = new System.Drawing.Size(72, 23);
  368. this.label12.TabIndex = 160;
  369. this.label12.Text = "退还宿费:";
  370. // 
  371. // textBox6
  372. // 
  373. this.textBox6.Location = new System.Drawing.Point(80, 96);
  374. this.textBox6.Name = "textBox6";
  375. this.textBox6.ReadOnly = true;
  376. this.textBox6.TabIndex = 159;
  377. this.textBox6.Text = "";
  378. // 
  379. // textBox11
  380. // 
  381. this.textBox11.Location = new System.Drawing.Point(272, 144);
  382. this.textBox11.Name = "textBox11";
  383. this.textBox11.ReadOnly = true;
  384. this.textBox11.TabIndex = 158;
  385. this.textBox11.Text = "";
  386. // 
  387. // textBox12
  388. // 
  389. this.textBox12.Location = new System.Drawing.Point(80, 168);
  390. this.textBox12.Name = "textBox12";
  391. this.textBox12.ReadOnly = true;
  392. this.textBox12.TabIndex = 163;
  393. this.textBox12.Text = "";
  394. // 
  395. // textBox13
  396. // 
  397. this.textBox13.Location = new System.Drawing.Point(272, 168);
  398. this.textBox13.Name = "textBox13";
  399. this.textBox13.ReadOnly = true;
  400. this.textBox13.TabIndex = 162;
  401. this.textBox13.Text = "";
  402. // 
  403. // label18
  404. // 
  405. this.label18.Location = new System.Drawing.Point(200, 171);
  406. this.label18.Name = "label18";
  407. this.label18.Size = new System.Drawing.Size(72, 23);
  408. this.label18.TabIndex = 165;
  409. this.label18.Text = "证件号码:";
  410. // 
  411. // label19
  412. // 
  413. this.label19.Location = new System.Drawing.Point(8, 171);
  414. this.label19.Name = "label19";
  415. this.label19.Size = new System.Drawing.Size(72, 23);
  416. this.label19.TabIndex = 164;
  417. this.label19.Text = "证件名称:";
  418. // 
  419. // label20
  420. // 
  421. this.label20.Location = new System.Drawing.Point(200, 196);
  422. this.label20.Name = "label20";
  423. this.label20.Size = new System.Drawing.Size(72, 23);
  424. this.label20.TabIndex = 169;
  425. this.label20.Text = "详细地址:";
  426. // 
  427. // textBox15
  428. // 
  429. this.textBox15.Location = new System.Drawing.Point(272, 192);
  430. this.textBox15.Name = "textBox15";
  431. this.textBox15.ReadOnly = true;
  432. this.textBox15.TabIndex = 168;
  433. this.textBox15.Text = "";
  434. // 
  435. // textBox14
  436. // 
  437. this.textBox14.Location = new System.Drawing.Point(80, 192);
  438. this.textBox14.Name = "textBox14";
  439. this.textBox14.ReadOnly = true;
  440. this.textBox14.TabIndex = 166;
  441. this.textBox14.Text = "";
  442. // 
  443. // label13
  444. // 
  445. this.label13.Location = new System.Drawing.Point(8, 196);
  446. this.label13.Name = "label13";
  447. this.label13.Size = new System.Drawing.Size(72, 23);
  448. this.label13.TabIndex = 167;
  449. this.label13.Text = "联系电话:";
  450. // 
  451. // textBox16
  452. // 
  453. this.textBox16.Location = new System.Drawing.Point(80, 216);
  454. this.textBox16.Name = "textBox16";
  455. this.textBox16.Size = new System.Drawing.Size(296, 21);
  456. this.textBox16.TabIndex = 170;
  457. this.textBox16.Text = "";
  458. // 
  459. // label16
  460. // 
  461. this.label16.Location = new System.Drawing.Point(8, 219);
  462. this.label16.Name = "label16";
  463. this.label16.Size = new System.Drawing.Size(72, 23);
  464. this.label16.TabIndex = 171;
  465. this.label16.Text = "备  注:";
  466. // 
  467. // textBox17
  468. // 
  469. this.textBox17.Location = new System.Drawing.Point(272, 252);
  470. this.textBox17.Name = "textBox17";
  471. this.textBox17.ReadOnly = true;
  472. this.textBox17.TabIndex = 172;
  473. this.textBox17.Text = "";
  474. // 
  475. // label11
  476. // 
  477. this.label11.Location = new System.Drawing.Point(200, 256);
  478. this.label11.Name = "label11";
  479. this.label11.Size = new System.Drawing.Size(72, 16);
  480. this.label11.TabIndex = 173;
  481. this.label11.Text = "退房日期:";
  482. // 
  483. // tsjz
  484. // 
  485. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  486. this.ClientSize = new System.Drawing.Size(480, 283);
  487. this.Name = "tsjz";
  488. this.Text = "退宿结帐";
  489. this.Load += new System.EventHandler(this.tsjz_Load);
  490. this.groupBox2.ResumeLayout(false);
  491. this.groupBox3.ResumeLayout(false);
  492. } #endregion
  493. string opername;//传递操作员姓名
  494. DataConn dc=new DataConn ();
  495. private void rebind()
  496. {
  497. string str=dc.connstr ;
  498. SqlConnection conn=new SqlConnection (str);
  499. string sql="select 凭证号码 from tabdjb where 是否结帐='0'";
  500. SqlDataAdapter adapter=new SqlDataAdapter (sql,conn);
  501. DataSet dataset=new DataSet ();
  502. adapter.Fill (dataset,"tabdjb");
  503. this.comboBox1 .DisplayMember="凭证号码";
  504. this.comboBox1 .DataSource =dataset.Tables ["tabdjb"];
  505. conn.Dispose ();
  506. adapter.Dispose ();
  507. dataset.Dispose ();
  508. }
  509. private void tsjz_Load(object sender, System.EventArgs e)
  510. {
  511. this.AcceptButton =this.button2 ;
  512. this.label2 .Text =this.opername ;
  513. this.textBox17.Text =System.DateTime .Today.Date.ToShortDateString();
  514. this.rebind ();
  515. }
  516. private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
  517. {
  518. this.textBox1 .Text ="T"+this.comboBox1 .Text ;
  519. string str=dc.connstr ;
  520. SqlConnection conn=new SqlConnection (str);
  521. string sql="select * from tabdjb where 凭证号码='"+this.comboBox1 .Text +"'";
  522. SqlDataAdapter adapter=new SqlDataAdapter (sql,conn);
  523. DataSet dataset=new DataSet ();
  524. adapter.Fill (dataset,"tabdjb");
  525. this.textBox2 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.姓名"));
  526. this.textBox3 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.房间号"));
  527. this.textBox4 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.客房类型"));
  528. this.textBox5 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.房间价格"));
  529. this.textBox6 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.住宿日期"));
  530. this.textBox9 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.预付金额"));
  531. this.textBox12 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.证件名称"));
  532. this.textBox13 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.证件号码"));
  533. this.textBox14 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.联系电话"));
  534. this.textBox15 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.详细地址"));
  535. // this.textBox6.Text =this.textBox6.Text .Substring(0,9);
  536. //释放所有绑定
  537. this.textBox2 .DataBindings .Clear ();
  538. this.textBox3 .DataBindings .Clear ();
  539. this.textBox4 .DataBindings .Clear ();
  540. this.textBox5 .DataBindings .Clear ();
  541. this.textBox6 .DataBindings .Clear ();
  542. this.textBox12 .DataBindings .Clear ();
  543. this.textBox13 .DataBindings .Clear ();
  544. this.textBox9 .DataBindings .Clear ();
  545. this.textBox14 .DataBindings .Clear ();
  546. this.textBox15 .DataBindings .Clear ();
  547. this.textBox6.Text =this.textBox6 .Text .Substring (0,9);
  548. //判断实际住宿天数。
  549. int count=1;
  550. string str1=this.textBox6.Text;
  551. while((System.DateTime.Equals(Convert.ToDateTime (this.textBox17 .Text ),Convert.ToDateTime (str1)))==false)
  552. {
  553. str1=(Convert.ToDateTime(str1).AddDays(1)).ToString();
  554. count++;
  555. }
  556. this.textBox7.Text =count.ToString ();
  557. //计算实际应付金额。
  558. this.textBox8.Text =(count*Convert.ToInt32(this.textBox5.Text)).ToString ();
  559. //结算
  560. if(Convert.ToInt32(this.textBox8.Text)>=Convert.ToInt32(this.textBox9.Text ))
  561. {
  562. this.textBox10.Text =Convert.ToString((Convert.ToInt32(this.textBox8.Text)-Convert.ToInt32(this.textBox9.Text )));
  563. this.textBox11.Text ="0";
  564. }
  565. else
  566. {
  567. this.textBox11.Text =Convert.ToString((Convert.ToInt32(this.textBox9.Text)-Convert.ToInt32(this.textBox8.Text )));
  568. this.textBox10.Text ="0";
  569. }
  570. conn.Dispose ();
  571. adapter.Dispose ();
  572. dataset.Dispose ();
  573. }
  574. private void button2_Click(object sender, System.EventArgs e)
  575. {
  576. string str=dc.connstr ;
  577. SqlConnection conn=new SqlConnection (str);
  578. string sql="insert into tabtfd values(";
  579. sql=sql+"'"+this.textBox1 .Text +"',";
  580. sql=sql+"'"+this.textBox2 .Text +"',";
  581. sql=sql+"'"+this.textBox12 .Text +"',";
  582. sql=sql+"'"+this.textBox13 .Text +"',";
  583. sql=sql+"'"+this.textBox15 .Text +"',";
  584. sql=sql+"'"+this.textBox3 .Text +"',";
  585. sql=sql+"'"+this.textBox4 .Text +"',";
  586. sql=sql+""+this.textBox5 .Text +",";
  587. sql=sql+"'"+this.textBox6 .Text +"',";
  588. sql=sql+""+this.textBox7 .Text +",";
  589. sql=sql+""+this.textBox8 .Text +",";
  590. sql=sql+""+this.textBox9 .Text +",";
  591. sql=sql+""+this.textBox10 .Text +",";
  592. sql=sql+""+this.textBox11 .Text +",";
  593. sql=sql+"'"+this.textBox17 .Text +"',";
  594. sql=sql+"'"+this.textBox14 .Text +"',";
  595. sql=sql+"'"+this.opername+"',";
  596. sql=sql+"'"+this.textBox16 .Text +"')";
  597. SqlCommand cmd=new SqlCommand (sql,conn);
  598. string sql1="update tabkfinfo set 房态='空闲' where 房间号='"+this.textBox3.Text +"'";
  599. string sql2="update tabdjb set 是否结帐='1'where 房间号='"+this.textBox3.Text +"'";
  600. SqlCommand cmd1=new SqlCommand (sql1,conn);
  601. SqlCommand cmd2=new SqlCommand (sql2,conn);
  602. conn.Open ();
  603. cmd.ExecuteNonQuery ();
  604. MessageBox.Show ("您已成功结帐,欢迎再次光临!","恭喜",MessageBoxButtons.OK ,MessageBoxIcon.Information);
  605. cmd1.ExecuteNonQuery ();//修改房态
  606. cmd2.ExecuteNonQuery ();
  607. this.rebind ();
  608. conn.Close();
  609. cmd1.Dispose ();
  610. cmd2.Dispose ();
  611. cmd.Dispose ();
  612. }
  613. } }