示例#1
0
 public static void AddToDataBase(this IDateable dateable, System.Data.OleDb.OleDbConnection Conexion)
 {
     using (CoreDataBaseAccess core = new CoreDataBaseAccess(Conexion))
     {
         core.InsertarAsync(dateable);
     }
 }
示例#2
0
        public bool Save(ISaveable aSauver)
        {
            string docId = $"{aSauver.Table}_{Guid.NewGuid()}";

            ITechnicalKey technicalKey = aSauver as ITechnicalKey;
            IDateable     dateable     = aSauver as IDateable;

            if (technicalKey == null || dateable == null)
            {
                return(false);
            }

            MutableDocument document = null;

            if (string.IsNullOrEmpty(technicalKey.Id))
            {
                technicalKey.Id       = docId;
                dateable.DateCreation = DateTime.Now;
            }
            else
            {
                if (dateable.DateCreation == DateTime.MinValue)
                {
                    dateable.DateCreation = DateTime.Now;
                }
                dateable.DateModif = DateTime.Now;
                document           = _dataBaseGiver.Get().GetDocument(technicalKey.Id).ToMutable();
            }

            MutableDictionaryObject dico = aSauver.DocumentInitialize();

            document = dico.ToDocument(docId, document);

            _dataBaseGiver.Get().Save(document);

            return(true);
        }
示例#3
0
 public static int CompareTo(this IDateable a, IDateable b)
 {
     return(-a.Date.CompareTo(b.Date));
 }