📄 mainframe.cs
字号:
this.statusPanel.TabIndex = 1;
//
// stautsBar
//
this.stautsBar.Icon = ((System.Drawing.Icon)(resources.GetObject("stautsBar.Icon")));
this.stautsBar.Text = "状态:";
this.stautsBar.Width = 200;
//
// stautsUser
//
this.stautsUser.Icon = ((System.Drawing.Icon)(resources.GetObject("stautsUser.Icon")));
this.stautsUser.Text = "用户:";
this.stautsUser.Width = 150;
//
// statusTime
//
this.statusTime.Icon = ((System.Drawing.Icon)(resources.GetObject("statusTime.Icon")));
this.statusTime.Text = "时间:";
this.statusTime.Width = 170;
//
// stautsOther
//
this.stautsOther.Icon = ((System.Drawing.Icon)(resources.GetObject("stautsOther.Icon")));
this.stautsOther.Text = "其他:";
this.stautsOther.Width = 600;
//
// toolBarImageList
//
this.toolBarImageList.ImageSize = new System.Drawing.Size(16, 16);
this.toolBarImageList.TransparentColor = System.Drawing.Color.Transparent;
//
// CurrentTime
//
this.CurrentTime.Enabled = true;
this.CurrentTime.Interval = 1000;
this.CurrentTime.Tick += new System.EventHandler(this.CurrentTime_Tick);
//
// PopedomTimer
//
this.PopedomTimer.Enabled = true;
this.PopedomTimer.Interval = 1000;
this.PopedomTimer.Tick += new System.EventHandler(this.PopedomTimer_Tick);
//
// ModifyPopedomTimer
//
this.ModifyPopedomTimer.Interval = 1000;
this.ModifyPopedomTimer.Tick += new System.EventHandler(this.ModifyPopedomTimer_Tick);
//
// contextMenu
//
this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menucontextShowTileBar,
this.menucontextTitle});
//
// menucontextShowTileBar
//
this.menucontextShowTileBar.Index = 0;
this.menucontextShowTileBar.Text = "显示标题栏(&S)";
this.menucontextShowTileBar.Click += new System.EventHandler(this.menucontextShowTileBar_Click);
//
// menucontextTitle
//
this.menucontextTitle.Index = 1;
this.menucontextTitle.RadioCheck = true;
this.menucontextTitle.Text = "隐藏标题栏(&H)";
this.menucontextTitle.Click += new System.EventHandler(this.menucontextTitle_Click);
//
// sqlDataAdapter
//
this.sqlDataAdapter.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "UserOperatorTable_History", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("编号", "编号"),
new System.Data.Common.DataColumnMapping("日期", "日期"),
new System.Data.Common.DataColumnMapping("时间", "时间"),
new System.Data.Common.DataColumnMapping("操作员", "操作员"),
new System.Data.Common.DataColumnMapping("状态", "状态")})});
this.sqlDataAdapter.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM UserOperatorTable_History WHERE (编号 = @Original_编号) AND (操作员 = @Original_操作员 OR @Original_操作员 IS NULL AND 操作员 IS NULL) AND (日期 = @Original_日期) AND (时间 = @Original_时间 OR @Original_时间 IS NULL AND 时间 IS NULL) AND (状态 = @Original_状态 OR @Original_状态 IS NULL AND 状态 IS NULL)";
this.sqlDeleteCommand1.Connection = this.sqlConnection;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "编号", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_操作员", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "操作员", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_日期", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "日期", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_时间", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "时间", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_状态", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "状态", System.Data.DataRowVersion.Original, null));
//
// sqlConnection
//
this.sqlConnection.ConnectionString = "workstation id=localhost;integrated security=SSPI;database=SystemODBC";
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO UserOperatorTable_History(日期, 时间, 操作员, 状态) VALUES (@日期, @时间, @操作员, @状" +
"态); SELECT 编号, 日期, 时间, 操作员, 状态 FROM UserOperatorTable_History WHERE (编号 = @@IDEN" +
"TITY)";
this.sqlInsertCommand1.Connection = this.sqlConnection;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@日期", System.Data.SqlDbType.DateTime, 8, "日期"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@时间", System.Data.SqlDbType.VarChar, 50, "时间"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@操作员", System.Data.SqlDbType.VarChar, 50, "操作员"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@状态", System.Data.SqlDbType.VarChar, 50, "状态"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 编号, 日期, 时间, 操作员, 状态 FROM UserOperatorTable_History";
this.sqlSelectCommand1.Connection = this.sqlConnection;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE UserOperatorTable_History SET 日期 = @日期, 时间 = @时间, 操作员 = @操作员, 状态 = @状态 WHERE (编号 = @Original_编号) AND (操作员 = @Original_操作员 OR @Original_操作员 IS NULL AND 操作员 IS NULL) AND (日期 = @Original_日期) AND (时间 = @Original_时间 OR @Original_时间 IS NULL AND 时间 IS NULL) AND (状态 = @Original_状态 OR @Original_状态 IS NULL AND 状态 IS NULL); SELECT 编号, 日期, 时间, 操作员, 状态 FROM UserOperatorTable_History WHERE (编号 = @编号)";
this.sqlUpdateCommand1.Connection = this.sqlConnection;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@日期", System.Data.SqlDbType.DateTime, 8, "日期"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@时间", System.Data.SqlDbType.VarChar, 50, "时间"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@操作员", System.Data.SqlDbType.VarChar, 50, "操作员"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@状态", System.Data.SqlDbType.VarChar, 50, "状态"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "编号", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_操作员", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "操作员", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_日期", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "日期", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_时间", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "时间", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_状态", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "状态", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@编号", System.Data.SqlDbType.Int, 4, "编号"));
//
// mainFrame
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.SkyBlue;
this.ClientSize = new System.Drawing.Size(930, 451);
this.ContextMenu = this.contextMenu;
this.Controls.Add(this.statusPanel);
this.Controls.Add(this.tool);
this.Cursor = System.Windows.Forms.Cursors.Hand;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.IsMdiContainer = true;
this.Menu = this.mainMenu;
this.Name = "mainFrame";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "考勤管理系统";
this.toolTip.SetToolTip(this, "当标题栏隐藏时右键");
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.mainFrame_Load);
this.Closed += new System.EventHandler(this.mainFrame_Closed);
((System.ComponentModel.ISupportInitialize)(this.stautsBar)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.stautsUser)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.statusTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.stautsOther)).EndInit();
this.ResumeLayout(false);
}
#endregion
#region 程序入口
[STAThread]
static void Main()
{
WindowsApplication.WelCome.Welcome log=new WindowsApplication.WelCome.Welcome();
log.ShowDialog();
// WelcomeFrame log=new WelcomeFrame();
// log.ShowDialog();
BrushKaIDFrame login=new BrushKaIDFrame();
login.ShowDialog();
// System.Diagnostics.Process.Start("");
landFrame logi=new landFrame();
logi.ShowDialog();
if(landFrame.blTure.Equals(true))
{
Application.Run(new mainFrame());
}
}
#endregion
#region 事件开始...
private void mainFrame_Load(object sender, System.EventArgs e)
{
#region 状态栏上信息
this.stautsBar.Text="版本:"+Application.ProductVersion;
this.stautsOther.Text="你好,正在使用考勤系统...";
#endregion
#region 窗体初始化...
this.menuNavigation.Checked=false;
log.startLoadQuanXian.Enabled=true;
if(landFrame.blM.Equals(true))
{
this.menuNavigation.Checked=true;
}
if(this.menuNavigation.Checked.Equals(true))
{
this.menuNavigation_Click(null,null);
//menuLookBrush_Click(null,null);
menuKQM_Click(sender,e);
//menuEmployeeHistory_Click(sender,e);
blQuanXian=true;
if(blQuanXian.Equals(true))
{
//this.menuNavigation_Click(null,null);
//menuLookBrush_Click(null,null);
menuKQM_Click(sender,e);
menuEmployeeHistory_Click(sender,e);
}
}
// if(landFrame.blTool.Equals(false))
// {
// this.menuTool.Checked=false;
// this.tool.Visible=false;
// }
// if(landFrame.blStauts.Equals(false))
// {
// this.menuStatus.Checked=false;
// this.statusPanel.Visible=false;
// }
#endregion
#region 标题栏显示与隐藏初始化...
this.menucontextTitle.Enabled=true;
this.menucontextShowTileBar.Enabled=false;
// this.menucontextMax.Enabled=false;
// this.menucontextMin.Enabled=true;
// this.menucontextClose.Enabled=true;
// this.menucontextNormal.Enabled=true;
#endregion
}
//考勤开始...
private void menuKQM_Click(object sender, System.EventArgs e)
{
if(this.CheckIsExistMDIForm("员工考勤"))
{
return;
}
str="员工考勤";
UserOperatorHistory(str);
员工考勤 log=new 员工考勤();
log.MdiParent=this;
log.Show();
}
//用户发卡历史...
private void menuFaKaHistory_Click(object sender, System.EventArgs e)
{
if(this.CheckIsExistMDIForm("FaKaHistoryFrame"))
{
return;
}
str="发卡历史";
UserOperatorHistory(str);
FaKaHistoryFrame log=new FaKaHistoryFrame();
log.MdiParent=this;
log.Show();
}
//判断是否已经存在了该窗体,如果是,将它激活并赋予正常显示窗体.
private bool CheckIsExistMDIForm(string childFrame)
{
foreach(Form childFr in this.MdiChildren)
{
if(childFr.Name.Equals(childFrame))
{
if(childFr.WindowState.Equals(FormWindowState.Maximized ))
{
childFr.WindowState=FormWindowState.Normal;
}
childFr.Activate();
return (true);
}
}
return (false);
}
//启动当前时间...
private void CurrentTime_Tick(object sender, System.EventArgs e)
{
this.statusTime.Text="当前时间:"+dealTime.dealTime.dealTimeString(System.DateTime.Now.Hour,System.DateTime.Now.Minute,System.DateTime.Now.Second).Trim();
}
//报表管理
//年,月,日三个事件处理...
private void menuYear_Click(object sender, System.EventArgs e)
{
if(this.CheckIsExistMDIForm("YearStatisticFrame"))
{
return;
}
str="年统计";
UserOperatorHistory(str);
YearStatisticFrame login=new YearStatisticFrame();
login.MdiParent=this;
login.Show();
}
private void menuMonth_Click(object sender, System.EventArgs e)
{
if(this.CheckIsExistMDIForm("MonthStatictisFrame"))
{
return;
}
str="月统计";
UserOperatorHistory(str);
MonthStatictisFrame login=new MonthStatictisFrame();
login.MdiParent=this;
login.Show();
}
private void menuDay_Click(object sender, System.EventArgs e)
{
if(this.CheckIsExistMDIForm("DaySearchFrame"))
{
return;
}
str="日统计";
UserOperatorHistory(str);
DaySearchFrame login=new DaySearchFrame();
login.MdiParent=this;
login.Show();
}
//考勤统计的历史数据如下....
private void menuHistory_Click(object sender, System.EventArgs e)
{
if(this.CheckIsExistMDIForm("HistoryDatabase"))
{
return;
}
str="考勤统计";
UserOperatorHistory(str);
HistoryDatabase log=new HistoryDatabase();
log.MdiParent=this;
log.Show();
}
//用户管理...
private void menuUserManager_Click(object sender, System.EventArgs e)
{
if(this.CheckIsExistMDIForm("UserManager"))
{
return;
}
str="用户管理";
UserOperatorHistory(str);
UserManager log=new UserManager();
log.MdiParent=this;
log.Show();
}
//权限管理...
private void menuPopedomManager_Click(object sender, System.EventArgs e)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -