/// <summary> /// 修改新增人员信息 /// </summary> /// <param name="entity"></param> public void SetDeptPerson(PerformancePersonSecondEntity entity, UserEntity user) { var db = new RepositoryFactory().BaseRepository().BeginTrans(); try { entity.modifyuser = user.RealName; entity.modifydate = DateTime.Now; entity.modifyuserid = user.UserId; if (string.IsNullOrEmpty(entity.Id)) { entity.Id = Guid.NewGuid().ToString(); entity.createtime = DateTime.Now; entity.departmentid = user.DepartmentId; db.Insert(entity); } else { db.Update(entity); } db.Commit(); } catch (Exception) { db.Rollback(); } }
/// <summary> /// 操作配置 对应修改当前月标题和数据 /// </summary> public void operation(List <PerformancesetupSecondEntity> add, List <PerformancesetupSecondEntity> del, List <PerformancesetupSecondEntity> Listupdate, PerformancetitleSecondEntity title, List <PerformanceSecondEntity> Score, PerformancePersonSecondEntity person) { var db = new RepositoryFactory().BaseRepository().BeginTrans(); try { if (add.Count > 0) { db.Insert(add); } if (del.Count > 0) { db.Delete(del); } if (Listupdate.Count > 0) { db.Update(Listupdate); } //标题头数据操作 if (title != null) { if (title.name != null) { var one = db.FindEntity <PerformancetitleSecondEntity>(title.titleid); if (one != null) { one.name = title.name; one.sort = title.sort; db.Update(one); } else { db.Insert(title); } } } //数据列表数据操作 if (Score.Count > 0) { foreach (var item in Score) { if (string.IsNullOrEmpty(item.performanceid)) { item.performanceid = Guid.NewGuid().ToString(); db.Insert(item); } else { db.Update(item); } } } if (person != null) { if (string.IsNullOrEmpty(person.Id)) { person.Id = Guid.NewGuid().ToString(); db.Insert(person); } else { db.Update(person); } } db.Commit(); } catch (Exception ex) { db.Rollback(); throw; } }