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 timer1_Tick(object sender, System.EventArgs e) { if (!IsTimeActive) { IsTimeActive = true; string strresult = ""; try { CMSMStruct.CardHardStruct cardhs = ca.ReadCardInfo("Emp", out strresult); if (!strresult.Equals(CardCommon.CardDef.ConstMsg.RFOK)) { IsTimeActive = false; if (strresult == CardCommon.CardDef.ConstMsg.RFAUTHENTICATION_A_ERR) { this.lblpromt.Text = "该卡不属于本系统使用的卡,请检查!"; return; } else { return; } } if (cardhs.strCardID == "") { this.lblpromt.Text = "员工卡号不正确,请重试!"; IsTimeActive = false; return; } else if (cardhs.strCardID.Substring(0, 1) != "F") { this.lblpromt.Text = "此卡不是员工卡,请检查!"; IsTimeActive = false; return; } else { err = null; cardhs.strCardID = cardhs.strCardID.Substring(1, 4); txtCardID.Text = cardhs.strCardID; CMSMStruct.EmpSignStruct esign = new CMSMStruct.EmpSignStruct(); esign.strCardID = cardhs.strCardID; 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)) { IsTimeActive = false; this.txtCardID.Text = ""; this.txtEmpName.Text = ""; this.DgBind(); } else { IsTimeActive = false; if (err != null) { clog.WriteLine(err); } } } } catch (Exception er) { IsTimeActive = false; clog.WriteLine(er); } } }
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; } } }