/// <summary> /// 保存 /// </summary> public void Delete() { RoleInfo roleInfo = Mapper.Clone <RoleInfo>(this); RoleInfoRepo.Delete(roleInfo); //移除角色部门关系 RoleOrganizationInfoRepo.Read() .Where(ro => ro.RoleId == this.Id) .ToList() .ForEach(ro => RoleOrganizationInfoRepo.Delete(ro)); //移除角色用户关系 RoleUserInfoRepo.Read() .Where(ru => ru.RoleId == this.Id) .ToList() .ForEach(ru => RoleUserInfoRepo.Delete(ru)); //移除角色岗位关系 RolePositionInfoRepo.Read() .Where(rp => rp.RoleId == this.Id) .ToList() .ForEach(rp => RolePositionInfoRepo.Delete(rp)); //移除角色权限操作关系 RoleOperationInfoRepo.Read() .Where(ro => ro.RoleId == this.Id) .ToList() .ForEach(rto => RoleOperationInfoRepo.Delete(rto)); }
/// <summary> /// 删除 /// </summary> public void Delete() { OrganizationInfoRepo.Delete(this.MappingTo <OrganizationInfo>()); //移除角色组织关系 List <RoleOrganizationInfo> roList = RoleOrganizationInfoRepo .Read() .Where(ro => ro.OrganizationId == this.Id) .ToList(); foreach (RoleOrganizationInfo ro in roList) { RoleOrganizationInfoRepo.Delete(ro); } //移除组织下的岗位 List <PositionInfo> poList = PositionInfoRepo .Read() .Where(po => po.OrganizationId == this.Id) .ToList(); foreach (PositionInfo po in poList) { PositionInfoRepo.Delete(po); } //移除组织人员关系 List <PositionUserInfo> puList = PositionUserInfoRepo .Read() .Where(pu => pu.OrganizationId == this.Id) .ToList(); foreach (PositionUserInfo pu in puList) { PositionUserInfoRepo.Delete(pu); } }
/// <summary> /// 移除 /// </summary> /// <param name="group">关系组名</param> public static void RemoveGroup(string group) { var list = RoleMutexInfoRepo.Read().Where(r => r.Group == group).ToList(); foreach (var item in list) { RoleMutexInfoRepo.Delete(item); } }
/// <summary> /// 移除 /// </summary> public void Delete() { PositionInfoRepo.Delete(this.MappingTo <PositionInfo>()); //移除岗位用户关系 PositionUserInfoRepo.Read() .Where(pu => pu.PositionId == this.Id) .ToList() .ForEach(pu => PositionUserInfoRepo.Delete(pu)); }
public void SaveFav(int UserID, int segID) { var DataContext = new DataClasses1DataContext(); var segct = from u in DataContext.Views where u.UserID == UserID where u.SegID == segID select u; if (segct.Count() > 0) { var sc = db.Views .Where(s => s.SegID == segID) .First(); datarepo.Delete(sc); } else { //save new View vnew = new Models.View(); vnew.SegID = segID; vnew.UserID = UserID; // vnew.Timestamp = DateTime.Now datarepo.Add(vnew); datarepo.Save(); } }
/// <summary> /// 删除 /// </summary> public void Delete() { List <Operation> operationList = this.OperationList; foreach (Operation operation in operationList) { operation.Delete(); } TargetInfoRepo.Delete(this.MappingTo <TargetInfo>()); }
public void Delete() { DataRepo<AppInfo> repo = new DataRepo<AppInfo>(); //添加 AppInfo appInfo = new AppInfo(); appInfo.Id = StringFactory.NewGuid(); appInfo.Key = "$deleteKey"; appInfo.Secret = "test"; appInfo.Name = "测试删除App"; repo.Add(appInfo); repo.Delete(appInfo); Assert.IsTrue(repo.Read().Where(a => a.Key == "$deleteKey").Count() < 1); }
public Role CancelRole(Role role) { if (!PositionInfoRepo.Exists(this.MappingTo <PositionInfo>())) { throw new Exception("岗位不存在"); } RolePositionInfo rolePositionInfo = new RolePositionInfo(); rolePositionInfo.RoleId = role.Id; rolePositionInfo.OrganizationId = this.OrganizationId; rolePositionInfo.PositionId = this.Id; RolePositionInfoRepo.Delete(rolePositionInfo); return(role); }
/// <summary> /// 删除 /// </summary> public void Delete() { AppInfoRepo.Delete(this.MappingTo <AppInfo>()); //移除应用权限对象 TargetInfoRepo.Read() .Where(tag => tag.AppId == this.Id) .ToList() .ForEach(tag => TargetInfoRepo.Delete(tag)); //移除应用权限操作 OperationInfoRepo.Read() .Where(op => op.AppId == this.Id) .ToList() .ForEach(op => OperationInfoRepo.Delete(op)); }
/// <summary> /// 删除 /// </summary> public void Delete() { //删除和角色关系 List <RoleOperationInfo> roList = RoleOperationInfoRepo .Read() .Where(ro => ro.OperationId == this.Id) .ToList(); foreach (var ro in roList) { RoleOperationInfoRepo.Delete(ro); } OperationInfoRepo.Delete(this.MappingTo <OperationInfo>()); }
public void Delete() { DataRepo <AppInfo> repo = new DataRepo <AppInfo>(); //添加 AppInfo appInfo = new AppInfo(); appInfo.Id = StringFactory.NewGuid(); appInfo.Key = "$deleteKey"; appInfo.Secret = "test"; appInfo.Name = "测试删除App"; repo.Add(appInfo); repo.Delete(appInfo); Assert.IsTrue(repo.Read().Where(a => a.Key == "$deleteKey").Count() < 1); }
/// <summary> /// 删除 /// </summary> public void Delete() { UserInfoRepo.Delete(this.MappingTo <UserInfo>()); //移除角色用户关系 List <RoleUserInfo> ruList = RoleUserInfoRepo.Read().Where(ru => ru.UserId == this.Id).ToList(); foreach (var ru in ruList) { RoleUserInfoRepo.Delete(ru); } //移除岗位用户关系 List <PositionUserInfo> puList = PositionUserInfoRepo.Read().Where(pu => pu.UserId == this.Id).ToList(); foreach (var pu in puList) { PositionUserInfoRepo.Delete(pu); } //移除用户安全信息 var securityInfo = UserSecurityInfoRepo .Read() .FirstOrDefault(us => us.Account == this.Account); UserSecurityInfoRepo.Delete(securityInfo); }
public void AddAndRead() { DataRepo<AppInfo> repo = new DataRepo<AppInfo>(); //添加 AppInfo info = new AppInfo(); info.Id = StringFactory.NewGuid(); info.Key = "test"; info.Secret = "test"; info.Name = "测试App"; repo.Add(info); //通过读取验证添加是否成功 List<AppInfo> infoList = repo.Read(); Assert.IsNotNull(infoList); Assert.IsTrue(infoList.Count > 0); repo.Delete(info); }
public void AddAndRead() { DataRepo <AppInfo> repo = new DataRepo <AppInfo>(); //添加 AppInfo info = new AppInfo(); info.Id = StringFactory.NewGuid(); info.Key = "test"; info.Secret = "test"; info.Name = "测试App"; repo.Add(info); //通过读取验证添加是否成功 List <AppInfo> infoList = repo.Read(); Assert.IsNotNull(infoList); Assert.IsTrue(infoList.Count > 0); repo.Delete(info); }
/// <summary> /// 移除汇报上级 /// </summary> /// <param name="position"></param> /// <returns></returns> public Position RemoveReportTo(Position position) { if (!PositionInfoRepo.Exists(position.MappingTo <PositionInfo>()) || !PositionInfoRepo.Exists(this.MappingTo <PositionInfo>())) { throw new Exception("岗位不存在"); } PositionReportToInfo reportToInfo = PositionReportToInfoRepo.Read() .FirstOrDefault( p => p.PositionId == this.Id && p.HigherOrganizationId == position.OrganizationId && p.HigherPositionId == position.Id && p.OrganizationId == this.OrganizationId); //reportToInfo.OrganizationId = this.OrganizationId; //reportToInfo.PositionId = this.Id; //reportToInfo.HigherOrganizationId = position.OrganizationId; //reportToInfo.HigherPositionId = position.Id; PositionReportToInfoRepo.Delete(reportToInfo); return(position); }
public virtual void Delete(string key = null) { DataRepo.Delete <T>(GroupId, key ?? DefaultKey); }
public void Delete() { UserStateInfoRepo.Delete(this.MappingTo <UserStateInfo>()); }