public long NewSpecification(EquinoxeExtend.Shared.Object.Record.Specification iNewSpecification) { if (iNewSpecification.Name.IsNullOrEmpty()) { throw new Exception("Le nom de la spécification est invalide"); } if (iNewSpecification.ProjectVersion < 1) { throw new Exception("La version de projet est invalide"); } if (DBRecordDataService.Any <T_E_Specification>(x => x.Name == iNewSpecification.Name)) { throw new Exception("La spécification de ce nom existe déjà"); } if (iNewSpecification.CreatorGUID == null) { throw new Exception("Le nom du createur est invalide"); } if (iNewSpecification.CreationDate == null) { throw new Exception("La date de création est invalide"); } //Création de l'enregistrement var newEntity = new T_E_Specification(); newEntity.Merge(iNewSpecification); return(DBRecordDataService.AddSpecification(newEntity)); }
public void UpdageGeneration(EquinoxeExtend.Shared.Object.Record.Generation iNewGeneration) { if (iNewGeneration.GenerationId < 1) { throw new Exception("L'id de la génération est invalide"); } if (iNewGeneration.CreatorGUID == null) { throw new Exception("L'id du createur n'est pas valide"); } if (iNewGeneration.ProjectName.IsNullOrEmpty()) { throw new Exception("Le nom du projet est invalide"); } if (iNewGeneration.SpecificationId < 1) { throw new Exception("L'id de la specification est invalide"); } //Modification de l'enregistrement var theEntity = new T_E_Generation(); theEntity.Merge(iNewGeneration); DBRecordDataService.Update(theEntity); }
public EquinoxeExtend.Shared.Object.Record.Dossier GetDossierByTemplateName(string iTemplateName, bool iIsFull) { if (iTemplateName.IsNullOrEmpty()) { throw new Exception("Le nom du modèle est invalide"); } var theDossierEntity = DBRecordDataService.GetSingleOrDefault <T_E_Dossier>(x => x.TemplateName == iTemplateName); if (theDossierEntity != null) { var theDossier = theDossierEntity.Convert(); if (iIsFull) { theDossier.Specifications = GetSpecificationsByDossierId(theDossier.DossierId, iIsFull); theDossier.Lock = GetLockByDossierId(theDossier.DossierId); } return(theDossier); } else { return(null); } }
public void UpdateSpecification(EquinoxeExtend.Shared.Object.Record.Specification iSpecification) { if (iSpecification.SpecificationId < 1) { throw new Exception("L'ID de la spéfication est invalide"); } if (iSpecification.DossierId < 1) { throw new Exception("L'ID du dossier est invalide"); } if (iSpecification.Name.IsNullOrEmpty()) { throw new Exception("Le nom de la spéfication est invalide"); } if (iSpecification.ProjectVersion < 1) { throw new Exception("La version de projet est invalide"); } if (DBRecordDataService.Any <T_E_Specification>(x => x.SpecificationId == iSpecification.SpecificationId) == false) { throw new Exception("La specification est inexistante"); } var theEntity = new T_E_Specification(); theEntity.Merge(iSpecification); DBRecordDataService.UpdateSpecification(theEntity); }
public long NewGeneration(EquinoxeExtend.Shared.Object.Record.Generation iNewGeneration) { if (iNewGeneration.GenerationId < 1) { throw new Exception("L'id de la génération est invalide"); } if (iNewGeneration.CreatorGUID == null) { throw new Exception("L'id du createur n'est pas valide"); } if (iNewGeneration.ProjectName.IsNullOrEmpty()) { throw new Exception("Le nom du projet est invalide"); } if (iNewGeneration.SpecificationId < 1) { throw new Exception("L'id de la specification est invalide"); } //Création de l'enregistrement var newEntity = new T_E_Generation(); newEntity.Merge(iNewGeneration); return(DBRecordDataService.Add <T_E_Generation>(newEntity).GenerationId); }
public void UpdateTemplateName(string iDossierName, string iNewTemplateName) { if (iDossierName.IsNullOrEmpty()) { throw new Exception("Le nom du dossier est invalide"); } if (iNewTemplateName.IsNullOrEmpty()) { throw new Exception("Le nouveau nom d'affichage est invalide"); } var theEntity = DBRecordDataService.GetSingle <T_E_Dossier>(x => x.Name == iDossierName); if (theEntity.IsTemplate == false) { throw new Exception("Seul un modèle peut être renommé"); } //Vérification doublons if (DBRecordDataService.Any <T_E_Dossier>(x => x.TemplateName == iNewTemplateName)) { throw new Exception("Le dossier modèle'{0}' est déjà existant".FormatString(iNewTemplateName)); } theEntity.TemplateName = iNewTemplateName; DBRecordDataService.Update(theEntity); }
public void NewDossier(EquinoxeExtend.Shared.Object.Record.Dossier iNewDossier) { if (iNewDossier.DossierId != -1) { throw new Exception("L'Id de la spécification est invalide"); } if (iNewDossier.Name.IsNullOrEmpty()) { throw new Exception("Le nom du dossier est invalide"); } if (iNewDossier.ProjectName.IsNullOrEmpty()) { throw new Exception("Le nom du projet est invalide"); } if (DBRecordDataService.Any <T_E_Dossier>(x => x.Name == iNewDossier.Name)) { throw new Exception("Le dossier existe déjà"); } if (iNewDossier.Specifications.Enum().Count() != 1) { throw new Exception("Le nombre de spécification doit être égal à 1"); } if (iNewDossier.IsTemplate) { if (iNewDossier.TemplateName.IsNullOrEmpty()) { throw new Exception("Le nom du template n'est pas valide"); } if (DBRecordDataService.Any <T_E_Dossier>(x => x.TemplateName == iNewDossier.TemplateName)) { throw new Exception("Le nom du template est déjà existant"); } } using (var ts = new TransactionScope()) { var newSpecification = iNewDossier.Specifications.Single(); //Création du Dossier var newEntity = new T_E_Dossier(); newEntity.Merge(iNewDossier); newSpecification.DossierId = DBRecordDataService.AddDossier(newEntity); //Création de la Spécification NewSpecification(newSpecification); ts.Complete(); } }
public void DeleteLock(long iLockId) { if (iLockId < 1) { throw new Exception("L'ID du lock est invalide"); } var theEntity = DBRecordDataService.GetSingle <T_E_Lock>(x => x.LockId == iLockId); //Suppression base de données DBRecordDataService.Delete <T_E_Lock>(theEntity); }
public void DeleteSpecification(long iSpecificationId) { if (iSpecificationId < 1) { throw new Exception("L'ID de la spécification est invalide"); } var theEntity = DBRecordDataService.GetSingle <T_E_Specification>(x => x.SpecificationId == iSpecificationId); //Suppression base de données DBRecordDataService.DeleteSpecification(iSpecificationId); }
public void DeleteGeneration(long iGenerationId) { if (iGenerationId < 1) { throw new Exception("L'ID de la genenration est invalide"); } var theEntity = DBRecordDataService.GetSingle <T_E_Generation>(x => x.GenerationId == iGenerationId); //Suppression base de données DBRecordDataService.Delete <T_E_Generation>(theEntity); }
public List <EquinoxeExtend.Shared.Object.Record.Specification> GetSpecificationsByDossierId(long iDossierId, bool iIsFull) { var result = new List <EquinoxeExtend.Shared.Object.Record.Specification>(); var entities = DBRecordDataService.GetList <T_E_Specification>(x => x.DossierId == iDossierId); foreach (var entity in entities.Enum()) { result.Add(GetSpecificationByName(entity.Name, iIsFull)); } return(result.Enum().OrderBy(x => x.CreationDate).ToList()); }
public EquinoxeExtend.Shared.Object.Record.Generation GetGenerationById(long iGenerationId) { var entity = DBRecordDataService.GetSingleOrDefault <T_E_Generation>(x => x.GenerationId == iGenerationId); if (entity != null) { return(entity.Convert()); } else { return(null); } }
public EquinoxeExtend.Shared.Object.Record.Lock GetLockByDossierId(long iDossierId) { var entity = DBRecordDataService.GetSingleOrDefault <T_E_Lock>(x => x.DossierId == iDossierId); if (entity != null) { return(entity.Convert()); } else { return(null); } }
public List <EquinoxeExtend.Shared.Object.Record.Generation> GetGenerationBySpecificationId(long iSpecificationId) { var entities = DBRecordDataService.GetList <T_E_Generation>(x => x.SpecificationId == iSpecificationId); if (entities != null) { return(entities.Select(x => x.Convert()).ToList()); } else { return(null); } }
public List <EquinoxeExtend.Shared.Object.Record.Dossier> GetDossiers(bool iIsNotTemplate) { var theDossiers = DBRecordDataService.GetList <T_E_Dossier>(x => x.IsTemplate != iIsNotTemplate).Enum().Select(x => x.Convert()).Enum().ToList(); var result = new List <Dossier>(); foreach (var DossierItem in theDossiers.Enum()) { DossierItem.Specifications = GetSpecificationsByDossierId(DossierItem.DossierId, true); DossierItem.Lock = GetLockByDossierId(DossierItem.DossierId); result.Add(DossierItem); } return(theDossiers); }
public void UpdateDossier(EquinoxeExtend.Shared.Object.Record.Dossier iDossier) { if (iDossier.Name.IsNullOrEmpty()) { throw new Exception("Le nom du dossier est invalide"); } if (DBRecordDataService.Any <T_E_Dossier>(x => x.Name == iDossier.Name) == false) { throw new Exception("Le dossier est inexistant"); } var theEntity = new T_E_Dossier(); theEntity.Merge(iDossier); DBRecordDataService.Update(theEntity); }
public void UpdateDescription(string iDossierName, string iNewDescription) { if (iDossierName.IsNullOrEmpty()) { throw new Exception("Le nom du dossier est invalide"); } var theEntity = DBRecordDataService.GetSingle <T_E_Dossier>(x => x.Name == iDossierName); if (theEntity.IsTemplate == false) { throw new Exception("Seul un modèle peut modifier sa description "); } theEntity.TemplateDescription = iNewDescription; DBRecordDataService.Update(theEntity); }
public EquinoxeExtend.Shared.Object.Record.Dossier GetDossierById(long iDossierId) { if (iDossierId < 1) { throw new Exception("L'id du dossier est invalide"); } var theDossierEntity = DBRecordDataService.GetSingleOrDefault <T_E_Dossier>(x => x.DossierId == iDossierId); if (theDossierEntity != null) { var theDossier = theDossierEntity.Convert(); theDossier.Specifications = GetSpecificationsByDossierId(theDossier.DossierId, true); theDossier.Lock = GetLockByDossierId(theDossier.DossierId); return(theDossier); } else { return(null); } }
public long NewLock(EquinoxeExtend.Shared.Object.Record.Lock iNewLock) { if (iNewLock.DossierId < 1) { throw new Exception("L'id du dossier est invalide"); } if (iNewLock.LockDate == null) { throw new Exception("La date du lock n'est pas valide"); } if (iNewLock.LockId != -1) { throw new Exception("L'id du lock est invalide"); } if (iNewLock.SessionGUID == null) { throw new Exception("Le GUID de session est invalide"); } if (iNewLock.UserId == null) { throw new Exception("L'id du user est invalide"); } if (DBRecordDataService.Any <T_E_Lock>(x => x.DossierId == iNewLock.DossierId)) { throw new Exception("Un lock est déjà posé sur le dossier '{0}'".FormatString(iNewLock.DossierId.ToString())); } //Création de l'enregistrement var newEntity = new T_E_Lock(); newEntity.Merge(iNewLock); return(DBRecordDataService.Add <T_E_Lock>(newEntity).LockId); }
public EquinoxeExtend.Shared.Object.Record.Specification GetSpecificationByName(string iSpecificationName, bool iIsFull) { if (iSpecificationName.IsNullOrEmpty()) { throw new Exception("Le nom de la spécification est invalide"); } var specificationEntity = DBRecordDataService.GetSingleOrDefault <T_E_Specification>(x => x.Name == iSpecificationName); if (specificationEntity != null) { var specification = specificationEntity.Convert(); if (iIsFull) { specification.Generations = GetGenerationBySpecificationId(specification.SpecificationId); } return(specification); } else { return(null); } }
public void DeleteDossier(string iDossierName) { if (iDossierName.IsNullOrEmpty()) { throw new Exception("Le nom du dossier est invalide"); } var theDossier = GetDossierByName(iDossierName); using (var ts = new TransactionScope()) { //Suppression spécifications foreach (var specificationItem in theDossier.Specifications.Enum()) { DBRecordDataService.DeleteSpecification(specificationItem.SpecificationId); } //Suppression dossier DBRecordDataService.DeleteDossier(theDossier.DossierId); ts.Complete(); } }
public List <EquinoxeExtend.Shared.Object.Record.Dossier> GetDossiers(bool iIsNotTemplate, string iDossierName, Guid?iCreatorModificator, DossierCommercialStatusEnum?iDossierStatusEnum) { var theQuery = DBRecordDataService.GetQuery <T_E_Dossier>(null); //Template if (iIsNotTemplate) { theQuery = theQuery.Where(x => x.IsTemplate != iIsNotTemplate); } //DossierName if (iDossierName.IsNotNullAndNotEmpty()) { theQuery = theQuery.Where(x => x.Name == iDossierName); } //Createur/Modificateur if (iCreatorModificator != null) { theQuery = theQuery.Where(x => x.T_E_Specification.Any(y => y.CreatorGUID == iCreatorModificator)); } //Status if (iDossierStatusEnum != null) { theQuery = theQuery.Where(x => x.StateCommercialRef == (short)iDossierStatusEnum); } var result = theQuery.ToList().Enum().Select(x => x.Convert()).ToList(); foreach (var DossierItem in result.Enum()) { DossierItem.Specifications = GetSpecificationsByDossierId(DossierItem.DossierId, true); DossierItem.Lock = GetLockByDossierId(DossierItem.DossierId); } return(result); }