Exemplo n.º 1
0
        /*private static int GetLanguageId()
         * {
         *  int languageId = -1;
         *
         *  using (IDataReader reader = Language.GetLangByName(Thread.CurrentThread.CurrentCulture.Name))
         *  {
         *      if (reader.Read())
         *      {
         *          languageId = (int)reader["LangId"];
         *      }
         *      else
         *      {
         *          using (IDataReader reader2 = Language.GetAllLanguages())
         *          {
         *              while (reader2.Read())
         *              {
         *                  if ((bool)reader2["IsDefault"])
         *                  {
         *                      return (int)reader2["LangId"];
         *                  }
         *              }
         *          }
         *      }
         *  }
         *  return languageId;
         * } */
        #endregion

        #region GetUrlByUID
        /// <summary>
        /// Gets the URL by UID.
        /// </summary>
        /// <param name="urlUID">The URL UID.</param>
        /// <param name="pars">The pars.</param>
        /// <returns></returns>
        public static string GetUrlByUID(string urlUID, string pars)
        {
            using (IDataReader reader = FileTreeItem.GetItemById(Convert.ToInt32(urlUID)))
            {
                if (reader.Read())
                {
                    string url = "~" + (string)reader["Outline"] + pars;
                    reader.Close();
                    return(url);
                }

                reader.Close();
            }
            return(string.Empty);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the URL by version id.
        /// </summary>
        /// <param name="versionId">The version id.</param>
        /// <param name="pars">The pars.</param>
        /// <returns></returns>
        public static string GetUrlByVersionId(int versionId, string pars)
        {
            using (IDataReader reader = PageVersion.GetVersionById(versionId))
            {
                if (reader.Read())
                {
                    using (IDataReader reader2 = FileTreeItem.GetItemById((int)reader["PageId"]))
                    {
                        if (reader2.Read())
                        {
                            string url = "~" + (string)reader2["Outline"] + pars;
                            reader2.Close();
                            return(url);
                        }
                    }
                }

                reader.Close();
            }
            return(string.Empty);
        }