コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        /// <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);
                }
            }
        }
コード例 #4
0
        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);
            }
        }
コード例 #5
0
        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;
            }
        }
コード例 #6
0
        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;
            }
        }
コード例 #7
0
        public void UpdateAttendanceReadRule(AttendanceReadRule readRule, Account loginUser)
        {
            UpdateAttendanceReadRule _Update = new UpdateAttendanceReadRule(readRule, loginUser);

            _Update.Excute();
        }
コード例 #8
0
 /// <summary>
 /// 测试用
 /// </summary>
 public UpdateAttendanceReadRule(AttendanceReadRule readRule, IAttendanceReadRule ruleMock, Account loginUser)
 {
     _LoginUser   = loginUser;
     _Read        = readRule;
     _DalReadRull = ruleMock;
 }
コード例 #9
0
 ///<summary>
 ///</summary>
 ///<param name="readRule"></param>
 public UpdateAttendanceReadRule(AttendanceReadRule readRule, Account loginUser)
 {
     _LoginUser = loginUser;
     _Read      = readRule;
 }