Exemplo n.º 1
0
        // naplní db model z viewModelu
        private VERSION_LOG CompleteDbModel(VersionEntity versionEntity)
        {
            VERSION_LOG versionToDb = new VERSION_LOG();

            versionToDb.VER_ID                    = versionEntity.Id;
            versionToDb.VER_NAME                  = versionEntity.Name;
            versionToDb.VER_COMPANY               = versionEntity.Company;
            versionToDb.VER_SOURCE_PATH           = versionEntity.SourcePath;
            versionToDb.VER_SQL_DATA              = versionEntity.SqlData;
            versionToDb.VER_CONFIG                = versionEntity.Config;
            versionToDb.VER_DATETIME              = versionEntity.Date;
            versionToDb.VER_LOG_USER              = versionEntity.LogUser;
            versionToDb.VER_LOG_DATE              = versionEntity.LogDate;
            versionToDb.VER_CREATED_DATE          = versionEntity.Created;
            versionToDb.VER_CREATED_USER          = versionEntity.User;
            versionToDb.VER_LOCK_FLAG             = versionEntity.LogFlagString;
            versionToDb.VER_DELAY                 = versionEntity.Delay;
            versionToDb.VER_SQL_DATA_CHECK        = versionEntity.SqlDataCheck;
            versionToDb.VER_DELETED               = versionEntity.DeletedString;
            versionToDb.VER_MAIL                  = versionEntity.Mail;
            versionToDb.VER_MESSAGE               = versionEntity.Message;
            versionToDb.VER_MODE                  = versionEntity.Mode;
            versionToDb.VER_GROUP                 = versionEntity.Group;
            versionToDb.VER_S_VER_FLAG            = versionEntity.Flag;
            versionToDb.VER_FILE_FOLDER_TO_DELETE = versionEntity.FileFolderToDelete;
            versionToDb.VER_MAIL_MESSAGE          = versionEntity.MailMessage;
            versionToDb.VER_MAIL_FLAG             = versionEntity.MailFlag;

            return(versionToDb);
        }
        //vrati pozadovanou verzi
        public void GetSelectedVersion(VersionEntity selectedVersion)
        {
            VersionEntityDB selectedVersionDB = new VersionEntityDB(selectedVersion.Name);
            VersionEntityDB foundVersionDB    = versionsRepository.GetSelectedVersion(selectedVersionDB);

            SelectedVersion = new VersionEntity(foundVersionDB.Name);
        }
Exemplo n.º 3
0
        // najde template pro novou verzi z V_VERSION_LOG_TEMPLATE
        public void GetTemplateVersion(long idVersion)
        {
            V_VERSION_LOG_TEMPLATE templateVersionFromDb = dbRepository.GetTemplateVersion(idVersion);

            Version = new VersionEntity(templateVersionFromDb.VER_ID,
                                        templateVersionFromDb.VER_NAME,
                                        templateVersionFromDb.VER_COMPANY,
                                        templateVersionFromDb.VER_SOURCE_PATH,
                                        templateVersionFromDb.VER_SQL_DATA,
                                        templateVersionFromDb.VER_CONFIG,
                                        templateVersionFromDb.VER_DATETIME,
                                        templateVersionFromDb.VER_LOG_USER,
                                        templateVersionFromDb.VER_LOG_DATE,
                                        DateTime.Now,
                                        $"{Environment.MachineName}/{Environment.UserName}",
                                        templateVersionFromDb.VER_LOCK_FLAG,
                                        templateVersionFromDb.VER_DELAY,
                                        templateVersionFromDb.VER_SQL_DATA_CHECK,
                                        templateVersionFromDb.VER_DELETED,
                                        templateVersionFromDb.VER_MAIL,
                                        templateVersionFromDb.VER_MAIL_MESSAGE,
                                        templateVersionFromDb.VER_MODE,
                                        templateVersionFromDb.VER_GROUP,
                                        templateVersionFromDb.VER_LOCK_FLAG,
                                        templateVersionFromDb.VER_FILE_FOLDER_TO_DELETE,
                                        templateVersionFromDb.VER_MAIL_MESSAGE,
                                        templateVersionFromDb.VER_MAIL_FLAG
                                        );
        }
Exemplo n.º 4
0
        private int Compare(VersionEntity info1, VersionEntity info2)
        {
            int result;
            CaseInsensitiveComparer ObjectCompare = new CaseInsensitiveComparer();

            result = ObjectCompare.Compare(info1.BuildTime, info2.BuildTime);
            return(result);
        }
Exemplo n.º 5
0
 private static void WriteFile(Stream fileStream, VersionEntity versionEntity)
 {
     using (StreamWriter writer = new StreamWriter(fileStream))
     {
         writer.Write(JsonConvert.SerializeObject(versionEntity));
     }
     fileStream.Close();
 }
Exemplo n.º 6
0
        // naplní Version daty z db VER_SQL_Data
        public void GetSqlData(long idVersion)
        {
            VERSION_LOG versionFromDB = new VERSION_LOG();

            versionFromDB = dbRepository.GetVersion(idVersion);

            Version = new VersionEntity(versionFromDB.VER_ID,
                                        versionFromDB.VER_SQL_DATA.Replace("\n", "<br/>"),
                                        null);
        }
Exemplo n.º 7
0
 public static void CreateFileIfNotExist(string filePath)
 {
     if (!File.Exists(filePath))
     {
         VersionEntity versionEntity = new VersionEntity {
             Version = "1.0.0.0"
         };
         WriteFile(File.Create(filePath), versionEntity);
     }
 }
Exemplo n.º 8
0
 public void GetEntityData()
 {
     EditorTeamNameNative  = VersionEntity.GetTeamName(TeamNameType.Primary, LanguageType.Native);
     EditorTeamNameEnglish = VersionEntity.GetTeamName(TeamNameType.Primary, LanguageType.English);
     EditorFullName        = VersionEntity.GetTeamName(TeamNameType.FullName, LanguageType.Native);
     EditorShortname       = VersionEntity.GetTeamName(TeamNameType.ShortName, LanguageType.Native);
     EditorNickname        = VersionEntity.GetTeamName(TeamNameType.Nickname, LanguageType.Native);
     ResourceGuid          = VersionEntity.ResourceGuid;
     HomeVenueGuid         = VersionEntity.HomeVenueGuid;
     CountryGuid           = VersionEntity.CountryGuid;
     WebAddress            = VersionEntity.WebAddress;
     EffectiveFrom         = VersionEntity.EffectiveFrom;
     EffectiveTo           = VersionEntity.EffectiveTo;
 }
Exemplo n.º 9
0
        /// <summary>
        /// Method to update an Entity.
        /// </summary>
        /// <param name="entity">An Entity to update.</param>
        /// <param name="save">True to save database context otherwise past false to skip process.</param>
        /// <returns>The updated Entity.</returns>
        public VersionEntity Update(VersionEntity entity, bool save = true)
        {
            // Update item informations.
            entity = Connector.Update(entity).Entity;

            // Save changes on the database.
            if (save)
            {
                Save();
            }

            // Return updated item.
            return(entity);
        }
Exemplo n.º 10
0
        //Najde verzi z VERSION_LOG
        public void GetVersion(long idVersion)
        {
            VERSION_LOG versionFromDB = new VERSION_LOG();

            versionFromDB = dbRepository.GetVersion(idVersion);

            bool isSqlData = false; bool isSqlDataCheck = false;

            if (versionFromDB.VER_SQL_DATA != null)
            {
                isSqlData = true;
            }

            if (versionFromDB.VER_SQL_DATA_CHECK != null)
            {
                isSqlDataCheck = true;
            }

            Version = new VersionEntity(versionFromDB.VER_ID,
                                        versionFromDB.VER_NAME,
                                        versionFromDB.VER_COMPANY,
                                        versionFromDB.VER_SOURCE_PATH,
                                        isSqlData,
                                        versionFromDB.VER_CONFIG,
                                        versionFromDB.VER_DATETIME,
                                        versionFromDB.VER_LOG_USER,
                                        versionFromDB.VER_LOG_DATE,
                                        versionFromDB.VER_CREATED_DATE,
                                        versionFromDB.VER_CREATED_USER,
                                        versionFromDB.VER_LOCK_FLAG,
                                        versionFromDB.VER_DELAY,
                                        isSqlDataCheck,
                                        versionFromDB.VER_DELETED,
                                        versionFromDB.VER_MAIL,
                                        versionFromDB.VER_MAIL_MESSAGE,
                                        versionFromDB.VER_MODE,
                                        versionFromDB.VER_GROUP,
                                        versionFromDB.VER_LOCK_FLAG,
                                        versionFromDB.VER_FILE_FOLDER_TO_DELETE,
                                        versionFromDB.VER_MAIL_MESSAGE,
                                        versionFromDB.VER_MAIL_FLAG
                                        );
        }
Exemplo n.º 11
0
        public ActionResult ChangeVersion(VersionEntity versionToChange)
        {
            if (!ModelState.IsValid)
            {
                return(View(versionToChange));
            }

            if (versionToChange.LogFlagBool)
            {
                versionToChange.LogFlagString = "A";
            }
            else
            {
                versionToChange.LogFlagString = "N";
            }

            TempData["result"] = versionsViewModel.ChangeVersion(versionToChange);
            return(RedirectToAction("GetVersion", new { idVersion = versionToChange.Id }));
        }
Exemplo n.º 12
0
        public async void SyncronizeDatabase(string version, string data)
        {
            var connection = sqlLiteConnection.GetConnection();

            //Create the lookup tables
            CreateTables(connection);
            // TruncateTables(connection);

            var dbVersion = connection.Table <VersionEntity>().FirstOrDefault();

            if (dbVersion == null || version != dbVersion.Version)
            {
                TruncateTables(connection);

                PopulateTables(connection, data);

                VersionEntity versionEntity = new VersionEntity {
                    ID = 1, Version = version
                };
                connection.InsertOrReplace(version);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Method to select an Version by AssemblyVersionMin.
        /// </summary>
        /// <returns>An Version entity or null if not found.</returns>
        public VersionEntity SingleAssemblyVersionMaxOrNull(IQueryable <VersionEntity> query, VersionOptionsSelect op)
        {
            // Select version by AssemblyVersionMax.
            VersionEntity item = null;

            try
            {
                item = query.SingleOrDefault(x => x.AssemblyVersionMax == op.AssemblyVersionMax);
            }
            catch (Exception e)
            {
                log.Error("Version single AssemblyVersionMax not found !", e);
                return(null);
            }

            // Check if user is found, return null instead of default.
            if (item != null && item.PrimaryKey == 0)
            {
                return(null);
            }

            return(item);
        }
Exemplo n.º 14
0
 // zobrazeni prazdneho formulare
 public void AddForm()
 {
     Version = new VersionEntity();
 }
Exemplo n.º 15
0
        // zašle novou verzi k uložení do db
        public string AddVersion(VersionEntity versionEntity, ref long versionId)
        {
            VERSION_LOG versionToDb = CompleteDbModel(versionEntity);

            return(dbRepository.AddVersion(versionToDb, ref versionId));
        }
Exemplo n.º 16
0
        // zašle verzi k aktualizaci
        public string ChangeVersion(VersionEntity versionToChange)
        {
            VERSION_LOG versionToDb = CompleteDbModel(versionToChange);

            return(dbRepository.ChangeVersion(versionToDb));
        }
Exemplo n.º 17
0
        public string GetUpdateLog(string clientVersion)
        {
            StringBuilder        returnstr  = new StringBuilder();
            string               configpath = Server.MapPath("~/") + "AutoUpdateConfig.xml";
            XmlNodeList          loglist    = XMLHelper.GetXmlNodeListByXpath(configpath, "//Root//VersionList//VersionInfo");
            List <VersionEntity> velist     = new List <VersionEntity>();

            foreach (XmlNode item in loglist)
            {
                VersionEntity veEntity  = new VersionEntity();
                XmlNodeList   childlist = item.ChildNodes;
                foreach (XmlNode child in childlist)
                {
                    switch (child.Name)
                    {
                    case "Version":
                        veEntity.MajorPart   = Convert.ToInt32(child.Attributes["MajorPart"].Value);
                        veEntity.MinorPart   = Convert.ToInt32(child.Attributes["MinorPart"].Value);
                        veEntity.PrivatePart = Convert.ToInt32(child.Attributes["PrivatePart"].Value);
                        veEntity.BuildPart   = Convert.ToInt32(child.Attributes["BuildPart"].Value);
                        break;

                    case "BuildDate":
                        veEntity.BuildTime = Convert.ToDateTime(child.InnerText);
                        break;

                    case "UpdateLog":
                        veEntity.VersionDescription = child.InnerXml;
                        break;
                    }
                }
                velist.Add(veEntity);
            }
            //对版本信息进行排序按日期
            Comparison <VersionEntity> com = new Comparison <VersionEntity>(Compare);

            velist.Sort(com);
            bool exist = false;

            for (int i = velist.Count - 1; i >= 0; i--)
            {
                if (clientVersion.Trim().Equals(velist[i].FullVersion))
                {
                    exist = true;
                    if (i == velist.Count - 1)
                    {
                        return("当前版本为最新版本!");
                    }
                    break;
                }
                else
                {
                    returnstr.Append("版本号:" + velist[i].FullVersion + "<br />更新时间:" + velist[i].BuildTime.ToString() + "<br />");
                    returnstr.Append("描述:<br />" + velist[i].VersionDescription + "<br />");
                    returnstr.Append("<br />");
                }
            }
            if (!exist)
            {
                return("无法找到客户端版本对应的服务器版本!");
            }
            else
            {
                return(returnstr.ToString());
            }
        }
Exemplo n.º 18
0
        // ulozeni nove verze
        public string AddVersion(VersionEntity versionToDB)
        {
            VersionEntityDB versionDB = new VersionEntityDB(versionToDB.Name);

            return(versionsRepository.AddVersion(versionDB));
        }
 public ActionResult FindSelectedVersion(VersionEntity selectedVersion)
 {
     selectionMaskViewModel.GetSelectedVersion(selectedVersion);
     return(View(selectionMaskViewModel));
 }