/// <summary>
        /// 回退单据
        /// </summary>
        /// <param name="strDJH">单据号</param>
        /// <param name="strBillStatus">单据状态</param>
        /// <param name="strRebackReason">回退状态</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool ReturnBill(string strDJH, string strBillStatus, string strRebackReason, out string error)
        {
            error = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var result = from a in dataContxt.HR_OnBusinessBill
                             where a.ID == Convert.ToInt32(strDJH)
                             select a;

                string strMsg = "";

                if (result.Count() == 1)
                {
                    HR_OnBusinessBill onBusiness = result.Single();

                    m_billMessageServer.BillType = "出差申请单";

                    DataTable dt = new PersonnelArchiveServer().GetHighestDept(onBusiness.Applicant);

                    if (dt != null && dt.Rows.Count > 0)
                    {
                        m_highDept = dt.Rows[0]["deptCode"].ToString();
                    }

                    switch (strBillStatus)
                    {
                    case "等待主管审核":
                        strMsg = string.Format("{0}号出差申请单已回退,请您重新处理单据; 回退原因为" + strRebackReason, strDJH);
                        m_billMessageServer.PassFlowMessage(strDJH, strMsg, BillFlowMessage_ReceivedUserType.角色,
                                                            m_billMessageServer.GetDeptDirectorRoleName(m_highDept).ToList());

                        onBusiness.BillStatus          = OnBusinessBillStatus.等待部门负责人审核.ToString();
                        onBusiness.Authorize           = false;
                        onBusiness.Confirmor           = "";
                        onBusiness.ConfirmorDate       = ServerTime.Time;
                        onBusiness.DeptPrincipal       = "";
                        onBusiness.DeptSignatureDate   = ServerTime.Time;
                        onBusiness.GeneralManager      = "";
                        onBusiness.GM_SignatureDate    = ServerTime.Time;
                        onBusiness.LeaderSignature     = "";
                        onBusiness.LeaderSignatureDate = ServerTime.Time;
                        onBusiness.RealBeginTime       = ServerTime.Time;
                        onBusiness.RealEndTime         = ServerTime.Time;
                        //onBusiness.Result = "";
                        break;

                    case "等待分管领导审批":
                        strMsg = string.Format("{0}号出差申请单已回退,请您重新处理单据; 回退原因为" + strRebackReason, strDJH);
                        m_billMessageServer.PassFlowMessage(strDJH, strMsg, BillFlowMessage_ReceivedUserType.角色,
                                                            m_billMessageServer.GetDeptLeaderRoleName(m_highDept).ToList());

                        onBusiness.BillStatus          = OnBusinessBillStatus.等待分管领导审批.ToString();
                        onBusiness.Confirmor           = "";
                        onBusiness.ConfirmorDate       = ServerTime.Time;
                        onBusiness.GeneralManager      = "";
                        onBusiness.GM_SignatureDate    = ServerTime.Time;
                        onBusiness.LeaderSignature     = "";
                        onBusiness.LeaderSignatureDate = ServerTime.Time;
                        onBusiness.RealBeginTime       = ServerTime.Time;
                        onBusiness.RealEndTime         = ServerTime.Time;
                        //onBusiness.Result = "";
                        break;

                    case "等待总经理批准":
                        strMsg = string.Format("{0}号出差申请单已回退,请您重新处理单据; 回退原因为" + strRebackReason, strDJH);
                        m_billMessageServer.PassFlowMessage(strDJH, strMsg, BillFlowMessage_ReceivedUserType.角色, CE_RoleEnum.总经理.ToString());

                        onBusiness.BillStatus       = OnBusinessBillStatus.等待总经理批准.ToString();
                        onBusiness.Authorize        = false;
                        onBusiness.Confirmor        = "";
                        onBusiness.ConfirmorDate    = ServerTime.Time;
                        onBusiness.GeneralManager   = "";
                        onBusiness.GM_SignatureDate = ServerTime.Time;
                        onBusiness.RealBeginTime    = ServerTime.Time;
                        onBusiness.RealEndTime      = ServerTime.Time;
                        //onBusiness.Result = "";
                        break;

                    case "等待销差人确认":
                        strMsg = string.Format("{0}号出差申请单已回退,请您重新处理单据; 回退原因为" + strRebackReason, strDJH);
                        m_billMessageServer.PassFlowMessage(strDJH, strMsg, BillFlowMessage_ReceivedUserType.用户, onBusiness.Applicant.ToString());

                        onBusiness.BillStatus    = OnBusinessBillStatus.等待销差人确认.ToString();
                        onBusiness.Confirmor     = "";
                        onBusiness.ConfirmorDate = ServerTime.Time;
                        onBusiness.RealBeginTime = ServerTime.Time;
                        onBusiness.RealEndTime   = ServerTime.Time;
                        //onBusiness.Result = "";
                        break;

                    default:
                        break;
                    }

                    dataContxt.SubmitChanges();

                    return(true);
                }
                else
                {
                    error = "数据不唯一或者为空";

                    return(false);
                }
            }
            catch (Exception ex)
            {
                error = ex.Message;

                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 批量修改考勤方案
        /// </summary>
        /// <param name="dept">部门编号</param>
        /// <param name="schemeCode">考勤编码</param>
        /// <param name="isSubsidize">是否有餐补</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回True,失败返回False</returns>
        public bool UpdateAttendanceSettingByDept(string dept, string schemeCode, bool isSubsidize, out string error)
        {
            error = "";

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                if (dept == "全部")
                {
                    var result = from a in dataContxt.HR_AttendanceSetting
                                 select a;

                    if (result.Count() > 0)
                    {
                        dataContxt.HR_AttendanceSetting.DeleteAllOnSubmit(result);
                        dataContxt.SubmitChanges();
                    }

                    IQueryable <View_SelectPersonnel> personnel = new PersonnelArchiveServer().GetAllInfo();

                    foreach (var item in personnel)
                    {
                        HR_AttendanceSetting attendance = new HR_AttendanceSetting();

                        attendance.SchemeCode  = schemeCode;
                        attendance.WorkID      = item.员工编号;
                        attendance.IsSubsidize = isSubsidize;
                        attendance.Recorder    = BasicInfo.LoginID;
                        attendance.RecordTime  = ServerTime.Time;

                        dataContxt.HR_AttendanceSetting.InsertOnSubmit(attendance);
                    }
                }
                else
                {
                    string[] deptList = dept.Split(';');

                    for (int i = 0; i < deptList.Count() - 1; i++)
                    {
                        IQueryable <View_SelectPersonnel> personnel = new PersonnelArchiveServer().GetAllInfo();

                        foreach (var item in personnel)
                        {
                            if (item.部门编号 == new OrganizationServer().GetDeptCode(deptList[i]))
                            {
                                var result = from a in dataContxt.HR_AttendanceSetting
                                             where a.WorkID == item.员工编号
                                             select a;

                                if (result.Count() == 1)
                                {
                                    HR_AttendanceSetting attendance = result.Single();

                                    attendance.SchemeCode = schemeCode;
                                    attendance.Recorder   = BasicInfo.LoginID;
                                    attendance.RecordTime = ServerTime.Time;
                                }
                            }
                        }
                    }
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Beispiel #3
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));
        }