public ResourceAttributeUsageModel(RS.ResourceAttributeUsage resourceAttributeUsage) { Id = resourceAttributeUsage.Id; IsValueOptional = resourceAttributeUsage.IsValueOptional; ResourceStructureAttribute = resourceAttributeUsage.ResourceStructureAttribute; ResourceStructure = resourceAttributeUsage.ResourceStructure; IsFileDataType = resourceAttributeUsage.IsFileDataType; }
public bool DeleteResourceAttributeUsage(RS.ResourceAttributeUsage usage) { Contract.Requires(usage != null); Contract.Requires(usage.Id >= 0); using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository <RS.ResourceAttributeUsage> repoUsage = uow.GetRepository <RS.ResourceAttributeUsage>(); repoUsage.Delete(usage); uow.Commit(); } return(true); }
public RS.ResourceAttributeUsage UpdateResourceAttributeUsage(RS.ResourceAttributeUsage usage) { Contract.Requires(usage != null); using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository <RS.ResourceAttributeUsage> repo = uow.GetRepository <RS.ResourceAttributeUsage>(); repo.Merge(usage); var merged = repo.Get(usage.Id); repo.Put(merged); uow.Commit(); } return(usage); }
public bool DeleteUsagesByRSId(long id) { List <RS.ResourceAttributeUsage> list = ResourceAttributeUsageRepro.Query(a => a.ResourceStructure.Id == id).ToList(); foreach (RS.ResourceAttributeUsage s in list) { using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository <RS.ResourceAttributeUsage> repo = uow.GetRepository <RS.ResourceAttributeUsage>(); RS.ResourceAttributeUsage deletedUsage = s; deletedUsage = repo.Reload(s); repo.Delete(deletedUsage); uow.Commit(); } } return(true); }
public RS.ResourceAttributeUsage CreateResourceAttributeUsage(RS.ResourceStructureAttribute rsa, RS.ResourceStructure rs, bool isOptional, bool isFileDataType) { RS.ResourceAttributeUsage resourceAttributeUsage = new RS.ResourceAttributeUsage() { Label = rsa.Name, ResourceStructure = rs, ResourceStructureAttribute = rsa, IsValueOptional = isOptional, IsFileDataType = isFileDataType }; using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository <RS.ResourceAttributeUsage> repo = uow.GetRepository <RS.ResourceAttributeUsage>(); repo.Put(resourceAttributeUsage); uow.Commit(); } return(resourceAttributeUsage); }
public RS.FileValue CreateResourceAttributeValue(string name, string extention, string minmetype, byte[] data, bool needConfirmation, R.Resource resource, RS.ResourceAttributeUsage resourceAttributeUsage) { //Contract.Requires(!string.IsNullOrWhiteSpace(value)); RS.FileValue fileValue = new RS.FileValue() { Name = name, Extention = extention, Minmetype = minmetype, Data = data, NeedConfirmation = needConfirmation, Resource = resource, ResourceAttributeUsage = resourceAttributeUsage }; using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository <RS.FileValue> repo = uow.GetRepository <RS.FileValue>(); repo.Put(fileValue); uow.Commit(); } return(fileValue); }
public RS.TextValue CreateResourceAttributeValue(string value, R.Resource resource, RS.ResourceAttributeUsage resourceAttributeUsage) { Contract.Requires(!string.IsNullOrWhiteSpace(value)); RS.TextValue textValue = new RS.TextValue() { Value = value, Resource = resource, ResourceAttributeUsage = resourceAttributeUsage }; using (IUnitOfWork uow = this.GetUnitOfWork()) { IRepository <RS.TextValue> repo = uow.GetRepository <RS.TextValue>(); repo.Put(textValue); uow.Commit(); } return(textValue); }