Exemple #1
0
        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);
        }