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

酒店行业

开发平台:

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 zjyj : RoomManage.pub { private System.ComponentModel.IContainer components = null; public zjyj(string s) { // 该调用是 Windows 窗体设计器所必需的。 InitializeComponent(); this.opername =s; // TODO: 在 InitializeComponent 调用后添加任何初始化 }
  2. private System.Windows.Forms.Label label5;
  3. private System.Windows.Forms.ComboBox comboBox1;
  4. private System.Windows.Forms.Label label1;
  5. private System.Windows.Forms.TextBox textBox1;
  6. private System.Windows.Forms.TextBox textBox2;
  7. private System.Windows.Forms.Label label2;
  8. private System.Windows.Forms.GroupBox groupBox4;
  9. private System.Windows.Forms.GroupBox groupBox5;
  10. private System.Windows.Forms.Label label3;
  11. private System.Windows.Forms.TextBox textBox3;
  12. private System.Windows.Forms.Label label12;
  13. private System.Windows.Forms.Label label9;
  14. private System.Windows.Forms.TextBox textBox10;
  15. private System.Windows.Forms.Label label19;
  16. private System.Windows.Forms.Label label17;
  17. private System.Windows.Forms.Label label15;
  18. private System.Windows.Forms.Label label14;
  19. private System.Windows.Forms.Label label11;
  20. private System.Windows.Forms.Label label8;
  21. private System.Windows.Forms.Label label7;
  22. private System.Windows.Forms.Button button2;
  23. private System.Windows.Forms.TextBox textBox4;
  24. private System.Windows.Forms.TextBox textBox5;
  25. private System.Windows.Forms.TextBox textBox11;
  26. private System.Windows.Forms.TextBox textBox9;
  27. private System.Windows.Forms.TextBox textBox8;
  28. private System.Windows.Forms.TextBox textBox7;
  29. private System.Windows.Forms.TextBox textBox6;
  30. private System.Windows.Forms.Label label4;
  31. private System.Windows.Forms.Label label6; /// <summary> /// 清理所有正在使用的资源。 /// </summary> string opername; 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(zjyj));
  32. this.label5 = new System.Windows.Forms.Label();
  33. this.comboBox1 = new System.Windows.Forms.ComboBox();
  34. this.label1 = new System.Windows.Forms.Label();
  35. this.textBox1 = new System.Windows.Forms.TextBox();
  36. this.textBox2 = new System.Windows.Forms.TextBox();
  37. this.label2 = new System.Windows.Forms.Label();
  38. this.groupBox4 = new System.Windows.Forms.GroupBox();
  39. this.groupBox5 = new System.Windows.Forms.GroupBox();
  40. this.label3 = new System.Windows.Forms.Label();
  41. this.textBox3 = new System.Windows.Forms.TextBox();
  42. this.label12 = new System.Windows.Forms.Label();
  43. this.textBox5 = new System.Windows.Forms.TextBox();
  44. this.label9 = new System.Windows.Forms.Label();
  45. this.textBox10 = new System.Windows.Forms.TextBox();
  46. this.label19 = new System.Windows.Forms.Label();
  47. this.textBox11 = new System.Windows.Forms.TextBox();
  48. this.label17 = new System.Windows.Forms.Label();
  49. this.textBox9 = new System.Windows.Forms.TextBox();
  50. this.label15 = new System.Windows.Forms.Label();
  51. this.label14 = new System.Windows.Forms.Label();
  52. this.textBox8 = new System.Windows.Forms.TextBox();
  53. this.textBox7 = new System.Windows.Forms.TextBox();
  54. this.label11 = new System.Windows.Forms.Label();
  55. this.label8 = new System.Windows.Forms.Label();
  56. this.label7 = new System.Windows.Forms.Label();
  57. this.button2 = new System.Windows.Forms.Button();
  58. this.textBox4 = new System.Windows.Forms.TextBox();
  59. this.textBox6 = new System.Windows.Forms.TextBox();
  60. this.label4 = new System.Windows.Forms.Label();
  61. this.label6 = new System.Windows.Forms.Label();
  62. this.groupBox2.SuspendLayout();
  63. this.groupBox3.SuspendLayout();
  64. // 
  65. // button1
  66. // 
  67. this.button1.Location = new System.Drawing.Point(8, 80);
  68. this.button1.Name = "button1";
  69. this.button1.TabIndex = 21;
  70. this.button1.Click += new System.EventHandler(this.button1_Click);
  71. // 
  72. // groupBox1
  73. // 
  74. this.groupBox1.Name = "groupBox1";
  75. // 
  76. // groupBox2
  77. // 
  78. this.groupBox2.Controls.Add(this.button2);
  79. this.groupBox2.Name = "groupBox2";
  80. this.groupBox2.Controls.SetChildIndex(this.button1, 0);
  81. this.groupBox2.Controls.SetChildIndex(this.button2, 0);
  82. // 
  83. // pictureBox1
  84. // 
  85. this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
  86. this.pictureBox1.Name = "pictureBox1";
  87. // 
  88. // groupBox3
  89. // 
  90. this.groupBox3.Controls.Add(this.label6);
  91. this.groupBox3.Controls.Add(this.label4);
  92. this.groupBox3.Controls.Add(this.textBox6);
  93. this.groupBox3.Controls.Add(this.textBox4);
  94. this.groupBox3.Controls.Add(this.textBox5);
  95. this.groupBox3.Controls.Add(this.label9);
  96. this.groupBox3.Controls.Add(this.textBox10);
  97. this.groupBox3.Controls.Add(this.label19);
  98. this.groupBox3.Controls.Add(this.textBox11);
  99. this.groupBox3.Controls.Add(this.label17);
  100. this.groupBox3.Controls.Add(this.textBox9);
  101. this.groupBox3.Controls.Add(this.label15);
  102. this.groupBox3.Controls.Add(this.label14);
  103. this.groupBox3.Controls.Add(this.textBox8);
  104. this.groupBox3.Controls.Add(this.textBox7);
  105. this.groupBox3.Controls.Add(this.label11);
  106. this.groupBox3.Controls.Add(this.label8);
  107. this.groupBox3.Controls.Add(this.label7);
  108. this.groupBox3.Controls.Add(this.label12);
  109. this.groupBox3.Controls.Add(this.textBox3);
  110. this.groupBox3.Controls.Add(this.label3);
  111. this.groupBox3.Controls.Add(this.groupBox5);
  112. this.groupBox3.Controls.Add(this.groupBox4);
  113. this.groupBox3.Controls.Add(this.textBox2);
  114. this.groupBox3.Controls.Add(this.label2);
  115. this.groupBox3.Controls.Add(this.textBox1);
  116. this.groupBox3.Controls.Add(this.label1);
  117. this.groupBox3.Controls.Add(this.comboBox1);
  118. this.groupBox3.Controls.Add(this.label5);
  119. this.groupBox3.Name = "groupBox3";
  120. // 
  121. // label5
  122. // 
  123. this.label5.Location = new System.Drawing.Point(8, 21);
  124. this.label5.Name = "label5";
  125. this.label5.Size = new System.Drawing.Size(72, 16);
  126. this.label5.TabIndex = 52;
  127. this.label5.Text = "凭证号码:";
  128. // 
  129. // comboBox1
  130. // 
  131. this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  132. this.comboBox1.Location = new System.Drawing.Point(72, 16);
  133. this.comboBox1.Name = "comboBox1";
  134. this.comboBox1.Size = new System.Drawing.Size(120, 20);
  135. this.comboBox1.TabIndex = 53;
  136. this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
  137. // 
  138. // label1
  139. // 
  140. this.label1.Location = new System.Drawing.Point(192, 18);
  141. this.label1.Name = "label1";
  142. this.label1.Size = new System.Drawing.Size(72, 23);
  143. this.label1.TabIndex = 54;
  144. this.label1.Text = "追加押金:";
  145. // 
  146. // textBox1
  147. // 
  148. this.textBox1.Location = new System.Drawing.Point(264, 16);
  149. this.textBox1.Name = "textBox1";
  150. this.textBox1.TabIndex = 55;
  151. this.textBox1.Text = "";
  152. this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
  153. // 
  154. // textBox2
  155. // 
  156. this.textBox2.Location = new System.Drawing.Point(80, 53);
  157. this.textBox2.Name = "textBox2";
  158. this.textBox2.ReadOnly = true;
  159. this.textBox2.TabIndex = 56;
  160. this.textBox2.Text = "";
  161. // 
  162. // label2
  163. // 
  164. this.label2.Location = new System.Drawing.Point(8, 56);
  165. this.label2.Name = "label2";
  166. this.label2.Size = new System.Drawing.Size(72, 23);
  167. this.label2.TabIndex = 57;
  168. this.label2.Text = "姓  名:";
  169. // 
  170. // groupBox4
  171. // 
  172. this.groupBox4.Location = new System.Drawing.Point(0, 40);
  173. this.groupBox4.Name = "groupBox4";
  174. this.groupBox4.Size = new System.Drawing.Size(384, 3);
  175. this.groupBox4.TabIndex = 58;
  176. this.groupBox4.TabStop = false;
  177. // 
  178. // groupBox5
  179. // 
  180. this.groupBox5.Location = new System.Drawing.Point(0, 240);
  181. this.groupBox5.Name = "groupBox5";
  182. this.groupBox5.Size = new System.Drawing.Size(384, 3);
  183. this.groupBox5.TabIndex = 59;
  184. this.groupBox5.TabStop = false;
  185. // 
  186. // label3
  187. // 
  188. this.label3.Location = new System.Drawing.Point(192, 56);
  189. this.label3.Name = "label3";
  190. this.label3.Size = new System.Drawing.Size(72, 23);
  191. this.label3.TabIndex = 60;
  192. this.label3.Text = "已交押金:";
  193. // 
  194. // textBox3
  195. // 
  196. this.textBox3.Location = new System.Drawing.Point(264, 53);
  197. this.textBox3.Name = "textBox3";
  198. this.textBox3.ReadOnly = true;
  199. this.textBox3.TabIndex = 61;
  200. this.textBox3.Text = "";
  201. // 
  202. // label12
  203. // 
  204. this.label12.Location = new System.Drawing.Point(8, 253);
  205. this.label12.Name = "label12";
  206. this.label12.Size = new System.Drawing.Size(120, 23);
  207. this.label12.TabIndex = 70;
  208. // 
  209. // textBox5
  210. // 
  211. this.textBox5.Location = new System.Drawing.Point(264, 89);
  212. this.textBox5.Name = "textBox5";
  213. this.textBox5.ReadOnly = true;
  214. this.textBox5.TabIndex = 76;
  215. this.textBox5.Text = "";
  216. // 
  217. // label9
  218. // 
  219. this.label9.Location = new System.Drawing.Point(192, 92);
  220. this.label9.Name = "label9";
  221. this.label9.Size = new System.Drawing.Size(72, 23);
  222. this.label9.TabIndex = 86;
  223. this.label9.Text = "应交宿费:";
  224. // 
  225. // textBox10
  226. // 
  227. this.textBox10.Location = new System.Drawing.Point(80, 197);
  228. this.textBox10.Name = "textBox10";
  229. this.textBox10.ReadOnly = true;
  230. this.textBox10.TabIndex = 74;
  231. this.textBox10.Text = "";
  232. // 
  233. // label19
  234. // 
  235. this.label19.Location = new System.Drawing.Point(8, 200);
  236. this.label19.Name = "label19";
  237. this.label19.Size = new System.Drawing.Size(72, 23);
  238. this.label19.TabIndex = 85;
  239. this.label19.Text = "提醒日期:";
  240. // 
  241. // textBox11
  242. // 
  243. this.textBox11.Location = new System.Drawing.Point(264, 197);
  244. this.textBox11.Name = "textBox11";
  245. this.textBox11.ReadOnly = true;
  246. this.textBox11.TabIndex = 75;
  247. this.textBox11.Text = "";
  248. // 
  249. // label17
  250. // 
  251. this.label17.Location = new System.Drawing.Point(192, 164);
  252. this.label17.Name = "label17";
  253. this.label17.Size = new System.Drawing.Size(72, 23);
  254. this.label17.TabIndex = 84;
  255. this.label17.Text = "预住天数:";
  256. // 
  257. // textBox9
  258. // 
  259. this.textBox9.Location = new System.Drawing.Point(264, 161);
  260. this.textBox9.Name = "textBox9";
  261. this.textBox9.ReadOnly = true;
  262. this.textBox9.TabIndex = 73;
  263. this.textBox9.Text = "";
  264. // 
  265. // label15
  266. // 
  267. this.label15.Location = new System.Drawing.Point(8, 164);
  268. this.label15.Name = "label15";
  269. this.label15.Size = new System.Drawing.Size(72, 23);
  270. this.label15.TabIndex = 83;
  271. this.label15.Text = "住宿日期:";
  272. // 
  273. // label14
  274. // 
  275. this.label14.Location = new System.Drawing.Point(8, 92);
  276. this.label14.Name = "label14";
  277. this.label14.Size = new System.Drawing.Size(72, 23);
  278. this.label14.TabIndex = 82;
  279. this.label14.Text = "房 间 号:";
  280. // 
  281. // textBox8
  282. // 
  283. this.textBox8.Location = new System.Drawing.Point(80, 161);
  284. this.textBox8.Name = "textBox8";
  285. this.textBox8.ReadOnly = true;
  286. this.textBox8.TabIndex = 81;
  287. this.textBox8.Text = "";
  288. // 
  289. // textBox7
  290. // 
  291. this.textBox7.Location = new System.Drawing.Point(264, 125);
  292. this.textBox7.Name = "textBox7";
  293. this.textBox7.ReadOnly = true;
  294. this.textBox7.TabIndex = 72;
  295. this.textBox7.Text = "";
  296. // 
  297. // label11
  298. // 
  299. this.label11.Location = new System.Drawing.Point(192, 200);
  300. this.label11.Name = "label11";
  301. this.label11.Size = new System.Drawing.Size(72, 23);
  302. this.label11.TabIndex = 80;
  303. this.label11.Text = "退宿日期:";
  304. // 
  305. // label8
  306. // 
  307. this.label8.Location = new System.Drawing.Point(192, 128);
  308. this.label8.Name = "label8";
  309. this.label8.Size = new System.Drawing.Size(72, 23);
  310. this.label8.TabIndex = 79;
  311. this.label8.Text = "房间价格:";
  312. // 
  313. // label7
  314. // 
  315. this.label7.Location = new System.Drawing.Point(8, 128);
  316. this.label7.Name = "label7";
  317. this.label7.Size = new System.Drawing.Size(72, 23);
  318. this.label7.TabIndex = 78;
  319. this.label7.Text = "客房类型:";
  320. // 
  321. // button2
  322. // 
  323. this.button2.Location = new System.Drawing.Point(8, 32);
  324. this.button2.Name = "button2";
  325. this.button2.Size = new System.Drawing.Size(48, 23);
  326. this.button2.TabIndex = 19;
  327. this.button2.Text = "确定";
  328. this.button2.Click += new System.EventHandler(this.button2_Click_1);
  329. // 
  330. // textBox4
  331. // 
  332. this.textBox4.Location = new System.Drawing.Point(80, 89);
  333. this.textBox4.Name = "textBox4";
  334. this.textBox4.ReadOnly = true;
  335. this.textBox4.TabIndex = 88;
  336. this.textBox4.Text = "";
  337. // 
  338. // textBox6
  339. // 
  340. this.textBox6.Location = new System.Drawing.Point(80, 125);
  341. this.textBox6.Name = "textBox6";
  342. this.textBox6.ReadOnly = true;
  343. this.textBox6.TabIndex = 89;
  344. this.textBox6.Text = "";
  345. // 
  346. // label4
  347. // 
  348. this.label4.Location = new System.Drawing.Point(264, 253);
  349. this.label4.Name = "label4";
  350. this.label4.Size = new System.Drawing.Size(88, 23);
  351. this.label4.TabIndex = 90;
  352. // 
  353. // label6
  354. // 
  355. this.label6.Location = new System.Drawing.Point(192, 253);
  356. this.label6.Name = "label6";
  357. this.label6.Size = new System.Drawing.Size(72, 23);
  358. this.label6.TabIndex = 91;
  359. this.label6.Text = "增款日期:";
  360. // 
  361. // zjyj
  362. // 
  363. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  364. this.ClientSize = new System.Drawing.Size(480, 283);
  365. this.Name = "zjyj";
  366. this.Text = "追加押金";
  367. this.Load += new System.EventHandler(this.zjyj_Load);
  368. this.groupBox2.ResumeLayout(false);
  369. this.groupBox3.ResumeLayout(false);
  370. } #endregion
  371. private void button2_Click(object sender, System.EventArgs e)
  372. {
  373. MessageBox.Show (opername);
  374. }
  375. DataConn dc=new DataConn ();
  376. private void zjyj_Load(object sender, System.EventArgs e)
  377. {
  378. this.AcceptButton =this.button2 ;
  379. this.label12 .Text ="操作员:"+this.opername ;
  380. this.label4.Text =System.DateTime .Today.Date.ToShortDateString();
  381. string str=dc.connstr ;
  382. SqlConnection conn=new SqlConnection (str);
  383. string sql="select 凭证号码 from tabdjb where 是否结帐='0'";
  384. SqlDataAdapter adapter=new SqlDataAdapter (sql,conn);
  385. DataSet dataset=new DataSet ();
  386. adapter.Fill (dataset,"tabdjb");
  387. this.comboBox1 .DisplayMember="凭证号码";
  388. this.comboBox1 .DataSource =dataset.Tables ["tabdjb"];
  389. conn.Dispose ();
  390. adapter.Dispose ();
  391. dataset.Dispose ();
  392. }
  393. private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
  394. {
  395. string str=dc.connstr ;
  396. SqlConnection conn=new SqlConnection (str);
  397. string sql="select * from tabdjb where 凭证号码='"+this.comboBox1 .Text +"'";
  398. SqlDataAdapter adapter=new SqlDataAdapter (sql,conn);
  399. DataSet dataset=new DataSet ();
  400. adapter.Fill (dataset,"tabdjb");
  401. this.textBox2 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.姓名"));
  402. this.textBox3 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.预付金额"));
  403. this.textBox4 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.房间号"));
  404. this.textBox5 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.应交宿费"));
  405. this.textBox6 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.客房类型"));
  406. this.textBox7 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.房间价格"));
  407. this.textBox8 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.住宿日期"));
  408. this.textBox9 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.预住天数"));
  409. this.textBox10 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.提醒日期"));
  410. this.textBox11 .DataBindings.Add (new Binding ("Text",dataset,"tabdjb.退宿日期"));
  411. this.textBox8.Text =(Convert.ToDateTime (this.textBox8.Text)).ToShortDateString();
  412. this.textBox10.Text =(Convert.ToDateTime (this.textBox10.Text)).ToShortDateString();
  413. this.textBox11.Text =(Convert.ToDateTime (this.textBox11.Text)).ToShortDateString();
  414. //释放所有绑定
  415. this.textBox2 .DataBindings .Clear ();
  416. this.textBox3 .DataBindings .Clear ();
  417. this.textBox4 .DataBindings .Clear ();
  418. this.textBox5 .DataBindings .Clear ();
  419. this.textBox6 .DataBindings .Clear ();
  420. this.textBox7 .DataBindings .Clear ();
  421. this.textBox8 .DataBindings .Clear ();
  422. this.textBox9 .DataBindings .Clear ();
  423. this.textBox10 .DataBindings .Clear ();
  424. this.textBox11 .DataBindings .Clear ();
  425. conn.Dispose ();
  426. adapter.Dispose ();
  427. dataset.Dispose ();
  428. }
  429. private void button1_Click(object sender, System.EventArgs e)
  430. {
  431. }
  432. private void textBox1_TextChanged(object sender, System.EventArgs e)
  433. {
  434. string str=this.textBox1.Text ;
  435. int f=1;
  436. for(int i=0;i<str.Length ;i++)
  437. {
  438. if(str[i]<'0'|str[i]>'9'|textBox1.Text.Length  >7)
  439. f=0;
  440. break;
  441. }
  442. if(f!=1)
  443. {
  444. MessageBox.Show ("对不起,您的输入有误!","注意",MessageBoxButtons.OK ,MessageBoxIcon.Error );
  445. this.textBox1.Text ="";
  446. }
  447. }
  448. private void button2_Click_1(object sender, System.EventArgs e)
  449. {
  450. if(textBox1.Text .Length >0&textBox1.Text .Length<7)
  451. {
  452. this.textBox3 .Text =Convert.ToString((Convert.ToUInt32 (this.textBox1 .Text )+Convert.ToUInt32 (this.textBox3 .Text )));
  453. string str=dc.connstr ;
  454. SqlConnection conn=new SqlConnection (str);
  455. string sql="update tabdjb set 预付金额='"+this.textBox3.Text +"'";
  456. SqlCommand cmd=new SqlCommand (sql,conn);
  457. conn.Open ();
  458. cmd.ExecuteNonQuery ();
  459. conn.Close ();
  460. MessageBox.Show ("您已经成功追加了"+this.textBox1.Text+"元的押金","注意",MessageBoxButtons.OK ,MessageBoxIcon.Information);
  461. }
  462. else
  463. {
  464. MessageBox.Show ("输入有误!");
  465. textBox1.Text ="";
  466. }
  467. }
  468. } }