示例#1
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);
            }
        }
示例#2
0
        /// <summary>
        /// 根据传回的XML,添加员工社保档案
        /// </summary>
        /// <param name="xele"></param>
        private static string AddPensionMaster(IEnumerable <XElement> eGFunc)
        {
            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;
                    }
                }


                PersonnelService ser        = new PersonnelService();
                string           employeeid = strEmployeeID.Replace("{", "").Replace("}", "");
                //注释获取社保的原因:如果兼职的则存在,这样待办还是有,但实际社保却没有添加
                //var pensionTmp = ser.GetPensionMasterByEmployeeID(employeeid);
                //if (pensionTmp == null)
                //{

                T_HR_PENSIONMASTER entity = new T_HR_PENSIONMASTER();
                entity.PENSIONMASTERID          = Guid.NewGuid().ToString();
                entity.T_HR_EMPLOYEE            = new T_HR_EMPLOYEE();
                entity.T_HR_EMPLOYEE.EMPLOYEEID = employeeid;
                //  entity.T_HR_PENSIONDETAIL = new T_HR_PENSIONDETAIL();

                entity.CARDID             = string.Empty;
                entity.COMPUTERNO         = string.Empty;
                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 = "";
                T_HR_EMPLOYEE emp    = ser.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;
                }
                ser.PensionMasterAdd(entity, ref strMsg);
                return(entity.PENSIONMASTERID);
                //}
                //else
                //{
                //    return pensionTmp.PENSIONMASTERID;
                //}
            }
            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);
            }
        }