Exemplo n.º 1
0
 /// <summary>
 /// 根据人员id获取人员信息
 /// </summary>
 /// <param name="personId"></param>
 /// <returns></returns>
 public JsonResult GetPersonInfoByPersonId(int personId)
 {
     try
     {
         PersonInfoCustom perosnInfo = servPersonInfoBLL.GetPersonInfoBySSOId(personId);
         return(Json(new { status = 0, msg = perosnInfo }));
     }
     catch (Exception ex)
     {
         return(Json(new { status = 1, msg = ex.Message }));
     }
 }
Exemplo n.º 2
0
 //新增人员信息
 public JsonResult AddPersonInfo(string name, string ename, string birthday, int gender, int nation, string nativePlace, int blood, int political, int nationality, int marrigae, int religion, string IDcard, string phone, int staffFlag, int org, string jobGrade, string startTime, string worknum, int staffType, int staffStatus, int teacherFlag, string classId, int level, int teacherStatus, int studentFlag, string studentNum, string studentGrade, string studentClass, string inTime, string eduYear, string teacherName, string staffName, int studentType, int studentStatus, string loginName, string loginPwd)
 {
     try
     {
         PersonInfoCustom personInfo = new PersonInfoCustom();
         personInfo.name             = name;
         personInfo.EnName           = ename;
         personInfo.birthday         = birthday;
         personInfo.Gender           = gender;
         personInfo.Nation           = nation;
         personInfo.nativePlace      = nativePlace;
         personInfo.BloodType        = blood;
         personInfo.PoliticalStatus  = political;
         personInfo.Nationality      = nationality;
         personInfo.MarriageStatus   = marrigae == 1 ? true : false;//(marrigae==1?true:false);
         personInfo.Religion         = religion;
         personInfo.IDCard           = IDcard;
         personInfo.phone            = phone;
         personInfo.staffFlag        = staffFlag;
         personInfo.org_id           = org;
         personInfo.job_grade        = jobGrade;
         personInfo.start_time       = startTime;
         personInfo.work_num         = worknum;
         personInfo.staff_type_id    = staffType;
         personInfo.staff_status_id  = staffStatus;
         personInfo.teacherFlag      = teacherFlag;
         personInfo.faculty          = classId;
         personInfo.level_id         = level;
         personInfo.teach_status_id  = teacherStatus;
         personInfo.studentFlag      = studentFlag;
         personInfo.student_num      = studentNum;
         personInfo.student_grade    = studentGrade;
         personInfo.class_Name       = studentClass;
         personInfo.in_time          = inTime;
         personInfo.edu_year         = eduYear;
         personInfo.teacher_Name     = teacherName;
         personInfo.staff_Name       = staffName;
         personInfo.student_type_id  = studentType;
         personInfo.studentStatus_id = studentStatus;
         personInfo.loginAdmin       = loginName;
         personInfo.loginPassWord    = loginPwd;
         bool result = servPersonInfoBLL.AddPersonInfo(personInfo);
         return(Json(new { status = 0, msg = result }));
     }
     catch (Exception ex)
     {
         return(Json(new { status = 1, msg = ex.Message }));
     }
 }
