📄 employeebrushframehistory.cs
字号:
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("状态", "状态")})});
//
// sqlSelectCommand2
//
this.sqlSelectCommand2.CommandText = "SELECT 编号, 日期, 时间, 卡号, 职工名称, 状态 FROM BrushIDHistory WHERE (卡号 LIKE @Param27) AND " +
"(日期 LIKE @Param26) AND (职工名称 LIKE @Param25)";
this.sqlSelectCommand2.Connection = this.sqlConnection1;
this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param25", System.Data.SqlDbType.VarChar, 50, "职工名称"));
this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param26", System.Data.SqlDbType.VarChar, 50, "日期"));
this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param27", System.Data.SqlDbType.VarChar, 50, "卡号"));
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=localhost;integrated security=SSPI;database=SystemODBC";
//
// EmployeeBrushFrameHistory
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(728, 503);
this.Controls.Add(this.AllText);
this.Controls.Add(this.TimeText);
this.Controls.Add(this.DateText);
this.Controls.Add(this.userText);
this.Controls.Add(this.CurrentReturn);
this.Controls.Add(this.CurrentTime);
this.Controls.Add(this.CurrentDate);
this.Controls.Add(this.UserLabel);
this.Controls.Add(this.BrushIDComBoBox);
this.Controls.Add(this.DateComboBox);
this.Controls.Add(this.Emp_Name);
this.Controls.Add(this.label2);
this.Controls.Add(this.tool);
this.Controls.Add(this.dataGrid);
this.Controls.Add(this.btnSearch);
this.Controls.Add(this.dateLabel);
this.Controls.Add(this.label1);
this.Controls.Add(this.StausLabel);
this.Controls.Add(this.TitleLabel);
this.Controls.Add(this.backLabel);
this.Cursor = System.Windows.Forms.Cursors.Hand;
this.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "EmployeeBrushFrameHistory";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "EmployeeBrushFrameHistory";
this.Load += new System.EventHandler(this.EmployeeBrushFrameHistory_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.brushIDSet)).EndInit();
this.ResumeLayout(false);
}
#endregion
#region Init Event....
private void EmployeeBrushFrameHistory_Load(object sender, System.EventArgs e)
{
try
{
#region Init FrameEvent...
this.sqlDataAdapter1.SelectCommand.Parameters[0].Value="%%";
this.sqlDataAdapter1.SelectCommand.Parameters[1].Value="%%";
this.sqlDataAdapter1.SelectCommand.Parameters[2].Value="%%";
this.sqlDataAdapter1.Fill(this.brushIDSet);
DataTable tempTable=new DataTable();
this.sqlDataAdapter.Fill(brushIDSet);
tempTable=brushIDSet.Tables[0];
dataGrid.DataSource=tempTable;
this.DateText.Text=DateTime.Now.ToString("yyyy-MM-dd").Trim();
this.userText.Text=landFrame.strUserName;
cmOrders=(System.Windows.Forms.CurrencyManager) BindingContext[tempTable];
this.AllText.Text=WindowsApplication.selectCount.selectCountDB.searchCount("select count(*) from BrushIDHistory").Trim()+"条";
#endregion
#region Init ComboBoxValue...
InitComboBoxValue();
#endregion
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region Tool...
private void tool_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
try
{
if(e.Button.Text.ToString().Equals("首记录"))
{
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.tNext.Enabled=true;
this.tEnd.Enabled=true;
return;
}
else if(e.Button.Text.ToString().Equals("尾记录"))
{
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.tNext.Enabled=false;
this.tEnd.Enabled=false;
return;
}
else if(e.Button.Text.ToString().Equals("下一条记录"))
{
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.tNext.Enabled=false;
this.tEnd.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;
}
return;
}
else if(e.Button.Text.ToString().Equals("上一条记录"))
{
if(this.cmOrders.Position==0)
{
MessageBox.Show(this,"你已经到了记录开始了,无法继续向上移动了啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.tFirst.Enabled=false;
this.tLast.Enabled=false;
this.tNext.Enabled=true;
this.tEnd.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;
}
return;
}
else if(e.Button.Text.ToString().Equals("删除历史"))
{
string delteStr="delete from BrushIDHistory";
ConnectionData conn=new ConnectionData();
int k=conn.ExcuteStrSql(delteStr);
if(k>0)
{
this.brushIDSet.BrushIDHistory.Clear();
}
else
{
MessageBox.Show(this,"删除失败啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
else if(e.Button.Text.ToString().Equals("退出"))
{
DialogResult result=MessageBox.Show(this,"是否要关闭此窗体啦!!!","提示信息",MessageBoxButtons.YesNo,MessageBoxIcon.Information);
if(result.Equals(DialogResult.Yes))
{
Close();
}
else
{
return;
}
return;
}
else if(e.Button.ToolTipText.ToString().Equals("删除"))
{
if(this.ds.Tables[0].Rows.Count>0)
{
this.cmOrders.RemoveAt(this.cmOrders.Position);
sqlDataAdapter.Update(ds);
}
else
{
return;
}
return;
}
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region search...
private void button1_Click(object sender, System.EventArgs e)
{
try
{
this.sqlDataAdapter1.SelectCommand.Parameters[0].Value="%%";
this.sqlDataAdapter1.SelectCommand.Parameters[1].Value="%%";
this.sqlDataAdapter1.SelectCommand.Parameters[2].Value="%%";
if(this.Emp_Name.Text!="")
{
this.sqlDataAdapter1.SelectCommand.Parameters[0].Value="%"+this.Emp_Name.Text+"%";
}
else if(this.DateComboBox.Text!="")
{
this.sqlDataAdapter1.SelectCommand.Parameters[1].Value="%"+this.DateComboBox.Text+"%";
}
else if(this.BrushIDComBoBox.Text!="")
{
this.sqlDataAdapter1.SelectCommand.Parameters[2].Value="%"+this.BrushIDComBoBox.Text+"%";
}
this.brushIDSet.BrushIDHistory.Clear();
this.sqlDataAdapter1.Fill(this.brushIDSet);
this.dataGrid.DataSource=this.brushIDSet.Tables[0];
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region 所有记录...
private void dataGrid_CurrentCellChanged(object sender, System.EventArgs e)
{
}
#endregion
#region Cusors Event....
private void BrushIDComBoBox_MouseLeave(object sender, System.EventArgs e)
{
ComboBox com=(ComboBox)sender;
com.DropDownStyle=System.Windows.Forms.ComboBoxStyle.Simple;
}
private void BrushIDComBoBox_MouseEnter(object sender, System.EventArgs e)
{
ComboBox com=(ComboBox)sender;
com.DropDownStyle=System.Windows.Forms.ComboBoxStyle.DropDown;
}
#endregion
#region TimeEvent...
private void currentTimer_Tick(object sender, System.EventArgs e)
{
this.TimeText.Text=WindowsApplication.dealTime.dealTime.dealTimeString(System.DateTime.Now.Hour,System.DateTime.Now.Minute,System.DateTime.Now.Second).Trim();
}
#endregion
#region Init ComboBoxValue...
private void InitComboBoxValue()
{
DataTable tempTable=new DataTable();
tempTable=WindowsApplication.DataConnection.DataConnection.ExcuteSql("select distinct 职工名称 from Employee","Employee");
for(int i=0;i<tempTable.Rows.Count;i++)
{
this.Emp_Name.Items.Add(tempTable.Rows[i][0].ToString().Trim());
}
this.Emp_Name.SelectedIndex=0;
DataTable tempBrushTable=new DataTable();
tempBrushTable=WindowsApplication.DataConnection.DataConnection.ExcuteSql("select distinct 卡号 from BrushIDHistory","BrushIDHistory");
for(int j=0;j<tempBrushTable.Rows.Count;j++)
{
this.BrushIDComBoBox.Items.Add(tempBrushTable.Rows[j][0].ToString().Trim());
}
this.Emp_Name.SelectedIndex=1;
DataTable tempDateTable=new DataTable();
tempDateTable=WindowsApplication.DataConnection.DataConnection.ExcuteSql("select distinct 日期 from BrushIDHistory","BrushIDHistory");
for(int k=0;k<tempDateTable.Rows.Count;k++)
{
this.DateComboBox.Items.Add(tempDateTable.Rows[k][0].ToString().Trim());
}
this.Emp_Name.SelectedIndex=0;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -