//----------------------------------------- public CChampCustom GetChampInMemoryDb(CMemoryDb db) { CChampCustom copie = new CChampCustom(db); if (!copie.ReadIfExist(Id)) { copie = CCloner2iSerializable.Clone(this, null, new object[] { db }) as CChampCustom; } return(copie); }
//--------------------------------------------------------------------------------------------- private static TID.CChampCustom AssureChampInMemoryDb(CChampCustom champTimos, CMemoryDb db) { TID.CChampCustom champ = new TimosInventory.data.CChampCustom(db); if (!champ.ReadIfExistsIdTimos(champTimos.Id)) { champ.CreateNew(champTimos.Id); champ.Nom = champTimos.Nom; switch (champTimos.TypeDonneeChamp.TypeDonnee) { case TypeDonnee.tBool: champ.TypeDonnee = ETypeChampBasique.Bool; break; case TypeDonnee.tDate: champ.TypeDonnee = ETypeChampBasique.Date; break; case TypeDonnee.tDouble: champ.TypeDonnee = ETypeChampBasique.Decimal; break; case TypeDonnee.tEntier: champ.TypeDonnee = ETypeChampBasique.Int; break; case TypeDonnee.tString: champ.TypeDonnee = ETypeChampBasique.String; break; } champ.FormuleValeurParDefaut = champTimos.FormuleValeurParDefaut; champ.Precision = champTimos.Precision; champ.FormuleValidation = champTimos.FormuleValidation; champ.TexteErreurFormat = champTimos.TexteErreurFormat; champ.CodeRole = champTimos.CodeRole; champ.CodesRolesSecondaires = champTimos.CodesRolesSecondaires; foreach (CValeurChampCustom valeurTimos in champTimos.ListeValeurs) { TID.CValeurChampCustom valeur = new TimosInventory.data.CValeurChampCustom(db); valeur.CreateNew(); valeur.Display = valeurTimos.Display; valeur.Value = valeurTimos.ValeurMasquee; valeur.ChampCustom = champ; } } return(champ); }