Ejemplo n.º 1
0
        public static bool UpdateSysVersion(SYS_Version sysVersion)
        {
            bool ret = false;
            Database db = HaveDb();
            if (db != null)
            {
                SYS_Version sysVersionExisting = GetSysVersion(sysVersion.VersionNo, "");
                if (sysVersionExisting != null)
                {
                      
					using (ITransaction scope = db.GetTransaction())
					{
                        db.Update(sysVersion);
                        scope.Complete();
                        ret = true;
                    }
                }
            }
            else
            {
                Dictionary<Guid, SYS_Version> fileSysVersionList = FileSource.LoadSYSVersionData();                
                if (fileSysVersionList.ContainsKey(sysVersion.VersionNoGUID) == true)
                {
                    fileSysVersionList.Remove(sysVersion.VersionNoGUID);
                    fileSysVersionList.Add(sysVersion.VersionNoGUID, sysVersion);
                    FileSource.SaveSYSVersionData(fileSysVersionList);
                }
            }

            return ret;
        }
Ejemplo n.º 2
0
        public static bool SaveSYSVersionData(Dictionary<Guid, SYS_Version> sysVersionList)
        {
            bool ret = false;
            if (sysVersionList.Count > 0)
            {
                List<SYS_Version> sysVersionValueList = new List<SYS_Version>();
                SYS_Version[] sysVersionArray = new SYS_Version[sysVersionList.Values.Count];
                sysVersionList.Values.CopyTo(sysVersionArray, 0);
                sysVersionValueList.AddRange(sysVersionArray);
                ret = JsonStore<SYS_Version>.SaveData(sysVersionValueList, true);
            }

            return ret;
        }
Ejemplo n.º 3
0
        public static double InsertSysVersion(SYS_Version sysVersion)
        {
            double id = 0;
            if (sysVersion.VersionNoGUID != Guid.Empty) throw new Exception("Cannot Set the GUID for a Insert");
            sysVersion.VersionNoGUID = Guid.NewGuid();


            Database db = HaveDb();
            if (db != null)
            {
                using (ITransaction scope = db.GetTransaction())
                {
                    db.Insert(sysVersion);
                    id = sysVersion.VersionNo;
                    scope.Complete();
                }
            }
            else
            {
                Dictionary<Guid, SYS_Version> fileSysVersionList = FileSource.LoadSYSVersionData();
  
                fileSysVersionList.Add(sysVersion.VersionNoGUID, sysVersion);
                FileSource.SaveSYSVersionData(fileSysVersionList);

                id = sysVersion.VersionNo;
            }

            return id;
        }