📄 weishuasearchframe.cs
字号:
#region Name Placeusing System;using System.Collections;using System.ComponentModel;using System.Drawing;using System.Windows.Forms;using System.Data.SqlClient;using System.Data;using System.IO;#endregionnamespace WindowsApplication{ public class WeiShuaSearchFrame : WindowsApplication.Title.Title {
#region Control
private System.Windows.Forms.Button btnHistory;
private System.Windows.Forms.ComboBox searchText;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.ComboBox resultText;
private System.Windows.Forms.Label label5;
protected System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.DateTimePicker EndDateTime;
private System.Windows.Forms.DateTimePicker startDateTime;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
protected System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.CheckBox cheNight;
private System.Windows.Forms.CheckBox cheMiddle;
private System.Windows.Forms.CheckBox cheMorming;
private System.Windows.Forms.Label label2; private System.ComponentModel.IContainer components = null; #endregion
#region 构造函数... public WeiShuaSearchFrame() { // 该调用是 Windows 窗体设计器所必需的。 InitializeComponent(); // TODO: 在 InitializeComponent 调用后添加任何初始化 } /// <summary> /// 清理所有正在使用的资源。 /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #endregion #region 设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// </summary> private void InitializeComponent() { this.btnHistory = new System.Windows.Forms.Button();
this.searchText = new System.Windows.Forms.ComboBox();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
this.resultText = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.EndDateTime = new System.Windows.Forms.DateTimePicker();
this.startDateTime = new System.Windows.Forms.DateTimePicker();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.cheNight = new System.Windows.Forms.CheckBox();
this.cheMiddle = new System.Windows.Forms.CheckBox();
this.cheMorming = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(432, 32);
this.label1.Text = "未到查询";
//
// btnHistory
//
this.btnHistory.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.btnHistory.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnHistory.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnHistory.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnHistory.Location = new System.Drawing.Point(237, 248);
this.btnHistory.Name = "btnHistory";
this.btnHistory.TabIndex = 33;
this.btnHistory.Text = "记录";
this.btnHistory.Click += new System.EventHandler(this.btnHistory_Click);
//
// searchText
//
this.searchText.Cursor = System.Windows.Forms.Cursors.Hand;
this.searchText.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple;
this.searchText.Items.AddRange(new object[] {
"当天",
"本周",
"上周"});
this.searchText.Location = new System.Drawing.Point(101, 168);
this.searchText.Name = "searchText";
this.searchText.Size = new System.Drawing.Size(120, 20);
this.searchText.TabIndex = 32;
this.searchText.SelectedIndexChanged += new System.EventHandler(this.searchText_SelectedIndexChanged);
this.searchText.MouseEnter += new System.EventHandler(this.resultText_MouseEnter);
this.searchText.MouseLeave += new System.EventHandler(this.resultText_MouseLeave);
//
// btnCancel
//
this.btnCancel.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.btnCancel.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Location = new System.Drawing.Point(341, 248);
this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 31;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnOk
//
this.btnOk.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.btnOk.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOk.Location = new System.Drawing.Point(133, 248);
this.btnOk.Name = "btnOk";
this.btnOk.TabIndex = 30;
this.btnOk.Text = "确定";
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// resultText
//
this.resultText.Cursor = System.Windows.Forms.Cursors.Hand;
this.resultText.DropDownStyle = System.Windows.Forms.ComboBoxStyle.Simple;
this.resultText.Items.AddRange(new object[] {
"日期",
"时间",
"姓名"});
this.resultText.Location = new System.Drawing.Point(101, 208);
this.resultText.Name = "resultText";
this.resultText.Size = new System.Drawing.Size(120, 20);
this.resultText.TabIndex = 29;
this.resultText.SelectedIndexChanged += new System.EventHandler(this.resultText_SelectedIndexChanged);
this.resultText.MouseEnter += new System.EventHandler(this.resultText_MouseEnter);
this.resultText.MouseLeave += new System.EventHandler(this.resultText_MouseLeave);
//
// label5
//
this.label5.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.label5.Cursor = System.Windows.Forms.Cursors.Hand;
this.label5.Location = new System.Drawing.Point(13, 208);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(80, 23);
this.label5.TabIndex = 28;
this.label5.Text = "结果:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// groupBox2
//
this.groupBox2.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.groupBox2.Controls.Add(this.EndDateTime);
this.groupBox2.Controls.Add(this.startDateTime);
this.groupBox2.Controls.Add(this.label4);
this.groupBox2.Controls.Add(this.label3);
this.groupBox2.Cursor = System.Windows.Forms.Cursors.Hand;
this.groupBox2.Location = new System.Drawing.Point(5, 40);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(248, 112);
this.groupBox2.TabIndex = 25;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "统计时间";
//
// EndDateTime
//
this.EndDateTime.Location = new System.Drawing.Point(112, 72);
this.EndDateTime.Name = "EndDateTime";
this.EndDateTime.Size = new System.Drawing.Size(117, 21);
this.EndDateTime.TabIndex = 7;
this.EndDateTime.Value = new System.DateTime(2006, 10, 18, 11, 42, 17, 281);
//
// startDateTime
//
this.startDateTime.Location = new System.Drawing.Point(112, 32);
this.startDateTime.Name = "startDateTime";
this.startDateTime.Size = new System.Drawing.Size(117, 21);
this.startDateTime.TabIndex = 6;
this.startDateTime.Value = new System.DateTime(2006, 10, 18, 11, 42, 17, 281);
//
// label4
//
this.label4.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.label4.Cursor = System.Windows.Forms.Cursors.Hand;
this.label4.Location = new System.Drawing.Point(24, 72);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(80, 23);
this.label4.TabIndex = 5;
this.label4.Text = "结束日期:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.label3.Cursor = System.Windows.Forms.Cursors.Hand;
this.label3.Location = new System.Drawing.Point(24, 32);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(80, 23);
this.label3.TabIndex = 4;
this.label3.Text = "起始日期:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// groupBox3
//
this.groupBox3.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.groupBox3.Controls.Add(this.cheNight);
this.groupBox3.Controls.Add(this.cheMiddle);
this.groupBox3.Controls.Add(this.cheMorming);
this.groupBox3.Cursor = System.Windows.Forms.Cursors.Hand;
this.groupBox3.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.groupBox3.Location = new System.Drawing.Point(261, 40);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(160, 192);
this.groupBox3.TabIndex = 26;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "统计数据(&S)";
//
// cheNight
//
this.cheNight.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.cheNight.Cursor = System.Windows.Forms.Cursors.Hand;
this.cheNight.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cheNight.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.cheNight.Location = new System.Drawing.Point(32, 136);
this.cheNight.Name = "cheNight";
this.cheNight.TabIndex = 2;
this.cheNight.Text = "晚上";
this.cheNight.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// cheMiddle
//
this.cheMiddle.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.cheMiddle.Cursor = System.Windows.Forms.Cursors.Hand;
this.cheMiddle.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cheMiddle.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.cheMiddle.Location = new System.Drawing.Point(32, 88);
this.cheMiddle.Name = "cheMiddle";
this.cheMiddle.TabIndex = 1;
this.cheMiddle.Text = "中午";
this.cheMiddle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// cheMorming
//
this.cheMorming.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cheMorming.Location = new System.Drawing.Point(32, 40);
this.cheMorming.Name = "cheMorming";
this.cheMorming.TabIndex = 0;
this.cheMorming.Text = "早上";
this.cheMorming.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label2
//
this.label2.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.label2.Cursor = System.Windows.Forms.Cursors.Hand;
this.label2.Location = new System.Drawing.Point(13, 168);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(80, 23);
this.label2.TabIndex = 27;
this.label2.Text = "查询:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// WeiShuaSearchFrame
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(434, 279);
this.Controls.Add(this.btnHistory);
this.Controls.Add(this.searchText);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.resultText);
this.Controls.Add(this.label5);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.label2);
this.Name = "WeiShuaSearchFrame";
this.Text = "WeiShuaSearchFrame";
this.Load += new System.EventHandler(this.WeiShuaSearchFrame_Load);
this.Controls.SetChildIndex(this.label1, 0);
this.Controls.SetChildIndex(this.label2, 0);
this.Controls.SetChildIndex(this.groupBox3, 0);
this.Controls.SetChildIndex(this.groupBox2, 0);
this.Controls.SetChildIndex(this.label5, 0);
this.Controls.SetChildIndex(this.resultText, 0);
this.Controls.SetChildIndex(this.btnOk, 0);
this.Controls.SetChildIndex(this.btnCancel, 0);
this.Controls.SetChildIndex(this.searchText, 0);
this.Controls.SetChildIndex(this.btnHistory, 0);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
} #endregion #region 初始化程序...
private void WeiShuaSearchFrame_Load(object sender, System.EventArgs e)
{
try
{
#region 初始化控件变量...
int hour=System.DateTime.Now.Hour;
if(hour>=8 && hour<=11)
{
this.cheMorming.Checked=true;
}
else if(hour>=12 && hour<=15)
{
this.cheMiddle.Checked=true;
}
else if(hour>18 && hour<=23)
{
this.cheNight.Checked=true;
}
#endregion
#region 初始化数据库变量...
#endregion
#region 初始化 searchText控件为本周
this.searchText.SelectedIndex=1;
#endregion
#region 初始化 resultText 为 日期
this.resultText.SelectedIndex=0;
#endregion
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
} #endregion
#region 返回是星期日是哪一天...
private String returnWeekSeveral(string strweek,int year,int month,int day)
{
string strDateTime="";
try
{
if(strweek.Equals("Sunday"))
{
int lastday=day-0;
strDateTime=year.ToString()+"-"+month.ToString()+"-"+lastday.ToString();
}
else if(strweek.Equals("Monday"))
{
if(day<=1)
{
int lastmonth=month-1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -