Ejemplo n.º 1
0
        /// <summary>
        /// 合同到期提醒
        /// </summary>
        /// <param name="eGFunc"></param>
        private void EmployeeContractRemindTrigger(IEnumerable <XElement> eGFunc)
        {
            try
            {
                SMT.Foundation.Log.Tracer.Debug("员工合同到期开始");
                if (eGFunc.Count() == 0)
                {
                    return;
                }

                string strId = string.Empty;

                foreach (var item in eGFunc)
                {
                    if (item.Attribute("Name").Value == "EMPLOYEECONTACTID")
                    {
                        strId = item.Attribute("Value").Value;
                        break;
                    }
                }
                PersonnelService svcPersonnel = new PersonnelService();

                T_HR_EMPLOYEECONTRACT entry = svcPersonnel.GetEmployeeContractByID(strId);

                if (entry != null)
                {
                    if (entry.T_HR_EMPLOYEE != null && entry.T_HR_EMPLOYEE.EMPLOYEESTATE != "2")
                    {
                        string strMsg = "";
                        T_HR_EMPLOYEECONTRACT employeeContract = new T_HR_EMPLOYEECONTRACT();
                        employeeContract.EMPLOYEECONTACTID        = Guid.NewGuid().ToString();
                        employeeContract.T_HR_EMPLOYEE            = new T_HR_EMPLOYEE();
                        employeeContract.T_HR_EMPLOYEE.EMPLOYEEID = entry.T_HR_EMPLOYEE.EMPLOYEEID;
                        employeeContract.FROMDATE           = entry.FROMDATE;
                        employeeContract.TODATE             = entry.TODATE;
                        employeeContract.ENDDATE            = entry.ENDDATE;
                        employeeContract.CONTACTPERIOD      = entry.CONTACTPERIOD;
                        employeeContract.CONTACTCODE        = entry.CONTACTCODE;
                        employeeContract.ATTACHMENT         = entry.ATTACHMENT;
                        employeeContract.ATTACHMENTPATH     = entry.ATTACHMENTPATH;
                        employeeContract.ALARMDAY           = entry.ALARMDAY;
                        employeeContract.CHECKSTATE         = "0";
                        employeeContract.EDITSTATE          = "0";
                        employeeContract.ISSPECIALCONTRACT  = entry.ISSPECIALCONTRACT;
                        employeeContract.REASON             = entry.REASON;
                        employeeContract.REMARK             = entry.REMARK;
                        employeeContract.OWNERID            = entry.OWNERID;
                        employeeContract.OWNERPOSTID        = entry.OWNERPOSTID;
                        employeeContract.OWNERDEPARTMENTID  = entry.OWNERDEPARTMENTID;
                        employeeContract.OWNERCOMPANYID     = entry.OWNERCOMPANYID;
                        employeeContract.CREATECOMPANYID    = entry.CREATECOMPANYID;
                        employeeContract.CREATEDATE         = System.DateTime.Now;
                        employeeContract.CREATEUSERID       = entry.CREATEUSERID;
                        employeeContract.CREATEPOSTID       = entry.CREATEPOSTID;
                        employeeContract.CREATEDEPARTMENTID = entry.CREATEDEPARTMENTID;
                        employeeContract.CREATECOMPANYID    = entry.CREATECOMPANYID;
                        employeeContract.UPDATEUSERID       = entry.UPDATEUSERID;
                        employeeContract.UPDATEDATE         = entry.UPDATEDATE;
                        //获取附件问题
                        //SMT.SaaS.BLLCommonServices PermClient = new SMT.SaaS.BLLCommonServices.PermissionWS.PermissionServiceClient();


                        svcPersonnel.EmployeeContractAdd(employeeContract, ref strMsg);
                        svcPersonnel.EmployeeContractAlarm(employeeContract);
                    }
                    else
                    {
                        var EmployeeEnt = entry.T_HR_EMPLOYEE;
                        SMT.Foundation.Log.Tracer.Debug("员工" + EmployeeEnt.EMPLOYEEID + "的在EMPLOYEESTATE:" + EmployeeEnt.EMPLOYEESTATE
                                                        + ",不自动生成合同。");
                    }
                }
                else
                {
                    SMT.Foundation.Log.Tracer.Debug("员工合同到期没有获取到合同信息");
                }
            }
            catch (Exception ex)
            {
                SMT.Foundation.Log.Tracer.Debug("员工合同到期提醒出现错误:" + ex.ToString());
            }
        }