Ejemplo n.º 1
0
        private int EditEmployee(ArchivesEmployeeIdentityDto dto, int record, ArchivesEmployeeIdentityModel empIdentityMdl, ArStudyModel studyMdl, ArTelModel telMdl)
        {
            ArStudyModel oldStudyMdl = null;
            ArTelModel   oldTelMdl   = null;
            ArDepartmentChangeLibModel    departmentMdl     = null;
            ArPostChangeLibModel          postMdl           = null;
            ArchivesEmployeeIdentityModel oldEmpIdentityMdl = new ArchivesEmployeeIdentityModel();

            ArchiveEntityMapper.GetStudyDataFrom(dto, oldEmpIdentityMdl, out oldStudyMdl);
            ArchiveEntityMapper.GetTelDataFrom(dto, oldEmpIdentityMdl, out oldTelMdl);
            ArchiveEntityMapper.GetDepartmentDataFrom(dto, oldEmpIdentityMdl, out departmentMdl);
            ArchiveEntityMapper.GetPostDataFrom(dto, oldEmpIdentityMdl, out postMdl);

            ////添加修改逻辑
            record = this.irep.Update(u => u.Id_Key == dto.Id_Key, empIdentityMdl);
            ////处理外部逻辑
            ////1.修改学习信息存储
            record += StudyManager.Edit(studyMdl, oldStudyMdl);
            ////2.修改联系方式信息存储
            record += TelManager.Edit(telMdl, oldTelMdl);
            ////3.修改部门信息存储
            record += this.DepartmentMananger.Edit(departmentMdl);
            ////4.修改岗位信息存储
            record += this.PostManager.Edit(postMdl);
            return(record);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 存储员工档案信息
        /// </summary>
        /// <param name="dto">新的数据传输对象</param>
        /// <param name="opSign">操作标志</param>
        /// <returns></returns>
        public OpResult Store(ArchivesEmployeeIdentityDto dto, string opSign)
        {
            int record = 0;

            try
            {
                dto.RegistedDate = dto.RegistedDate.AddDays(1).ToDate();
                ArchivesEmployeeIdentityModel empIdentityMdl = new ArchivesEmployeeIdentityModel();
                ArStudyModel               studyMdl          = null;
                ArTelModel                 telMdl            = null;
                ArPostChangeLibModel       postMdl           = null;
                ArDepartmentChangeLibModel departmentMdl     = null;
                //得到身份证的信息
                if (!ArchiveEntityMapper.GetIdentityDataFrom(dto.IdentityID, empIdentityMdl, this.identityManager))
                {
                    return(OpResult.SetSuccessResult("没有找到此身份证号的信息!", true));
                }

                ArchiveEntityMapper.GetEmployeeDataFrom(dto, empIdentityMdl);
                ArchiveEntityMapper.GetDepartmentDataFrom(dto, empIdentityMdl, out departmentMdl);
                ArchiveEntityMapper.GetPostDataFrom(dto, empIdentityMdl, out postMdl);
                ArchiveEntityMapper.GetStudyDataFrom(dto, empIdentityMdl, out studyMdl);
                ArchiveEntityMapper.GetTelDataFrom(dto, empIdentityMdl, out telMdl);

                if (opSign == "add")
                {
                    record = AddEmployee(record, empIdentityMdl, studyMdl, telMdl, postMdl, departmentMdl);
                }
                else if (opSign == "edit")
                {
                    record = EditEmployee(dto, record, empIdentityMdl, studyMdl, telMdl);
                }
                return(OpResult.SetSuccessResult("保存档案数据成功!", record > 0, empIdentityMdl.Id_Key));
            }
            catch (Exception ex)
            {
                return(OpResult.SetErrorResult(ex));
            }
        }