/// <summary> /// 修改组织架构名称和编码 /// </summary> /// <param name="model"></param> /// <returns></returns> public int UpdateOrganizationName(BaseOrganizitionInfoModel model) { try { return(mapContext.Update("UpdateOrganizationName", model)); } catch (Exception ex) { throw ex; } }
public int AddEntity(BaseOrganizitionInfoModel entity) { try { int id = (int)mapContext.Insert("InsertOrganizitionInfo", entity); return(id); } catch (Exception ex) { throw ex; } }
/// <summary> /// 根据人员id获取人员信息 /// </summary> /// <param name="ssoId"></param> public PersonInfoCustom GetPersonInfoBySSOId(int ssoId) { try { //查询人员基础信息 ApiPersonInfoModel apiModel = GetPostPersonInfoByPersonId(ssoId); //查询人员关联信息 PersonInfoCustom personModel = new PersonInfoCustom(); if (apiModel != null) { personModel.personID = apiModel.PersonID; //人员编号 personModel.name = apiModel.Name; //姓名 //性别 personModel.genderName = apiModel.GenderName; personModel.Gender = apiModel.Gender; //民族 personModel.nationName = apiModel.NationName; personModel.Nation = apiModel.Nation; //生日 personModel.birthday = apiModel.Birthday; //血型 personModel.bloodTypeName = apiModel.BloodTypeName; personModel.BloodType = apiModel.BloodType; //宗教 personModel.religionName = apiModel.ReligionName; personModel.Religion = apiModel.Religion; //籍贯 personModel.nativePlace = apiModel.NativePlace; //国籍 personModel.nationalityName = apiModel.NationalityName; personModel.Nationality = apiModel.Nationality; //政治面貌 personModel.politicalStatusName = apiModel.PoliticalStatusName; personModel.PoliticalStatus = apiModel.PoliticalStatus; //婚姻 personModel.MarriageStatus = apiModel.MarriageStatus; personModel.marriageStatusName = apiModel.MarriageStatus == null ? "" : ((bool)apiModel.MarriageStatus) ? "已婚" : "未婚"; //照片 personModel.photoFileName = apiModel.PhotoFileName; //身份证 personModel.IDCard = apiModel.IDCard; //证件号 personModel.workNO = apiModel.WorkNO; //学院 personModel.college = apiModel.College; //一卡通卡号 personModel.oneCardNumber = apiModel.OneCardNumber; //手机号 personModel.phone = apiModel.Phone; //人员类型 personModel.PersonType = apiModel.PersonType; personModel.PersonTypeName = apiModel.PersonTypeName; //部门 personModel.department = apiModel.Department; personModel.DepartmentID = apiModel.DepartmentID; //根据人员id查询人员类型,然后根据类型查询对应的扩展表 List <BasePersonRelationshipModel> relationList = basePersonRelationshipDAL.GetPersonTypeByPersonId(ssoId); for (int i = 0; i < relationList.Count; i++) { switch (relationList[i].type_id) { case (int)PersonType.学生: ServStudentInfoModel student = servStudentInfoDAL.GetStudentInfoByPersonId(relationList[i].person_id); if (student != null) { personModel.studentFlag = 1; personModel.student_num = student.student_num; personModel.student_grade = student.student_grade.ToString(); personModel.class_Name = student.class_id.ToString(); personModel.in_time = student.in_time == null ? "" : Convert.ToDateTime(student.in_time).ToString("yyyy-MM-dd HH:mm:ss"); personModel.edu_year = student.edu_year.ToString(); personModel.teacher_Name = student.teacher_id; personModel.staff_Name = student.staff_id; personModel.student_type_id = student.student_type; personModel.student_type = ((StudentType)student.student_type).ToString(); personModel.studentStatus_id = student.status; personModel.studentStatus = ((StudentStatus)student.status).ToString(); } break; case (int)PersonType.教师: ServTeacherInfoModel teacherModel = servTeacherInfoDAL.GetTeacherInfoByPersonId(relationList[i].person_id); if (teacherModel != null) { personModel.teacherFlag = 1; personModel.faculty = teacherModel.class_id.ToString(); personModel.faculty = teacherModel.class_id; personModel.level = ((TeacherLevel)teacherModel.level).ToString(); personModel.level_id = teacherModel.level; personModel.teach_Status = ((TeachStatus)teacherModel.status).ToString(); personModel.teach_status_id = teacherModel.status; } break; case (int)PersonType.职工: ServStaffInfoModel staffInfo = servStaffInfoDAL.GetStaffInfoByPersonId(relationList[i].person_id); if (staffInfo != null) { personModel.staffFlag = 1; //部门 personModel.org_id = staffInfo.org_id; BaseOrganizitionInfoModel orgmodel = baseOrganizationDAL.GetEntity(staffInfo.org_id); personModel.orgName = orgmodel == null ? "" : orgmodel.org_name; personModel.job_grade = staffInfo.job_grade; personModel.start_time = staffInfo.start_time == null ? "" : Convert.ToDateTime(staffInfo.start_time).ToString("yyyy-MM-dd HH:mm:ss"); personModel.work_num = staffInfo.work_num; personModel.staff_type_id = staffInfo.staff_type; personModel.staff_type = ((PersonStaffType)staffInfo.staff_type).ToString(); personModel.staff_status_id = staffInfo.staff_status; personModel.staff_status = ((PersonStaffStatus)staffInfo.staff_status).ToString(); } break; } } } return(personModel); } catch (Exception ex) { throw ex; } }
public bool UpdateEntity(int id, BaseOrganizitionInfoModel newentity) { throw new NotImplementedException(); }
/// <summary> /// 添加或修改组织架构节点 /// </summary> /// <param name="id"></param> /// <param name="name"></param> /// <param name="pid"></param> /// <param name="pcode"></param> /// <returns></returns> public bool UpdateOrgNameOrAddOrg(int id, string name, int pid, string pcode) { try { bool result = false; BaseOrganizitionInfoModel model = new BaseOrganizitionInfoModel(); model.id = id; model.org_name = name; model.pid = pid; //提取中文首字母 ConvertChinese chinese = new ConvertChinese(); string codes = chinese.GetHeadOfChs(name); model.org_code = codes; model.pcode = pcode; model.org_type = 1; model.region_id = 1; if (id == 0)//添加节点 { //往ztree表中添加一条数据 int num = baseOrganizationDAL.AddEntity(model); if (num != 0) { ServOrganizationChartModel chartModel = new ServOrganizationChartModel(); chartModel.content = name; chartModel.child_node = num.ToString(); chartModel.parent_node = pid.ToString(); chartModel.create_time = DateTime.Now; chartModel.update_time = DateTime.Now; //往gojs表中添加一条数据 num = servOrganizationChartDAL.AddEntity(chartModel); if (num != 0) { result = true; } } } else//修改节点名称 { //修改ztee表中数据 int num = baseOrganizationDAL.UpdateOrganizationName(model); if (num != 0) { ServOrganizationChartModel chartModel = new ServOrganizationChartModel(); chartModel.content = name; chartModel.child_node = id.ToString(); chartModel.update_time = DateTime.Now; //修改gojs表中数据 num = servOrganizationChartDAL.UpdateOrgChartByChildNode(chartModel); if (num != 0) { result = true; } } } return(result); } catch (Exception ex) { throw ex; } }