Пример #1
0
        /// <summary>
        /// 根据传回的xml生成员工离职确认
        /// </summary>
        /// <param name="eGFunc"></param>
        /// <returns></returns>
        private static string AddLeftOfficeConfirm(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;
                string strDimissionID       = 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;

                    case "DIMISSIONID":
                        strDimissionID = q.Attribute("Value").Value;
                        break;
                    }
                }


                PersonnelService ser = new PersonnelService();

                T_HR_LEFTOFFICECONFIRM entity = new T_HR_LEFTOFFICECONFIRM();
                entity.CONFIRMID       = Guid.NewGuid().ToString();
                entity.T_HR_LEFTOFFICE = new T_HR_LEFTOFFICE();
                //entity.T_HR_LEFTOFFICE.DIMISSIONID = strDimissionID.Replace("{", "").Replace("}", "");
                //  entity.T_HR_PENSIONDETAIL = new T_HR_PENSIONDETAIL();
                entity.CHECKSTATE         = ((int)CheckStates.UnSubmit).ToString();
                entity.CREATEDATE         = DateTime.Now;
                entity.OWNERID            = strEmployeeID;
                entity.OWNERPOSTID        = strOwnerPostID;
                entity.OWNERDEPARTMENTID  = strOwnerDepartmentID;
                entity.OWNERCOMPANYID     = strOwnerCompanyID;
                entity.CREATEUSERID       = strOwnerID;
                entity.CREATEPOSTID       = strOwnerPostID;
                entity.CREATEDEPARTMENTID = strOwnerDepartmentID;
                entity.CREATECOMPANYID    = strOwnerCompanyID;
                T_HR_LEFTOFFICE leftOffice = ser.GetLeftOfficeByEmployeeIDAndPostID(strEmployeeID, strOwnerPostID);
                if (leftOffice != null)
                {
                    entity.LEFTOFFICECATEGORY          = leftOffice.LEFTOFFICECATEGORY;
                    entity.LEFTOFFICEDATE              = leftOffice.LEFTOFFICEDATE;
                    entity.LEFTOFFICEREASON            = leftOffice.LEFTOFFICEREASON;
                    entity.REMARK                      = leftOffice.REMARK;
                    entity.T_HR_LEFTOFFICE.DIMISSIONID = leftOffice.DIMISSIONID;
                    entity.EMPLOYEECNAME               = leftOffice.T_HR_EMPLOYEE.EMPLOYEECNAME;
                    entity.APPLYDATE                   = leftOffice.APPLYDATE;
                    entity.EMPLOYEEPOSTID              = leftOffice.T_HR_EMPLOYEEPOST.EMPLOYEEPOSTID;
                    V_EMPLOYEEPOST eps = ser.GetEmployeeDetailByID(leftOffice.T_HR_EMPLOYEE.EMPLOYEEID);
                    entity.EMPLOYEEID   = leftOffice.T_HR_EMPLOYEE.EMPLOYEEID;
                    entity.CREATEUSERID = leftOffice.T_HR_EMPLOYEE.CREATEUSERID;
                    foreach (T_HR_EMPLOYEEPOST ep in eps.EMPLOYEEPOSTS)
                    {
                        if (ep.EMPLOYEEPOSTID == leftOffice.T_HR_EMPLOYEEPOST.EMPLOYEEPOSTID)
                        {
                            entity.OWNERID           = leftOffice.T_HR_EMPLOYEE.EMPLOYEEID;
                            entity.OWNERPOSTID       = ep.T_HR_POST.POSTID;
                            entity.OWNERDEPARTMENTID = ep.T_HR_POST.T_HR_DEPARTMENT.DEPARTMENTID;
                            entity.OWNERCOMPANYID    = ep.T_HR_POST.T_HR_DEPARTMENT.T_HR_COMPANY.COMPANYID;
                        }
                    }
                }



                ser.LeftOfficeConfirmAdd(entity);
                return(entity.CONFIRMID);
            }
            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);
            }
        }