📄 designframe.cs
字号:
// this.textSecond.Text="0"+second.ToString();
// this.textHour.Text=hour.ToString();
// #region 时初始化...
// this.textAfternoonH.Text=hour.ToString();
// this.textAfternoonHour.Text=hour.ToString();
// this.textMorningHour.Text=hour.ToString();
// #endregion
// #region 分初始化...
// this.textAfternoonM.Text="0"+minute.ToString();
// this.textAfternoonMinute.Text="0"+minute.ToString();
// this.textMorningMinute.Text="0"+minute.ToString();
// #endregion
// #region 秒初始化...
// this.textMorningSecond.Text="0"+second.ToString();
// this.textAfternoonSecond.Text="0"+second.ToString();
// this.textAfternoonS.Text="0"+second.ToString();
// #endregion
// return;
// }
// else if(minute>=10 && second>=10)
// {
// this.textMinutes.Text=minute.ToString();
// this.textSecond.Text=second.ToString();
// this.textHour.Text=hour.ToString();
// #region 时初始化...
// this.textAfternoonH.Text=hour.ToString();
// this.textAfternoonHour.Text=hour.ToString();
// this.textMorningHour.Text=hour.ToString();
// #endregion
// #region 分初始化...
// this.textAfternoonM.Text=minute.ToString();
// this.textAfternoonMinute.Text=minute.ToString();
// this.textMorningMinute.Text=minute.ToString();
// #endregion
// #region 秒初始化...
// this.textMorningSecond.Text=second.ToString();
// this.textAfternoonSecond.Text=second.ToString();
// this.textAfternoonS.Text=second.ToString();
// #endregion
// return;
// }
// }
#endregion
}
else if(DesignFrame.blRemeber.Equals(true))
{
// this.textHour.Text=DesignFrame.strHour;
// this.textSecond.Text=DesignFrame.strSecond;
// this.textMinutes.Text=DesignFrame.strMinute;
}
#endregion
#region 初始化各控件...
this.textHour.Text="08";
this.textMinutes.Text="30";
this.textSecond.Text="00";
this.textMorningHour.Text="12";
this.textMorningMinute.Text="00";
this.textMorningSecond.Text="00";
this.textAfternoonHour.Text="13";
this.textAfternoonMinute.Text="00";
this.textAfternoonSecond.Text="00";
this.textAfternoonS.Text="00";
this.textAfternoonM.Text="30";
this.textAfternoonH.Text="17";
#endregion
#region 布尔值
blEnable=true;
#endregion
}
#endregion
#region btnOk Event
private void btnOk_Click(object sender, System.EventArgs e)
{
#region 注释...
// if(this.textHour.Text.Length==7)
// {
// this.textHour.Text="0"+System.DateTime.Now.Hour.ToString();
// }
// if(this.textMinutes.Text.Length==7)
// {
// this.textMinutes.Text="0"+System.DateTime.Now.Minute.ToString();
// }
// if(this.textSecond.Text.Length==7)
// {
// this.textSecond.Text="0"+System.DateTime.Now.Second.ToString();
// }
#endregion
#region 判断是否早退变量...
DesignFrame.MstrH=this.textMorningHour.Text;
DesignFrame.MstrM=this.textMorningMinute.Text;
DesignFrame.MstrS=this.textMorningSecond.Text;
DesignFrame.Ahour=this.textAfternoonH.Text;
DesignFrame.Aminute=this.textAfternoonM.Text;
DesignFrame.Asecond=this.textAfternoonS.Text;
#endregion
#region 定义三个变量...判断时间
int hour=0,minute=0,second=0;
hour=DateTime.Now.Hour;
minute=DateTime.Now.Minute;
second=DateTime.Now.Second;
#endregion
#region 时小于12时...
if(hour<Int32.Parse(DesignFrame.MstrH))
{
DesignFrame.strHour=this.textHour.Text;
DesignFrame.strMinute=this.textMinutes.Text;
DesignFrame.strSecond=this.textSecond.Text;
}
#endregion
#region 时等于12时
else if(hour.Equals(Int32.Parse(DesignFrame.MstrH)))
{
if(minute.Equals(Int32.Parse(DesignFrame.MstrM)) && second.Equals(Int32.Parse(DesignFrame.MstrS)))
{
DesignFrame.strHour=this.textHour.Text;
DesignFrame.strMinute=this.textMinutes.Text;
DesignFrame.strSecond=this.textSecond.Text;
}
else
{
DesignFrame.strHour=this.textAfternoonHour.Text;
DesignFrame.strMinute=this.textAfternoonMinute.Text;
DesignFrame.strSecond=this.textAfternoonSecond.Text;
}
}
#endregion
#region 时大于12时
else if(hour>Int32.Parse(DesignFrame.MstrH))//12小时
{
#region 小时等于17时
if(hour<Int32.Parse(DesignFrame.Ahour))
{
DesignFrame.strHour=this.textAfternoonHour.Text;
DesignFrame.strMinute=this.textAfternoonMinute.Text;
DesignFrame.strSecond=this.textAfternoonSecond.Text;
}
#endregion
#region 小时等于17时
else if(hour.Equals(Int32.Parse(DesignFrame.Ahour)))//17点...
{
#region 分小于30分...
if(minute<Int32.Parse(DesignFrame.Aminute))//17点29分....
{
DesignFrame.strHour=this.textAfternoonHour.Text;
DesignFrame.strMinute=this.textAfternoonMinute.Text;
DesignFrame.strSecond=this.textAfternoonSecond.Text;
}
#endregion
#region 分等于30分...
else if(minute.Equals(DesignFrame.Aminute))//17点30分....
{
if(second.Equals(DesignFrame.Asecond))//17点30分0秒....
{
DesignFrame.strHour=this.textAfternoonHour.Text;
DesignFrame.strMinute=this.textAfternoonMinute.Text;
DesignFrame.strSecond=this.textAfternoonSecond.Text;
}
else
{
MessageBox.Show(this,"需要调整系统时间小于下午下班时间啊!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
return;
}
}
else
{
MessageBox.Show(this,"需要调整系统时间小于下午下班时间啊!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
return;
}
#endregion
}
#endregion
#region 小时大于17时
else if(hour>Int32.Parse(DesignFrame.Ahour))//18点....
{
MessageBox.Show(this,"需要调整系统时间小于下午下班时间啊!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
return;
}
#endregion
}
#endregion
#region 调用未到的函数
if(BrushKaIDFrame.BrushCounts.Equals(0))
{
return;
}
else
{
btnUnCome_Click();
}
#endregion
#region 调用早退的函数...
BtnZhaoTui();
#endregion
}
#endregion
#region btnCancel Event
private void btnCancel_Click(object sender, System.EventArgs e)
{
this.textHour.Text="";
this.textMinutes.Text="";
this.textSecond.Text="";
}
#endregion
#region 光标移动变化...
private void textSecond_MouseLeave(object sender, System.EventArgs e)
{
ComboBox com=(ComboBox)sender;
com.DropDownStyle=System.Windows.Forms.ComboBoxStyle.Simple;
}
private void textSecond_MouseEnter(object sender, System.EventArgs e)
{
ComboBox com=(ComboBox)sender;
com.DropDownStyle=System.Windows.Forms.ComboBoxStyle.DropDown;
}
private void btnOk_MouseLeave(object sender, System.EventArgs e)
{
Button button=(Button)sender;
button.FlatStyle=FlatStyle.Flat;
}
private void btnOk_MouseEnter(object sender, System.EventArgs e)
{
Button button=(Button)sender;
button.FlatStyle=FlatStyle.Standard;
}
private void textMorningMinute_MouseLeave(object sender, System.EventArgs e)
{
ComboBox com=(ComboBox)sender;
com.DropDownStyle=System.Windows.Forms.ComboBoxStyle.Simple;
}
private void textMorningMinute_MouseEnter(object sender, System.EventArgs e)
{
ComboBox com=(ComboBox)sender;
com.DropDownStyle=System.Windows.Forms.ComboBoxStyle.DropDown;
}
#endregion
#region 判断是否迟到事件...
private void btnLate_Click()
{
try
{
DataTable EmpTimeTable=new DataTable();//所有的记录中的两列数据:职工名称,时间
#region 所有的记录中的两列数据:职工名称,时间
EmpTimeTable=selectTime();
string str=CheckTime();
#endregion
#region 判断是否为迟到的函数
returnCheckIsNotLate(EmpTimeTable,str);
#endregion
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region 判断是否已到事件...
private void btnCome_Click()
{
try
{
#region 查询 Employee 中的职工名称
DataTable employee_empName=new DataTable();
employee_empName=CheckEmployeeName();
#endregion
#region 查询 Emp_Time 中的职工名称
DataTable emp_time_empName=new DataTable();
emp_time_empName=CheckEmp_TimeName();
#endregion 判断是否为未到函数的函数
#region 判断是已到的函数
CheckIsNotWeiDao(employee_empName,emp_time_empName);
#endregion
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region 判断是否未到事件...
private void btnUnCome_Click()
{
try
{
#region 查询 Emp_Late中的职工名称
DataTable emp_late=new DataTable();
emp_late=returnEmp_Late();
#endregion
#region 查询 Employee中的职工名称
DataTable employee=new DataTable();
employee=CheckEmployeeName();
#endregion
#region 判断未到函数
CheckIsNotLate(employee,emp_late);
#endregion
}
catch(Exception ele)
{
MessageBox.Show(this,ele.ToString(),"提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
#endregion
#region 判断是否早退事件...
private void BtnZhaoTui()
{
DataTable zhaoTuiTable=new DataTable();
zhaoTuiTable=selectTime();
try
{
string str="";
int j=searchLateTable();
for(int i=j-BrushKaIDFrame.BrushCounts;i<zhaoTuiTable.Rows.Count;i++)
{
if(Int32.Parse(zhaoTuiTable.Rows[i][1].ToString().Substring(0,2)).Equals(Int32.Parse(DesignFrame.Ahour)) && Int32.Parse(zhaoTuiTable.Rows[i][1].ToString().Substring(3,3).Substring(0,2))>=(Int32.Parse(DesignFrame.Aminute)-10))
{
#region 添加数据...
string tempStr="早退";
str="下午";
string insertZhaoTuiStr="Insert into Emp_ZhaoTui(职工名称,状态,[上/下],日期) values('"+zhaoTuiTable.Rows[i][0].ToString().Trim()+"','"+tempStr+"','"+str+"','"+System.DateTime.Now.ToLongDateString().Trim()+"')";
int p=conn.ExcuteStrSql(insertZhaoTuiStr);
if(p>0)
{
//MessageBox.Show(this,"判断成功啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
else
{
MessageBox.Show(this,"判断失败啦!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
#endregion
}
else if( Int32.Parse(zhaoTuiTable.Rows[i][1].ToString().Substring(0,2)).Equals(Int32.Parse(DesignFrame.MstrH)-1) && Int32.Parse(zhaoTuiTable.Rows[i][1].ToString().Substring(3,3).Substring(0,2))>=(Int32.Parse(DesignFrame.Ahour)+20))
{
#region 添加数据...
string tempStr="早退";
str="上午";
string insertZhaoTuiStr="Insert into Emp_ZhaoTui(职工名称,状态,[上/下],
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -