private void sbtnSignin_Click(object sender, System.EventArgs e) { string strCardID = txtCardID.Text.Trim(); string EName = txtEmpName.Text.Trim(); err = null; if (ca.ChkEmpSign(strCardID, "1", out err)) { MessageBox.Show("该员工已经签到!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } CMSMStruct.EmpSignStruct esign = new CMSMStruct.EmpSignStruct(); esign.strCardID = strCardID; esign.strEmpName = EName; esign.strSignDate = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(); esign.strClass = ""; esign.strSignFlag = "1"; esign.strComments = ""; esign.strDeptID = SysInitial.LocalDept; err = null; if (ca.InsertEmpSign(esign, out err)) { MessageBox.Show("员工签到成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); this.txtCardID.Text = ""; this.txtEmpName.Text = ""; this.DgBind(); return; } else { if (err != null) { clog.WriteLine(err); } return; } }
private void sbtnSign_Click(object sender, System.EventArgs e) { string strCardID = txtCardID.Text.Trim(); string EName = txtEmpName.Text.Trim(); string strcomments = txtComments.Text.Trim(); if (strcomments.Length > 75) { MessageBox.Show("备注信息不得大于75个汉字!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } err = null; if (ca.ChkEmpSign(strCardID, "3','4", out err)) { DialogResult dradd = MessageBox.Show("该员工今日已经有特殊记录,是否还要添加新的特殊内容!", "系统提示", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Question); if (dradd == DialogResult.Yes) { CMSMStruct.EmpSignStruct esign = new CMSMStruct.EmpSignStruct(); esign.strCardID = strCardID; esign.strEmpName = EName; esign.strSignDate = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(); esign.strClass = ""; esign.strSignFlag = this.GetColEn(cmbSpec.Text.Trim(), "SFlag"); esign.strComments = strcomments; esign.strDeptID = SysInitial.LocalDept; err = null; if (ca.InsertEmpSign(esign, out err)) { MessageBox.Show("员工特殊情况考勤记录成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); this.txtCardID.Text = ""; this.txtEmpName.Text = ""; txtComments.Text = ""; this.DgBind(); return; } else { MessageBox.Show("员工特殊情况考勤记录失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); this.txtCardID.Text = ""; this.txtEmpName.Text = ""; if (err != null) { clog.WriteLine(err); } return; } } else { txtCardID.Text = ""; txtEmpName.Text = ""; txtComments.Text = ""; } } else { CMSMStruct.EmpSignStruct esign = new CMSMStruct.EmpSignStruct(); esign.strCardID = strCardID; esign.strEmpName = EName; esign.strSignDate = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString(); esign.strClass = ""; esign.strSignFlag = this.GetColEn(cmbSpec.Text.Trim(), "SFlag"); esign.strComments = strcomments; esign.strDeptID = SysInitial.LocalDept; err = null; if (ca.InsertEmpSign(esign, out err)) { MessageBox.Show("员工特殊情况考勤记录成功!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); this.txtCardID.Text = ""; this.txtEmpName.Text = ""; txtComments.Text = ""; this.DgBind(); return; } else { MessageBox.Show("员工特殊情况考勤记录失败,请重试!", "系统提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); this.txtCardID.Text = ""; this.txtEmpName.Text = ""; if (err != null) { clog.WriteLine(err); } return; } } }