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

酒店行业

开发平台:

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