Exemplo n.º 3
0
        /// <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;
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 添加人员信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool AddPersonInfo(PersonInfoCustom model)
 {
     try
     {
         bool result = false;
         //往sso中添加人员基础信息
         ApiPersonInfoModel personModel = new ApiPersonInfoModel();
         personModel.Name            = model.name;
         personModel.EnName          = model.EnName;
         personModel.Gender          = model.Gender;
         personModel.Nation          = model.Nation;
         personModel.Birthday        = model.birthday;
         personModel.BloodType       = model.BloodType;
         personModel.Religion        = model.Religion;
         personModel.NativePlace     = model.nativePlace;
         personModel.Nationality     = model.Nationality;
         personModel.PoliticalStatus = model.PoliticalStatus;
         personModel.MarriageStatus  = model.MarriageStatus;
         personModel.IDCard          = model.IDCard;
         personModel.Phone           = model.phone;
         personModel.Admin           = model.loginAdmin;
         personModel.PassWord        = model.loginPassWord;
         string parStr   = JsonHelper.ObjectToString <ApiPersonInfoModel>(personModel);
         string str      = HttpHelper.PostWebRequestBandError("http://" + personIp + "/ApiPersonInfo/AddPersonInfoAndAccount", parStr, "application/json;charset=utf-8", Encoding.UTF8);
         int    personId = JsonHelper.StringToObject <int>(str);
         if (personId < 1)
         {
             return(false);
         }
         else
         {
             result = true;
         }
         //添加人员信息表serv_person_info
         ServPersonInfoModel personInfoModel = new ServPersonInfoModel();
         personInfoModel.ssoid   = personId;
         personInfoModel.role_id = 0;
         personInfoModel.alias   = model.name;
         personInfoModel.status  = 1;
         int personInfoId = servPersonInfoDAL.AddEntity(personInfoModel);
         if (personInfoId < 1)
         {
             return(false);
         }
         //职工信息
         ServStaffInfoModel staffmodel = new ServStaffInfoModel();
         staffmodel.person_id = personId;
         staffmodel.org_id    = model.org_id;
         staffmodel.job_grade = model.job_grade;
         if (model.start_time != "")
         {
             staffmodel.start_time = Convert.ToDateTime(model.start_time);
         }
         staffmodel.work_num     = model.work_num;
         staffmodel.staff_type   = model.staff_type_id;
         staffmodel.staff_status = model.staff_status_id;
         if (model.staffFlag == 1)//有职工扩展
         {
             //新增人员职工关联
             BasePersonRelationshipModel staffRelation1 = new BasePersonRelationshipModel();
             staffRelation1.type_id   = (int)PersonType.职工;
             staffRelation1.person_id = personId;
             int id1 = basePersonRelationshipDAL.AddEntity(staffRelation1);
             if (id1 < 1)
             {
                 return(false);
             }
             else
             {
                 result = true;
             }
             //新增职工信息
             int id = servStaffInfoDAL.AddEntity(staffmodel);
             if (id < 1)
             {
                 return(false);
             }
             else
             {
                 result = true;
             }
         }
         //教师信息
         ServTeacherInfoModel teacherModel = new ServTeacherInfoModel();
         teacherModel.person_id = personId;
         teacherModel.class_id  = model.faculty;
         teacherModel.level     = model.level_id;
         teacherModel.status    = model.teach_status_id;
         if (model.teacherFlag == 1)//有教师扩展
         {
             //新增人员教师关联
             BasePersonRelationshipModel staffRelation1 = new BasePersonRelationshipModel();
             staffRelation1.type_id   = (int)PersonType.教师;
             staffRelation1.person_id = personId;
             int id1 = basePersonRelationshipDAL.AddEntity(staffRelation1);
             if (id1 < 1)
             {
                 return(false);
             }
             else
             {
                 result = true;
             }
             //新增教师信息
             int id = servTeacherInfoDAL.AddEntity(teacherModel);
             if (id < 1)
             {
                 return(false);
             }
             else
             {
                 result = true;
             }
         }
         //学生信息
         ServStudentInfoModel studentModel = new ServStudentInfoModel();
         studentModel.person_id     = personId;
         studentModel.student_num   = model.student_num;
         studentModel.student_grade = model.student_grade;
         studentModel.class_id      = model.class_Name;
         if (model.in_time != "")
         {
             studentModel.in_time = Convert.ToDateTime(model.in_time);
         }
         studentModel.edu_year     = model.edu_year;
         studentModel.teacher_id   = model.teacher_Name;
         studentModel.staff_id     = model.staff_Name;
         studentModel.student_type = model.student_type_id;
         studentModel.status       = model.studentStatus_id;
         if (model.studentFlag == 1)//有学生扩展
         {
             //新增人员学生关联
             BasePersonRelationshipModel staffRelation1 = new BasePersonRelationshipModel();
             staffRelation1.type_id   = (int)PersonType.学生;
             staffRelation1.person_id = personId;
             int id1 = basePersonRelationshipDAL.AddEntity(staffRelation1);
             if (id1 < 1)
             {
                 return(false);
             }
             else
             {
                 result = true;
             }
             //新增学生信息
             int id = servStudentInfoDAL.AddEntity(studentModel);
             if (id < 1)
             {
                 return(false);
             }
             else
             {
                 result = true;
             }
         }
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 修改人员信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdatePersonInfo(PersonInfoCustom model)
 {
     try
     {
         bool result = true;
         //修改人员基础信息
         ApiPersonInfoModel personModel = new ApiPersonInfoModel();
         personModel.PersonID        = model.personID;
         personModel.Name            = model.name;
         personModel.EnName          = model.EnName;
         personModel.Gender          = model.Gender;
         personModel.Nation          = model.Nation;
         personModel.Birthday        = model.birthday;
         personModel.BloodType       = model.BloodType;
         personModel.Religion        = model.Religion;
         personModel.NativePlace     = model.nativePlace;
         personModel.Nationality     = model.Nationality;
         personModel.PoliticalStatus = model.PoliticalStatus;
         personModel.MarriageStatus  = model.MarriageStatus;
         personModel.IDCard          = model.IDCard;
         personModel.Phone           = model.phone;
         string parStr  = JsonHelper.ObjectToString <ApiPersonInfoModel>(personModel);
         string str     = HttpHelper.PostWebRequestBandError("http://" + personIp + "/ApiPersonInfo/UpdatePersonInfo", parStr, "application/json;charset=utf-8", Encoding.UTF8);
         int    result1 = JsonHelper.StringToObject <int>(str);
         if (result1 == 1)
         {
             result = false;
         }
         List <BasePersonRelationshipModel> relationList = basePersonRelationshipDAL.GetPersonTypeByPersonId(model.personID);
         //职工扩展
         BasePersonRelationshipModel staffRelation = relationList.FirstOrDefault(n => n.type_id == (int)PersonType.职工);
         ServStaffInfoModel          staffmodel    = new ServStaffInfoModel();
         staffmodel.person_id = model.personID;
         staffmodel.org_id    = model.org_id;
         staffmodel.job_grade = model.job_grade;
         if (model.start_time != "")
         {
             staffmodel.start_time = Convert.ToDateTime(model.start_time);
         }
         staffmodel.work_num     = model.work_num;
         staffmodel.staff_type   = model.staff_type_id;
         staffmodel.staff_status = model.staff_status_id;
         if (model.staffFlag == 1)      //有职工扩展
         {
             if (staffRelation != null) //修改职工信息
             {
                 int num = servStaffInfoDAL.UpdateStaffInfoById(staffmodel);
                 if (num == 0)
                 {
                     result = false;
                 }
             }
             else//新增职工扩展
             {
                 //新增人员扩展
                 BasePersonRelationshipModel staffRelation1 = new BasePersonRelationshipModel();
                 staffRelation1.type_id   = (int)PersonType.职工;
                 staffRelation1.person_id = model.personID;
                 int id1 = basePersonRelationshipDAL.AddEntity(staffRelation1);
                 if (id1 == 0)
                 {
                     result = false;
                 }
                 //新增职工信息
                 int id = servStaffInfoDAL.AddEntity(staffmodel);
                 if (id == 0)
                 {
                     result = false;
                 }
             }
         }
         else//没有职工信息
         {
             if (staffRelation != null)//删除职工信息
             {
                 //删除职工关联
                 BasePersonRelationshipQuery query = new BasePersonRelationshipQuery();
                 query.person_id = model.personID;
                 query.type_id   = (int)PersonType.职工;
                 int num = basePersonRelationshipDAL.DeletePersonRelationshipByPersonIdAndTypeId(query);
                 if (num == 0)
                 {
                     result = false;
                 }
                 //删除职工信息
                 num = servStaffInfoDAL.DeleteStaffInfoById(model.personID);
                 if (num == 0)
                 {
                     result = false;
                 }
             }
         }
         //教师
         BasePersonRelationshipModel teacherRelation = relationList.FirstOrDefault(n => n.type_id == (int)PersonType.教师);
         ServTeacherInfoModel        teacherModel    = new ServTeacherInfoModel();
         teacherModel.person_id = model.personID;
         teacherModel.class_id  = model.faculty;
         teacherModel.level     = model.level_id;
         teacherModel.status    = model.teach_status_id;
         if (model.teacherFlag == 1)      //有教师扩展
         {
             if (teacherRelation != null) //修改教师扩展
             {
                 int num = servTeacherInfoDAL.UpdateTeacherInfoById(teacherModel);
                 if (num == 0)
                 {
                     result = false;
                 }
             }
             else//新增教师扩展
             {
                 //新增人员教师关联
                 BasePersonRelationshipModel staffRelation1 = new BasePersonRelationshipModel();
                 staffRelation1.type_id   = (int)PersonType.教师;
                 staffRelation1.person_id = model.personID;
                 int id1 = basePersonRelationshipDAL.AddEntity(staffRelation1);
                 if (id1 == 0)
                 {
                     result = false;
                 }
                 //新增教师信息
                 int id = servTeacherInfoDAL.AddEntity(teacherModel);
                 if (id == 0)
                 {
                     result = false;
                 }
             }
         }
         else//没有教师扩展
         {
             if (teacherRelation != null)//删除教师扩展
             {
                 //删除人员教师关联
                 BasePersonRelationshipQuery query = new BasePersonRelationshipQuery();
                 query.person_id = model.personID;
                 query.type_id   = (int)PersonType.教师;
                 int num = basePersonRelationshipDAL.DeletePersonRelationshipByPersonIdAndTypeId(query);
                 if (num == 0)
                 {
                     result = false;
                 }
                 //删除教师信息
                 num = servTeacherInfoDAL.DeleteTeacherInfoById(model.personID);
                 if (num == 0)
                 {
                     result = false;
                 }
             }
         }
         //学生
         BasePersonRelationshipModel studentRelation = relationList.FirstOrDefault(n => n.type_id == (int)PersonType.学生);
         ServStudentInfoModel        studentModel    = new ServStudentInfoModel();
         studentModel.person_id     = model.personID;
         studentModel.student_num   = model.student_num;
         studentModel.student_grade = model.student_grade;
         studentModel.class_id      = model.class_Name;
         if (model.in_time != "")
         {
             studentModel.in_time = Convert.ToDateTime(model.in_time);
         }
         studentModel.edu_year     = model.edu_year;
         studentModel.teacher_id   = model.teacher_Name;
         studentModel.staff_id     = model.staff_Name;
         studentModel.student_type = model.student_type_id;
         studentModel.status       = model.studentStatus_id;
         if (model.studentFlag == 1)      //有学生扩展
         {
             if (studentRelation != null) //修改学生扩展
             {
                 int num = servStudentInfoDAL.UpdateStudentInfoById(studentModel);
                 if (num == 0)
                 {
                     result = false;
                 }
             }
             else//新增学生扩展
             {
                 //新增人员学生关联
                 BasePersonRelationshipModel staffRelation1 = new BasePersonRelationshipModel();
                 staffRelation1.type_id   = (int)PersonType.学生;
                 staffRelation1.person_id = model.personID;
                 int id1 = basePersonRelationshipDAL.AddEntity(staffRelation1);
                 if (id1 == 0)
                 {
                     result = false;
                 }
                 //新增学生信息
                 int id = servStudentInfoDAL.AddEntity(studentModel);
                 if (id == 0)
                 {
                     result = false;
                 }
             }
         }
         else
         {
             if (studentRelation != null)//删除学生扩展
             {
                 //删除人员学生关联
                 BasePersonRelationshipQuery query = new BasePersonRelationshipQuery();
                 query.person_id = model.personID;
                 query.type_id   = (int)PersonType.学生;
                 int num = basePersonRelationshipDAL.DeletePersonRelationshipByPersonIdAndTypeId(query);
                 if (num == 0)
                 {
                     result = false;
                 }
                 //删除学生信息
                 num = servStudentInfoDAL.DeleteStudentInfoById(model.personID);
                 if (num == 0)
                 {
                     result = false;
                 }
             }
         }
         return(result);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }