searchbrushframehistory.cs
来自「独立完成考勤管理软件加打卡系统(C#) 是打卡加管理系统软件 」· CS 代码 · 共 528 行 · 第 1/2 页
CS
528 行
//
// brushTime
//
this.brushTime.Icon = ((System.Drawing.Icon)(resources.GetObject("brushTime.Icon")));
this.brushTime.Text = "时间:";
this.brushTime.Width = 150;
//
// brushUser
//
this.brushUser.Icon = ((System.Drawing.Icon)(resources.GetObject("brushUser.Icon")));
this.brushUser.Text = "管理员:";
this.brushUser.Width = 150;
//
// brushStauts
//
this.brushStauts.Icon = ((System.Drawing.Icon)(resources.GetObject("brushStauts.Icon")));
this.brushStauts.Text = "状态:";
this.brushStauts.Width = 150;
//
// currentTimer
//
this.currentTimer.Enabled = true;
this.currentTimer.Interval = 1000;
this.currentTimer.Tick += new System.EventHandler(this.currentTimer_Tick);
//
// SearchBrushFrameHistory
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
this.ClientSize = new System.Drawing.Size(778, 447);
this.Controls.Add(this.brushStatus);
this.Controls.Add(this.dataGrid);
this.Controls.Add(this.tool);
this.Controls.Add(this.label1);
this.Cursor = System.Windows.Forms.Cursors.Hand;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SearchBrushFrameHistory";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "SearchBrushFrameHistory";
this.Load += new System.EventHandler(this.SearchBrushFrameHistory_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.brushID)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.brushDate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.brushTime)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.brushUser)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.brushStauts)).EndInit();
this.ResumeLayout(false);
}
#endregion
#region 查询按钮事件...
private void menuDateTime_Click(object sender, System.EventArgs e)
{
WindowsApplication.searchBrushFrameHistory.brushDateTimeFrame log=new WindowsApplication.searchBrushFrameHistory.brushDateTimeFrame();
log.ShowDialog();
}
private void menuName_Click(object sender, System.EventArgs e)
{
searchNameFrame log=new searchNameFrame();
log.ShowDialog();
}
#endregion
#region 工具栏上事件...
private void tool_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
try
{
switch(this.tool.Buttons.IndexOf(e.Button))
{
case 0:
{
this.dataGrid.UnSelect(this.cmOrders.Position);
this.cmOrders.Position=0;
this.dataGrid.Select(this.cmOrders.Position);
this.dataGrid.CurrentRowIndex=this.cmOrders.Position;
MessageBox.Show(this,"你已经到了第一条记录啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.tFirst.Enabled=false;
this.tLast.Enabled=false;
this.tEnd.Enabled=true;
this.tNext.Enabled=true;
break;
}
case 1:
{
if(this.cmOrders.Position==0)
{
MessageBox.Show(this,"你已经到了第一条记录啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.tFirst.Enabled=false;
this.tLast.Enabled=false;
this.tEnd.Enabled=true;
this.tNext.Enabled=true;
}
else if(this.cmOrders.Position>0)
{
this.dataGrid.UnSelect(this.cmOrders.Position);
this.cmOrders.Position--;
this.dataGrid.Select(this.cmOrders.Position);
this.dataGrid.CurrentRowIndex=this.cmOrders.Position;
}
break;
}
case 2:
{
if(this.cmOrders.Position.Equals(this.cmOrders.Count-1))
{
MessageBox.Show(this,"你已经到了最后一条记录啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.tFirst.Enabled=true;
this.tLast.Enabled=true;
this.tEnd.Enabled=false;
this.tNext.Enabled=false;
}
else if(this.cmOrders.Position<this.cmOrders.Count-1)
{
this.dataGrid.UnSelect(this.cmOrders.Position);
this.cmOrders.Position++;
this.dataGrid.Select(this.cmOrders.Position);
this.dataGrid.CurrentRowIndex=this.cmOrders.Position;
}
break;
}
case 3:
{
this.dataGrid.UnSelect(this.cmOrders.Position);
this.cmOrders.Position=this.cmOrders.Count-1;
this.dataGrid.Select(this.cmOrders.Position);
this.dataGrid.CurrentRowIndex=this.cmOrders.Position;
MessageBox.Show(this,"你已经到了最后一条记录啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.tFirst.Enabled=true;
this.tLast.Enabled=true;
this.tEnd.Enabled=false;
this.tNext.Enabled=false;
break;
}
case 4:
{
MessageBox.Show(this,"展开快捷菜单!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
break;
}
case 5://清除历史记录
{
ClearEmp_TimeFunction();
break;
}
case 6://退出
{
DialogResult result=MessageBox.Show(this,"是否关闭窗体啊!!!","提示信息",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
if(result.Equals(DialogResult.Yes))
{
Close();
}
else
{
return;
}
break;
}
}
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region ClearEmp_TimeFunction()
private void ClearEmp_TimeFunction()
{
string deleteStr="delete from Emp_Time";
int k=conn.ExcuteStrSql(deleteStr);
if(k>0)
{
//MessageBox.Show(this,"清除历史成功!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
ClearDataGrid(tempTable);
}
else
{
MessageBox.Show(this,"清除历史失败!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region 初始化事件...
private void SearchBrushFrameHistory_Load(object sender, System.EventArgs e)
{
try
{
#region 初始化变量...
tempTable=ExcuteSql(searchSql,"Emp_Time");
dataGrid.DataSource=tempTable;
this.brushUser.Text="操作员:"+landFrame.strName;
this.brushStatus.Text="状态:无";
this.brushID.Text="今天刷卡记录:"+selectCount().Trim()+"人";
this.cmOrders=(System.Windows.Forms.CurrencyManager) BindingContext[tempTable];
#endregion
}
catch(Exception esl)
{
MessageBox.Show(this,esl.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region ClearDataGrid(tempTable);
private void ClearDataGrid(DataTable tempData)
{
if(tempData.Rows.Count>0)
{
for(int u=this.cmOrders.Position;u<this.cmOrders.Count;u++)
{
this.cmOrders.RemoveAt(u);
}
this.cmOrders.Refresh();
}
else
{
MessageBox.Show(this,"表已经没有数据可言啊!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
return;
}
}
#endregion
#region DataFunction
private DataTable ExcuteSql(string strSql,string tableName)
{
DataSet dsSet=new DataSet();
DataTable dsTable=new DataTable();
try
{
dsSet=conn.ExcuteDataSetResult(strSql,tableName);
dsTable=dsSet.Tables[0];
}
catch(Exception eles)
{
MessageBox.Show(this,eles.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
return dsTable;
}
#endregion
#region 时间日期处理函数...
private void currentTimer_Tick(object sender, System.EventArgs e)
{
this.brushTime.Text="时间:"+System.DateTime.Now.ToLongTimeString();
this.brushDate.Text="日期:"+System.DateTime.Now.ToLongDateString();
}
#endregion
#region selectCount()
private String selectCount()
{
string temp="";
string selectBrushID="select count(*) from Emp_Time where 日期='"+System.DateTime.Now.ToLongDateString()+"'";
DataTable tempBrushTable=new DataTable();
tempBrushTable=ExcuteSql(selectBrushID,"Emp_Time");
for(int k=0;k<tempBrushTable.Rows.Count;k++)
{
temp=tempBrushTable.Rows[k][0].ToString().Trim();
}
return temp;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?