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

酒店行业

开发平台:

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 kfcx : RoomManage.pub { private System.ComponentModel.IContainer components = null; public kfcx(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(kfcx));
  2. this.label1 = new System.Windows.Forms.Label();
  3. this.label2 = new System.Windows.Forms.Label();
  4. this.groupBox4 = new System.Windows.Forms.GroupBox();
  5. this.button2 = new System.Windows.Forms.Button();
  6. this.groupBox6 = new System.Windows.Forms.GroupBox();
  7. this.dg = new System.Windows.Forms.DataGrid();
  8. this.label3 = new System.Windows.Forms.Label();
  9. this.item = new System.Windows.Forms.ComboBox();
  10. this.fjh = new System.Windows.Forms.ComboBox();
  11. this.comboBox1 = new System.Windows.Forms.ComboBox();
  12. this.kflx = new System.Windows.Forms.ComboBox();
  13. this.ft = new System.Windows.Forms.ComboBox();
  14. this.groupBox2.SuspendLayout();
  15. this.groupBox3.SuspendLayout();
  16. ((System.ComponentModel.ISupportInitialize)(this.dg)).BeginInit();
  17. // 
  18. // button1
  19. // 
  20. this.button1.Location = new System.Drawing.Point(8, 80);
  21. this.button1.Name = "button1";
  22. this.button1.TabIndex = 1;
  23. // 
  24. // groupBox1
  25. // 
  26. this.groupBox1.Name = "groupBox1";
  27. // 
  28. // groupBox2
  29. // 
  30. this.groupBox2.Controls.Add(this.button2);
  31. this.groupBox2.Name = "groupBox2";
  32. this.groupBox2.Controls.SetChildIndex(this.button1, 0);
  33. this.groupBox2.Controls.SetChildIndex(this.button2, 0);
  34. // 
  35. // pictureBox1
  36. // 
  37. this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
  38. this.pictureBox1.Name = "pictureBox1";
  39. // 
  40. // groupBox3
  41. // 
  42. this.groupBox3.Controls.Add(this.ft);
  43. this.groupBox3.Controls.Add(this.kflx);
  44. this.groupBox3.Controls.Add(this.fjh);
  45. this.groupBox3.Controls.Add(this.label3);
  46. this.groupBox3.Controls.Add(this.item);
  47. this.groupBox3.Controls.Add(this.dg);
  48. this.groupBox3.Controls.Add(this.groupBox6);
  49. this.groupBox3.Controls.Add(this.groupBox4);
  50. this.groupBox3.Controls.Add(this.label2);
  51. this.groupBox3.Controls.Add(this.label1);
  52. this.groupBox3.Controls.Add(this.comboBox1);
  53. this.groupBox3.Name = "groupBox3";
  54. // 
  55. // label1
  56. // 
  57. this.label1.Location = new System.Drawing.Point(8, 250);
  58. this.label1.Name = "label1";
  59. this.label1.TabIndex = 0;
  60. this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  61. // 
  62. // label2
  63. // 
  64. this.label2.Location = new System.Drawing.Point(200, 250);
  65. this.label2.Name = "label2";
  66. this.label2.Size = new System.Drawing.Size(144, 23);
  67. this.label2.TabIndex = 1;
  68. this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  69. // 
  70. // groupBox4
  71. // 
  72. this.groupBox4.Location = new System.Drawing.Point(0, 240);
  73. this.groupBox4.Name = "groupBox4";
  74. this.groupBox4.Size = new System.Drawing.Size(384, 3);
  75. this.groupBox4.TabIndex = 2;
  76. this.groupBox4.TabStop = false;
  77. this.groupBox4.Text = "groupBox4";
  78. // 
  79. // button2
  80. // 
  81. this.button2.Location = new System.Drawing.Point(8, 32);
  82. this.button2.Name = "button2";
  83. this.button2.Size = new System.Drawing.Size(48, 23);
  84. this.button2.TabIndex = 0;
  85. this.button2.Text = "查询";
  86. this.button2.Click += new System.EventHandler(this.button2_Click);
  87. // 
  88. // groupBox6
  89. // 
  90. this.groupBox6.Location = new System.Drawing.Point(0, 56);
  91. this.groupBox6.Name = "groupBox6";
  92. this.groupBox6.Size = new System.Drawing.Size(384, 3);
  93. this.groupBox6.TabIndex = 20;
  94. this.groupBox6.TabStop = false;
  95. // 
  96. // dg
  97. // 
  98. this.dg.AlternatingBackColor = System.Drawing.Color.GhostWhite;
  99. this.dg.BackColor = System.Drawing.Color.GhostWhite;
  100. this.dg.BackgroundColor = System.Drawing.Color.Lavender;
  101. this.dg.BorderStyle = System.Windows.Forms.BorderStyle.None;
  102. this.dg.CaptionBackColor = System.Drawing.Color.RoyalBlue;
  103. this.dg.CaptionForeColor = System.Drawing.Color.White;
  104. this.dg.CaptionText = "查询结果";
  105. this.dg.DataMember = "";
  106. this.dg.FlatMode = true;
  107. this.dg.Font = new System.Drawing.Font("Tahoma", 8F);
  108. this.dg.ForeColor = System.Drawing.Color.MidnightBlue;
  109. this.dg.GridLineColor = System.Drawing.Color.RoyalBlue;
  110. this.dg.HeaderBackColor = System.Drawing.Color.MidnightBlue;
  111. this.dg.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
  112. this.dg.HeaderForeColor = System.Drawing.Color.Lavender;
  113. this.dg.LinkColor = System.Drawing.Color.Teal;
  114. this.dg.Location = new System.Drawing.Point(3, 61);
  115. this.dg.Name = "dg";
  116. this.dg.ParentRowsBackColor = System.Drawing.Color.Lavender;
  117. this.dg.ParentRowsForeColor = System.Drawing.Color.MidnightBlue;
  118. this.dg.ReadOnly = true;
  119. this.dg.SelectionBackColor = System.Drawing.Color.Teal;
  120. this.dg.SelectionForeColor = System.Drawing.Color.PaleGreen;
  121. this.dg.Size = new System.Drawing.Size(374, 178);
  122. this.dg.TabIndex = 27;
  123. // 
  124. // label3
  125. // 
  126. this.label3.Location = new System.Drawing.Point(8, 24);
  127. this.label3.Name = "label3";
  128. this.label3.Size = new System.Drawing.Size(72, 23);
  129. this.label3.TabIndex = 29;
  130. this.label3.Text = "查 询 项:";
  131. this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  132. // 
  133. // item
  134. // 
  135. this.item.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  136. this.item.Items.AddRange(new object[] {
  137.   "房间类型",
  138.   "房间号",
  139.   "房态",
  140.   "全部"});
  141. this.item.Location = new System.Drawing.Point(80, 24);
  142. this.item.Name = "item";
  143. this.item.Size = new System.Drawing.Size(128, 20);
  144. this.item.TabIndex = 28;
  145. this.item.SelectedIndexChanged += new System.EventHandler(this.item_SelectedIndexChanged);
  146. // 
  147. // fjh
  148. // 
  149. this.fjh.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple;
  150. this.fjh.Location = new System.Drawing.Point(216, 24);
  151. this.fjh.Name = "fjh";
  152. this.fjh.Size = new System.Drawing.Size(121, 20);
  153. this.fjh.TabIndex = 30;
  154. // 
  155. // comboBox1
  156. // 
  157. this.comboBox1.Location = new System.Drawing.Point(192, 136);
  158. this.comboBox1.Name = "comboBox1";
  159. this.comboBox1.Size = new System.Drawing.Size(121, 20);
  160. this.comboBox1.TabIndex = 30;
  161. // 
  162. // kflx
  163. // 
  164. this.kflx.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  165. this.kflx.Items.AddRange(new object[] {
  166.   "普房",
  167.   "标房",
  168.   "套房",
  169.   "双人间",
  170.   "总统套房"});
  171. this.kflx.Location = new System.Drawing.Point(216, 24);
  172. this.kflx.Name = "kflx";
  173. this.kflx.Size = new System.Drawing.Size(121, 20);
  174. this.kflx.TabIndex = 31;
  175. // 
  176. // ft
  177. // 
  178. this.ft.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
  179. this.ft.Items.AddRange(new object[] {
  180. "空闲",
  181. "入住",
  182. "维修"});
  183. this.ft.Location = new System.Drawing.Point(216, 24);
  184. this.ft.Name = "ft";
  185. this.ft.Size = new System.Drawing.Size(121, 20);
  186. this.ft.TabIndex = 32;
  187. // 
  188. // kfcx
  189. // 
  190. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  191. this.ClientSize = new System.Drawing.Size(480, 283);
  192. this.Name = "kfcx";
  193. this.Text = "客房查询";
  194. this.Load += new System.EventHandler(this.kfcx_Load);
  195. this.groupBox2.ResumeLayout(false);
  196. this.groupBox3.ResumeLayout(false);
  197. ((System.ComponentModel.ISupportInitialize)(this.dg)).EndInit();
  198. } #endregion
  199. DataConn dc=new DataConn ();
  200. private System.Windows.Forms.Label label1;
  201. private System.Windows.Forms.Label label2;
  202. private System.Windows.Forms.GroupBox groupBox4;
  203. private System.Windows.Forms.Button button2;
  204. private System.Windows.Forms.GroupBox groupBox6;
  205. private System.Windows.Forms.DataGrid dg;
  206. private System.Windows.Forms.Label label3;
  207. private System.Windows.Forms.ComboBox item;
  208. private System.Windows.Forms.ComboBox fjh;
  209. private System.Windows.Forms.ComboBox comboBox1;
  210. private System.Windows.Forms.ComboBox kflx;
  211. private System.Windows.Forms.ComboBox ft;
  212. string opername;//传递操作员姓名
  213. private void kfcx_Load(object sender, System.EventArgs e)
  214. {
  215. this.AcceptButton =this.button2 ;
  216. this.label1 .Text ="操 作 员:"+this.opername ;
  217. this.label2 .Text ="查询日期:"+System.DateTime .Today.Date.ToShortDateString();
  218. this.ft.Visible =false;
  219. this.kflx .Visible =false;
  220. this.fjh .Visible =false;
  221. }
  222. private void item_SelectedIndexChanged(object sender, System.EventArgs e)
  223. {
  224. if(item.SelectedIndex==0)
  225. {
  226. ft.Visible =false;
  227. this.kflx .Visible =true;
  228. this.fjh .Visible =false;
  229. }
  230. if(item.SelectedIndex==1)
  231. {
  232. ft.Visible =false;
  233. this.kflx .Visible =false;
  234. this.fjh .Visible =true;
  235. }
  236. if(item.SelectedIndex==2)
  237. {
  238. ft.Visible =true;
  239. this.kflx .Visible =false;
  240. this.fjh .Visible =false;
  241. }
  242. if(item.SelectedIndex==3)
  243. {
  244. ft.Visible =false;
  245. this.kflx .Visible =false;
  246. this.fjh .Visible =false;
  247. }
  248. }
  249. private void button2_Click(object sender, System.EventArgs e)
  250. {
  251. DataConn dc=new DataConn ();
  252. string str=dc.connstr ;
  253. SqlConnection conn=new SqlConnection (str);
  254. DataSet dataset=new DataSet ();
  255. if(this.item .SelectedIndex==0)
  256. {
  257. string sql1="select * from tabkfinfo where 客房类型='"+this.kflx.Text +"'";
  258. SqlDataAdapter a1=new SqlDataAdapter (sql1,conn);
  259. a1.Fill (dataset,"t1");
  260. dg.DataSource =dataset.Tables ["t1"];
  261. a1.Dispose ();
  262. }
  263. if(this.item .SelectedIndex==1)
  264. {
  265. string sql2="select * from tabkfinfo where 房间号='"+this.fjh .Text +"'";
  266. SqlDataAdapter a2=new SqlDataAdapter (sql2,conn);
  267. a2.Fill (dataset,"t2");
  268. dg.DataSource =dataset.Tables ["t2"];
  269. a2.Dispose ();
  270. }
  271. if(this.item .SelectedIndex==2)
  272. {
  273. string sql3="select * from tabkfinfo where 房态='"+this.ft.Text +"'";
  274. SqlDataAdapter a3=new SqlDataAdapter (sql3,conn);
  275. a3.Fill (dataset,"t3");
  276. dg.DataSource =dataset.Tables ["t3"];
  277. a3.Dispose ();
  278. }
  279. if(this.item .SelectedIndex==3)
  280. {
  281. string sql4="select * from tabkfinfo";
  282. SqlDataAdapter a4=new SqlDataAdapter (sql4,conn);
  283. a4.Fill (dataset,"t4");
  284. dg.DataSource =dataset.Tables ["t4"];
  285. a4.Dispose ();
  286. }
  287. dataset.Dispose ();
  288. conn.Dispose ();
  289. } } }