Пример #1
0
        /// <summary>
        /// 根据传回的xml生成薪资档案
        /// </summary>
        /// <param name="eGFunc"></param>
        /// <returns></returns>
        private static string AddEmployeeSalaryArchive(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;
                    }
                }


                SalaryService ser = new SalaryService();

                T_HR_SALARYARCHIVE entity = new T_HR_SALARYARCHIVE();
                entity.SALARYARCHIVEID = Guid.NewGuid().ToString();
                entity.EMPLOYEEID      = strEmployeeID.Replace("{", "").Replace("}", "");

                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;
                PersonnelService  ps  = new PersonnelService();
                T_HR_EMPLOYEEPOST emp = ps.GetEmployeePostActivedByEmployeeID(entity.EMPLOYEEID);
                if (emp != null)
                {
                    entity.EMPLOYEECODE = emp.T_HR_EMPLOYEE.EMPLOYEECODE;
                    entity.EMPLOYEENAME = emp.T_HR_EMPLOYEE.EMPLOYEECNAME;

                    entity.OWNERID           = emp.T_HR_EMPLOYEE.EMPLOYEEID;
                    entity.OWNERPOSTID       = emp.T_HR_EMPLOYEE.OWNERPOSTID;
                    entity.OWNERDEPARTMENTID = emp.T_HR_EMPLOYEE.OWNERDEPARTMENTID;
                    entity.OWNERCOMPANYID    = emp.T_HR_EMPLOYEE.OWNERCOMPANYID;
                    entity.POSTLEVEL         = emp.POSTLEVEL;
                    entity.EMPLOYEEPOSTID    = emp.EMPLOYEEPOSTID;
                }
                ser.SalaryArchiveAdd(entity);
                return(entity.SALARYARCHIVEID);
            }
            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);
            }
        }