public int UpdateAttendanceReadRule(AttendanceReadRule time) { SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Parameters.Add(_ParmPKID, SqlDbType.Int).Value = time.AttendanceReadTimeId; sqlCommand.Parameters.Add(_ParmReadDateTime, SqlDbType.DateTime).Value = time.ReadDateTime; sqlCommand.Parameters.Add(_ParmIsSendEmail, SqlDbType.Int).Value = time.IsSendMail; sqlCommand.Parameters.Add(_ParmSendEmailRull, SqlDbType.Int).Value = time.SendEmailRule; return(SqlHelper.ExecuteNonQuery("UpdateAttendanceReadTime", sqlCommand)); }
public int InsertAttendanceReadRule(AttendanceReadRule time) { int pkid; SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Parameters.Add(_ParmPKID, SqlDbType.Int).Direction = ParameterDirection.Output; sqlCommand.Parameters.Add(_ParmReadDateTime, SqlDbType.DateTime).Value = time.ReadDateTime; sqlCommand.Parameters.Add(_ParmIsSendEmail, SqlDbType.Int).Value = time.IsSendMail; sqlCommand.Parameters.Add(_ParmSendEmailRull, SqlDbType.Int).Value = time.SendEmailRule; SqlHelper.ExecuteNonQueryReturnPKID("InsertAttendanceReadTime", sqlCommand, out pkid); return(pkid); }
/// <summary> /// 系统自动在指定时间读取考勤数据 /// </summary> public void SystemReadDataFromSetTime() { AttendanceReadRule attendanceReadRule = _DalReadRule.GetAttendanceReadRuleByPkid(1); if (attendanceReadRule.ReadDateTime.ToShortTimeString().Equals(DateTime.Now.ToShortTimeString())) { ReadDataHistory readHistory = _DalHistory.GetLastReadDataHistory(); if (readHistory.ReadResult == ReadDataResultType.Reading) { return; } readHistory = new ReadDataHistory(DateTime.Now, ReadDataResultType.Reading, ""); int pkid = _DalHistory.InsertReadDataHistory(readHistory); readHistory.ReadDataId = pkid; ReadDataFromAccessToSQL(pkid); if (attendanceReadRule.IsSendMail) { OutInTimeConditionEnum outInTimeCondition; switch (attendanceReadRule.SendEmailRule) { case SendEmailRuleType.InEmpty: outInTimeCondition = OutInTimeConditionEnum.InTimeIsNull; break; case SendEmailRuleType.OutEmpty: outInTimeCondition = OutInTimeConditionEnum.OutTimeIsNull; break; case SendEmailRuleType.InAndOutEmpty: outInTimeCondition = OutInTimeConditionEnum.InAndOutTimeIsNull; break; case SendEmailRuleType.InOrOutEmpty: outInTimeCondition = OutInTimeConditionEnum.InOrOutTimeIsNull; break; default: outInTimeCondition = OutInTimeConditionEnum.All; break; } SystemSendEmailByCondition(outInTimeCondition); } } }
public AttendanceReadRule GetAttendanceReadRuleByPkid(int pkid) { AttendanceReadRule read = null; SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Parameters.Add(_ParmPKID, SqlDbType.Int).Value = pkid; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAttendanceReadTimeByPkid", sqlCommand)) { while (sdr.Read()) { read = new AttendanceReadRule(); read.AttendanceReadTimeId = Convert.ToInt32(sdr[_DbPKID]); read.ReadDateTime = Convert.ToDateTime(sdr[_DbReadDateTime]); read.IsSendMail = Convert.ToBoolean(sdr[_DbIsSendEmail]); read.SendEmailRule = (SendEmailRuleType)(sdr[_DbSendEmailRull]); } return(read); } }
private void DataBind() { //设置初始数据 AttendanceReadRule readRule = _IAttendanceReadDataFacade.GetAttendanceReadRuleByPkid(1, LoginUser); if (readRule != null) { _View.ReadRuleId = readRule.AttendanceReadTimeId.ToString(); _View.ReadTime = readRule.ReadDateTime.ToString(); _View.IsSendMail = readRule.IsSendMail; _View.SendMailRuleId = readRule.SendEmailRule.ToString(); } else { _View.Message = "初始化错误,不能设置读取时间"; _View.ReadTime = DateTime.Now.ToString(); _View.IsSendMail = false; _View.SendMailRuleId = SendEmailRuleType.InEmpty.ToString(); return; } }
public void UpdateEvent() { //设置初始数据 AttendanceReadRule readRule = _IAttendanceReadDataFacade.GetAttendanceReadRuleByPkid(1, LoginUser); if (readRule == null) { _View.Message = "初始化错误,不能设置读取时间"; return; } readRule.IsSendMail = Convert.ToBoolean(_View.IsSendMail); readRule.ReadDateTime = Convert.ToDateTime(_View.ReadTime); readRule.SendEmailRule = GetChoosedSendEmailRuleType(_View.SendMailRuleId); try { _IAttendanceReadDataFacade.UpdateAttendanceReadRule(readRule, LoginUser); _View.Message = "设置成功"; } catch (ApplicationException ae) { _View.Message = ae.Message; } }
public void UpdateAttendanceReadRule(AttendanceReadRule readRule, Account loginUser) { UpdateAttendanceReadRule _Update = new UpdateAttendanceReadRule(readRule, loginUser); _Update.Excute(); }
/// <summary> /// 测试用 /// </summary> public UpdateAttendanceReadRule(AttendanceReadRule readRule, IAttendanceReadRule ruleMock, Account loginUser) { _LoginUser = loginUser; _Read = readRule; _DalReadRull = ruleMock; }
///<summary> ///</summary> ///<param name="readRule"></param> public UpdateAttendanceReadRule(AttendanceReadRule readRule, Account loginUser) { _LoginUser = loginUser; _Read = readRule; }