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 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 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 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 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 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); }