⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sftx.cs

📁 此为本人和同学所开发的酒店管理系统.C#.net.也是软件工程课程的作业.
💻 CS
字号:
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 sftx : RoomManage.pub	{		private System.ComponentModel.IContainer components = null;		public sftx(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(sftx));
			this.groupBox4 = new System.Windows.Forms.GroupBox();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.button2 = new System.Windows.Forms.Button();
			this.groupBox6 = new System.Windows.Forms.GroupBox();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.groupBox5 = new System.Windows.Forms.GroupBox();
			this.dg1 = new System.Windows.Forms.DataGrid();
			this.dg2 = new System.Windows.Forms.DataGrid();
			this.groupBox2.SuspendLayout();
			this.groupBox3.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.dg1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dg2)).BeginInit();
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(8, 80);
			this.button1.Name = "button1";
			// 
			// groupBox1
			// 
			this.groupBox1.Name = "groupBox1";
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.button2);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Controls.SetChildIndex(this.button1, 0);
			this.groupBox2.Controls.SetChildIndex(this.button2, 0);
			// 
			// pictureBox1
			// 
			this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
			this.pictureBox1.Name = "pictureBox1";
			// 
			// groupBox3
			// 
			this.groupBox3.Controls.Add(this.dg2);
			this.groupBox3.Controls.Add(this.dg1);
			this.groupBox3.Controls.Add(this.groupBox5);
			this.groupBox3.Controls.Add(this.label4);
			this.groupBox3.Controls.Add(this.label3);
			this.groupBox3.Controls.Add(this.groupBox6);
			this.groupBox3.Controls.Add(this.label2);
			this.groupBox3.Controls.Add(this.label1);
			this.groupBox3.Controls.Add(this.groupBox4);
			this.groupBox3.Name = "groupBox3";
			// 
			// groupBox4
			// 
			this.groupBox4.Location = new System.Drawing.Point(0, 240);
			this.groupBox4.Name = "groupBox4";
			this.groupBox4.Size = new System.Drawing.Size(384, 3);
			this.groupBox4.TabIndex = 3;
			this.groupBox4.TabStop = false;
			this.groupBox4.Text = "groupBox4";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(200, 248);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(144, 23);
			this.label2.TabIndex = 5;
			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 248);
			this.label1.Name = "label1";
			this.label1.TabIndex = 4;
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// 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 = 1;
			this.button2.Text = "查询";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// groupBox6
			// 
			this.groupBox6.Location = new System.Drawing.Point(0, 48);
			this.groupBox6.Name = "groupBox6";
			this.groupBox6.Size = new System.Drawing.Size(384, 3);
			this.groupBox6.TabIndex = 21;
			this.groupBox6.TabStop = false;
			// 
			// label3
			// 
			this.label3.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label3.ForeColor = System.Drawing.Color.Red;
			this.label3.Location = new System.Drawing.Point(8, 19);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(168, 23);
			this.label3.TabIndex = 22;
			this.label3.Text = "昨日尚未增款的客人";
			this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// label4
			// 
			this.label4.Font = new System.Drawing.Font("宋体", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label4.ForeColor = System.Drawing.Color.Blue;
			this.label4.Location = new System.Drawing.Point(208, 19);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(168, 23);
			this.label4.TabIndex = 23;
			this.label4.Text = "今日需要增款的客人";
			this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
			// 
			// groupBox5
			// 
			this.groupBox5.Location = new System.Drawing.Point(192, 0);
			this.groupBox5.Name = "groupBox5";
			this.groupBox5.Size = new System.Drawing.Size(3, 240);
			this.groupBox5.TabIndex = 24;
			this.groupBox5.TabStop = false;
			// 
			// dg1
			// 
			this.dg1.AlternatingBackColor = System.Drawing.Color.Silver;
			this.dg1.BackColor = System.Drawing.Color.White;
			this.dg1.BackgroundColor = System.Drawing.Color.Lavender;
			this.dg1.CaptionBackColor = System.Drawing.Color.Maroon;
			this.dg1.CaptionFont = new System.Drawing.Font("Tahoma", 8F);
			this.dg1.CaptionForeColor = System.Drawing.Color.White;
			this.dg1.CaptionText = "查询结果";
			this.dg1.DataMember = "";
			this.dg1.Font = new System.Drawing.Font("Tahoma", 8F);
			this.dg1.ForeColor = System.Drawing.Color.Black;
			this.dg1.GridLineColor = System.Drawing.Color.Silver;
			this.dg1.HeaderBackColor = System.Drawing.Color.Silver;
			this.dg1.HeaderFont = new System.Drawing.Font("Tahoma", 8F);
			this.dg1.HeaderForeColor = System.Drawing.Color.Black;
			this.dg1.LinkColor = System.Drawing.Color.Maroon;
			this.dg1.Location = new System.Drawing.Point(0, 56);
			this.dg1.Name = "dg1";
			this.dg1.ParentRowsBackColor = System.Drawing.Color.Silver;
			this.dg1.ParentRowsForeColor = System.Drawing.Color.Black;
			this.dg1.ReadOnly = true;
			this.dg1.SelectionBackColor = System.Drawing.Color.Maroon;
			this.dg1.SelectionForeColor = System.Drawing.Color.White;
			this.dg1.Size = new System.Drawing.Size(190, 184);
			this.dg1.TabIndex = 25;
			// 
			// dg2
			// 
			this.dg2.AlternatingBackColor = System.Drawing.Color.GhostWhite;
			this.dg2.BackColor = System.Drawing.Color.GhostWhite;
			this.dg2.BackgroundColor = System.Drawing.Color.Lavender;
			this.dg2.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.dg2.CaptionBackColor = System.Drawing.Color.RoyalBlue;
			this.dg2.CaptionForeColor = System.Drawing.Color.White;
			this.dg2.CaptionText = "查询结果";
			this.dg2.DataMember = "";
			this.dg2.FlatMode = true;
			this.dg2.Font = new System.Drawing.Font("Tahoma", 8F);
			this.dg2.ForeColor = System.Drawing.Color.MidnightBlue;
			this.dg2.GridLineColor = System.Drawing.Color.RoyalBlue;
			this.dg2.HeaderBackColor = System.Drawing.Color.MidnightBlue;
			this.dg2.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
			this.dg2.HeaderForeColor = System.Drawing.Color.Lavender;
			this.dg2.LinkColor = System.Drawing.Color.Teal;
			this.dg2.Location = new System.Drawing.Point(196, 56);
			this.dg2.Name = "dg2";
			this.dg2.ParentRowsBackColor = System.Drawing.Color.Lavender;
			this.dg2.ParentRowsForeColor = System.Drawing.Color.MidnightBlue;
			this.dg2.ReadOnly = true;
			this.dg2.SelectionBackColor = System.Drawing.Color.Teal;
			this.dg2.SelectionForeColor = System.Drawing.Color.PaleGreen;
			this.dg2.Size = new System.Drawing.Size(188, 184);
			this.dg2.TabIndex = 26;
			// 
			// sftx
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(480, 283);
			this.Name = "sftx";
			this.Text = "宿费提醒";
			this.Load += new System.EventHandler(this.sftx_Load);
			this.groupBox2.ResumeLayout(false);
			this.groupBox3.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dg1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dg2)).EndInit();

		}		#endregion

		private System.Windows.Forms.GroupBox groupBox4;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.GroupBox groupBox6;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.GroupBox groupBox5;
		private System.Windows.Forms.DataGrid dg1;
		private System.Windows.Forms.DataGrid dg2;
		string opername;//传递操作员姓名
		private void sftx_Load(object sender, System.EventArgs e)
		{
			this.AcceptButton =this.button2 ;
			this.label1 .Text ="操 作 员:"+this.opername ;
			this.label2 .Text ="查询日期:"+System.DateTime .Today.Date.ToShortDateString();

			//绑定dg1
			DataConn dc=new DataConn ();
			string str=dc.connstr ;
			SqlConnection conn=new SqlConnection (str);
			DataSet dataset=new DataSet ();
			string sql="select 凭证号码,姓名,房间号,联系电话,提醒日期 from tabdjb where 提醒日期<'"+System.DateTime .Today .ToShortDateString() +"'";
			SqlDataAdapter a1=new SqlDataAdapter (sql,conn);
			a1.Fill (dataset,"t1");
			dg1.DataSource =dataset.Tables ["t1"];
			
			a1.Dispose ();
			dataset.Dispose ();
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			//绑定dg2
			DataConn dc=new DataConn ();
			string str=dc.connstr ;
			SqlConnection conn=new SqlConnection (str);
			DataSet dataset=new DataSet ();
			string sql="select 凭证号码,姓名,房间号,联系电话 from tabdjb where 提醒日期='"+System.DateTime .Today .ToShortDateString() +"'";
			SqlDataAdapter a1=new SqlDataAdapter (sql,conn);
			a1.Fill (dataset,"t1");
			dg2.DataSource =dataset.Tables ["t1"];
			
			a1.Dispose ();
			dataset.Dispose ();
		
		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -