/// <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());
            }
        }
Exemple #2
0
        /// <summary>
        /// 根据传回的xml生成员工合同
        /// </summary>
        /// <param name="eGFunc"></param>
        /// <returns></returns>
        private static string AddEmployeeContract(IEnumerable <XElement> eGFunc)
        {
            SMT.Foundation.Log.Tracer.Debug("开始添加员工合同信息");
            try
            {
                if (eGFunc.Count() == 0)
                {
                    return("");
                }

                string strEmployeeID        = string.Empty;
                string strOwnerID           = string.Empty;
                string strOwnerPostID       = string.Empty;
                string strOwnerDepartmentID = string.Empty;
                string strOwnerCompanyID    = string.Empty;

                foreach (var q in eGFunc)
                {
                    string strName = q.Attribute("Name").Value;
                    switch (strName)
                    {
                    case "EMPLOYEEID":
                        strEmployeeID = q.Attribute("Value").Value;
                        break;

                    case "OWNERID":
                        strOwnerID = q.Attribute("Value").Value;
                        break;

                    case "OWNERPOSTID":
                        strOwnerPostID = q.Attribute("Value").Value;
                        break;

                    case "OWNERDEPARTMENTID":
                        strOwnerDepartmentID = q.Attribute("Value").Value;
                        break;

                    case "OWNERCOMPANYID":
                        strOwnerCompanyID = q.Attribute("Value").Value;
                        break;
                    }
                }


                OrganizationService ser = new OrganizationService();

                T_HR_EMPLOYEECONTRACT entity = new T_HR_EMPLOYEECONTRACT();
                entity.EMPLOYEECONTACTID        = Guid.NewGuid().ToString();
                entity.T_HR_EMPLOYEE            = new T_HR_EMPLOYEE();
                entity.T_HR_EMPLOYEE.EMPLOYEEID = strEmployeeID.Replace("{", "").Replace("}", "");
                //  entity.T_HR_PENSIONDETAIL = new T_HR_PENSIONDETAIL();
                SMT.Foundation.Log.Tracer.Debug("合同员工ID:" + entity.T_HR_EMPLOYEE.EMPLOYEEID);

                entity.CHECKSTATE         = ((int)CheckStates.UnSubmit).ToString();
                entity.EDITSTATE          = ((int)EditStates.UnActived).ToString();
                entity.CREATEDATE         = DateTime.Now;
                entity.OWNERID            = strOwnerID;
                entity.OWNERPOSTID        = strOwnerPostID;
                entity.OWNERDEPARTMENTID  = strOwnerDepartmentID;
                entity.OWNERCOMPANYID     = strOwnerCompanyID;
                entity.CREATEUSERID       = strOwnerID;
                entity.CREATEPOSTID       = strOwnerPostID;
                entity.CREATEDEPARTMENTID = strOwnerDepartmentID;
                entity.CREATECOMPANYID    = strOwnerCompanyID;
                string           strMsg = "";
                PersonnelService ps     = new PersonnelService();
                T_HR_EMPLOYEE    emp    = ps.GetEmployeeByID(entity.T_HR_EMPLOYEE.EMPLOYEEID);
                if (emp != null)
                {
                    entity.OWNERID           = emp.EMPLOYEEID;
                    entity.OWNERPOSTID       = emp.OWNERPOSTID;
                    entity.OWNERDEPARTMENTID = emp.OWNERDEPARTMENTID;
                    entity.OWNERCOMPANYID    = emp.OWNERCOMPANYID;
                    ps.EmployeeContractAdd(entity, ref strMsg);
                }
                else
                {
                    SMT.Foundation.Log.Tracer.Debug("引擎触发员工合同记录失败");
                }
                SMT.Foundation.Log.Tracer.Debug("合同工ID:" + entity.EMPLOYEECONTACTID);
                SMT.Foundation.Log.Tracer.Debug("开始添加员工信息:" + emp.EMPLOYEECNAME);

                SMT.Foundation.Log.Tracer.Debug("添加完员工信息的结果:" + strMsg);
                return(entity.EMPLOYEECONTACTID);
            }
            catch (Exception e)
            {
                string abc = "<HR>Message=[" + e.Message + "]" + "<HR>Source=[" + e.Source + "]<HR>StackTrace=[" + e.StackTrace + "]<HR>TargetSite=[" + e.TargetSite + "]";
                Tracer.Debug(abc);
                return(abc);
            }
        }