Esempio n. 1
0
        public void RegisterPackage(Package pkg)
        {
            if (!ContainsKey(pkg.Id))
            {
                PackageRecord Record = pkg.Record;
                AllPackages.Insert(Record);
            }
            else
            {
                throw new Exception(string.Format("[PackagesStore]: Package with key [{0}] already exists", pkg.Id));
            }

            Logger.Info("[PackagesStore]: Package registration has been completed successfully => [{0}]", pkg);
        }
Esempio n. 2
0
        public void SavePackage(Package pkg)
        {
                        #if DEBUG
            Logger.Debug("[PackagesStore]: Trying to save Package => [{0}]", pkg);
                        #endif
            if (ContainsKey(pkg.Id))
            {
                PackageRecord record = AllPackages.FindOne(p => p.PackageKey == pkg.Id);
                pkg.Record.Id = record.Id;
                AllPackages.Update(pkg.Record);
            }
            else
            {
                AllPackages.Insert(pkg.Record);
            }

                        #if DEBUG
            Logger.Debug("[PackagesStore]: Package has been updated/inserted successfully");
                        #endif
        }