コード例 #1
0
        /// <summary>
        /// 修改考勤异常登记信息(强制处理)
        /// </summary>
        /// <param name="timeException">考勤异常登记信息数据集</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回true失败返回False</returns>
        public bool UpdateTimeException(HR_TimeException timeException, out string error)
        {
            error = "";
            DateTime starTime = Convert.ToDateTime(timeException.Date.Date);
            DateTime endTime  = Convert.ToDateTime(timeException.Date.ToShortDateString() + " " + "23:59:59");

            string[] leaveType      = new LeaveServer().GetLeaveTypeByWorkID(timeException.WorkID, starTime, endTime).Split(';');
            string   onbusinessBill = new OnBusinessBillServer().IsExistOnBusinessBillByWorkIDAndTime(
                timeException.WorkID, starTime, Convert.ToDateTime(endTime.AddDays(1).ToShortDateString()));
            DataTable dtOverTime = new OverTimeBillServer().IsExistOverTimeByWorkID(timeException.WorkID, starTime.Date, starTime.AddDays(1).Date);

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from a in dataContxt.HR_TimeException
                             where a.ID == timeException.ID
                             select a;

                if (result.Count() > 0)
                {
                    HR_TimeException exceptionList = result.Single();
                    exceptionList.RealExceptionType    = timeException.RealExceptionType;
                    exceptionList.HR_Signature         = timeException.HR_Signature;
                    exceptionList.HR_SignatureDate     = timeException.HR_SignatureDate;
                    exceptionList.ExceptionDescription = timeException.ExceptionDescription;

                    var resultList = from a in dataContxt.HR_AttendanceDaybookList
                                     where a.TimeExceptionRelevanceID == exceptionList.DayBookUniqueID
                                     select a;

                    if (resultList.Count() > 0)
                    {
                        HR_AttendanceDaybookList dayBookList = resultList.Single();

                        if (timeException.RealExceptionType == 4 && leaveType != null && leaveType[0] != "")
                        {
                            dayBookList.ResultType = "4";
                            dayBookList.BillNo     = leaveType[0];

                            if (dayBookList.BillNo != "")
                            {
                                dayBookList.ResultSubclass = leaveType[1];
                                dayBookList.Remark         = timeException.ExceptionDescription;
                            }
                            else
                            {
                                dayBookList.ResultSubclass = "";
                            }
                        }
                        else if (timeException.RealExceptionType == 7 && onbusinessBill != null)
                        {
                            dayBookList.ResultType = "7";
                            dayBookList.BillNo     = onbusinessBill;
                        }
                        else if (timeException.RealExceptionType == 9 || timeException.RealExceptionType == 8 ||
                                 timeException.RealExceptionType == 10 || timeException.RealExceptionType == 1 ||
                                 timeException.RealExceptionType == 2 || timeException.RealExceptionType == 3 ||
                                 timeException.RealExceptionType == 11 || timeException.RealExceptionType == 12)
                        {
                            dayBookList.ResultType     = timeException.RealExceptionType.ToString();
                            dayBookList.BillNo         = "";
                            dayBookList.ResultSubclass = "";
                        }
                        else if (timeException.RealExceptionType == 5 && dtOverTime != null && dtOverTime.Rows.Count > 0)
                        {
                            dayBookList.ResultType = "5";

                            if (dayBookList.BillNo == null || dayBookList.BillNo.Trim().Length == 0 || dayBookList.Hours == 0)
                            {
                                dayBookList.BillNo         = dtOverTime.Rows[0]["单据号"].ToString();
                                dayBookList.ResultSubclass = dtOverTime.Rows[0]["补偿方式"].ToString();
                                dayBookList.Hours          = Convert.ToDouble(dtOverTime.Rows[0]["实际小时数"].ToString());
                            }
                        }
                        else
                        {
                            timeException.RealExceptionType     = timeException.RealExceptionType;
                            timeException.ExceptionDescription += " 没有检测到关联单;已被" + BasicInfo.LoginName + "强制处理";
                        }

                        dayBookList.Remark = timeException.ExceptionDescription +
                                             " 异常类型由之前的" + new AttendanceMachineServer().GetExceptionTypeName(result.Single().ExceptionType) +
                                             "更改为" + new AttendanceMachineServer().GetExceptionTypeName(timeException.RealExceptionType);
                    }
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 获取服务组件
        /// </summary>
        /// <returns>返回组件接口</returns>
        public static T GetServerModule <T>()
        {
            string name = typeof(T).ToString();

            m_hashTable = new Hashtable();

            //if (m_hashTable.ContainsKey(name))
            //{
            //    return (T)m_hashTable[name];
            //}

            if (typeof(T) == typeof(IOrganizationServer))
            {
                IOrganizationServer serverModule = new OrganizationServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IDeptTypeServer))
            {
                IDeptTypeServer serverModule = new DeptTypeServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IOperatingPostServer))
            {
                IOperatingPostServer serverModule = new OperatingPostServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IJobTitleServer))
            {
                IJobTitleServer serverModule = new JobTitleServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IJobTitleServer))
            {
                IJobTitleServer serverModule = new JobTitleServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IResumeServer))
            {
                IResumeServer serverModule = new ResumeServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IPersonnelArchiveServer))
            {
                IPersonnelArchiveServer serverModule = new PersonnelArchiveServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ILaborContractServer))
            {
                ILaborContractServer serverModule = new LaborContractServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IPostChangeServer))
            {
                IPostChangeServer serverModule = new PostChangeServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IDimissionServer))
            {
                IDimissionServer serverModule = new DimissionServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IOnBusinessBillServer))
            {
                IOnBusinessBillServer serverModule = new OnBusinessBillServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IHolidayServer))
            {
                IHolidayServer serverModule = new HolidayServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ILeaveServer))
            {
                ILeaveServer serverModule = new LeaveServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IOverTimeBillServer))
            {
                IOverTimeBillServer serverModule = new OverTimeBillServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IWorkSchedulingServer))
            {
                IWorkSchedulingServer serverModule = new WorkSchedulingServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IAttendanceSchemeServer))
            {
                IAttendanceSchemeServer serverModule = new AttendanceSchemeServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IBatchExceptionServer))
            {
                IBatchExceptionServer serverModule = new BatchExceptionServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IAttendanceMachineServer))
            {
                IAttendanceMachineServer serverModule = new AttendanceMachineServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ITimeExceptionServer))
            {
                ITimeExceptionServer serverModule = new TimeExceptionServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IAttendanceDaybookServer))
            {
                IAttendanceDaybookServer serverModule = new AttendanceDaybookServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IAttendanceSummaryServer))
            {
                IAttendanceSummaryServer serverModule = new AttendanceSummaryServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ICultivateServer))
            {
                ICultivateServer serverModule = new CultivateServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ITrainEmployeServer))
            {
                ITrainEmployeServer serverModule = new TrainEmployeServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IExpertEmployeServer))
            {
                IExpertEmployeServer serverModule = new ExpertEmployeServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IAttendanceAnalysis))
            {
                IAttendanceAnalysis serverModule = new AttendanceAnalysis();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ITrainBasicInfo))
            {
                ITrainBasicInfo serverModule = new TrainBasicInfo();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ITrainSurvey))
            {
                ITrainSurvey serverModule = new TrainSurvey();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ITrainPlanCollect))
            {
                ITrainPlanCollect serverModule = new TrainPlanCollect();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ITrainFeedback))
            {
                ITrainFeedback serverModule = new TrainFeedback();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ITrainLearn))
            {
                ITrainLearn serverModule = new TrainLearn();
                m_hashTable.Add(name, serverModule);
            }

            if (m_hashTable.ContainsKey(name))
            {
                return((T)m_hashTable[name]);
            }

            return(default(T));
        }