Ejemplo n.º 1
0
        private static AtomEntry ExportStlTagInfo(StlTagInfo stlTagInfo)
        {
            var entry = AtomUtility.GetEmptyEntry();

            AtomUtility.AddDcElement(entry.AdditionalElements, "TagName", stlTagInfo.TagName);
            AtomUtility.AddDcElement(entry.AdditionalElements, "PublishmentSystemID", stlTagInfo.PublishmentSystemID.ToString());
            AtomUtility.AddDcElement(entry.AdditionalElements, "TagDescription", stlTagInfo.TagDescription);
            AtomUtility.AddDcElement(entry.AdditionalElements, "TagContent", stlTagInfo.TagContent);

            return(entry);
        }
Ejemplo n.º 2
0
        public void Update(StlTagInfo info)
        {
            var updateParms = new IDataParameter[]
            {
                GetParameter(ParmTagDescription, EDataType.NVarChar, 255, info.TagDescription),
                GetParameter(ParmTagContent, EDataType.NText, info.TagContent),
                GetParameter(ParmTagName, EDataType.NVarChar, 50, info.TagName),
                GetParameter(ParmPublishmentSystemId, EDataType.Integer, info.PublishmentSystemID)
            };

            ExecuteNonQuery(SqlUpdateStlTag, updateParms);
        }
Ejemplo n.º 3
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            var isChanged = false;

            var stlTagInfo = new StlTagInfo();

            stlTagInfo.TagName             = TagName.Text;
            stlTagInfo.PublishmentSystemID = PublishmentSystemId;
            stlTagInfo.TagDescription      = Description.Text;
            stlTagInfo.TagContent          = Content.Text;

            if (Body.IsQueryExists("TagName"))
            {
                try
                {
                    DataProvider.StlTagDao.Update(stlTagInfo);
                    Body.AddSiteLog(PublishmentSystemId, "修改自定义模板语言", $"模板标签名:{stlTagInfo.TagName}");
                    isChanged = true;
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "自定义模板标签修改失败!");
                }
            }
            else
            {
                var stlTagNameArrayList = DataProvider.StlTagDao.GetStlTagNameArrayList(PublishmentSystemId);
                if (stlTagNameArrayList.IndexOf(TagName.Text) != -1)
                {
                    FailMessage("自定义模板标签添加失败,自定义模板标签名已存在!");
                }
                else
                {
                    try
                    {
                        DataProvider.StlTagDao.Insert(stlTagInfo);
                        Body.AddSiteLog(PublishmentSystemId, "添加自定义模板语言", $"模板标签名:{stlTagInfo.TagName}");
                        isChanged = true;
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "自定义模板标签添加失败!");
                    }
                }
            }

            if (isChanged)
            {
                PageUtils.CloseModalPage(Page);
            }
        }
Ejemplo n.º 4
0
        public ArrayList GetStlTagInfoArrayListByPublishmentSystemId(int publishmentSystemId)
        {
            var arraylist = new ArrayList();

            var parms = new IDataParameter[]
            {
                GetParameter(ParmPublishmentSystemId, EDataType.Integer, publishmentSystemId)
            };

            using (var rdr = ExecuteReader(SqlSelectAllStlTag, parms))
            {
                while (rdr.Read())
                {
                    var i    = 0;
                    var info = new StlTagInfo(GetString(rdr, i++), GetInt(rdr, i++), GetString(rdr, i++), GetString(rdr, i));
                    arraylist.Add(info);
                }
                rdr.Close();
            }
            return(arraylist);
        }
Ejemplo n.º 5
0
        public StlTagInfo GetStlTagInfo(int publishmentSystemId, string tagName)
        {
            StlTagInfo info = null;

            var parms = new IDataParameter[]
            {
                GetParameter(ParmTagName, EDataType.NVarChar, 50, tagName),
                GetParameter(ParmPublishmentSystemId, EDataType.Integer, publishmentSystemId)
            };

            using (var rdr = ExecuteReader(SqlSelectStlTag, parms))
            {
                if (rdr.Read())
                {
                    var i = 0;
                    info = new StlTagInfo(GetString(rdr, i++), GetInt(rdr, i++), GetString(rdr, i++), GetString(rdr, i));
                }
                rdr.Close();
            }

            return(info);
        }
Ejemplo n.º 6
0
        public void ImportStlTag(bool overwrite)
        {
            if (!FileUtils.IsFileExists(_filePath))
            {
                return;
            }
            var feed = AtomFeed.Load(FileUtils.GetFileStreamReadOnly(_filePath));

            foreach (AtomEntry entry in feed.Entries)
            {
                var tagName = ConvertHelper.GetString(AtomUtility.GetDcElementContent(entry.AdditionalElements, "TagName"));

                if (!string.IsNullOrEmpty(tagName))
                {
                    var stlTagInfo = new StlTagInfo
                    {
                        TagName             = tagName,
                        PublishmentSystemID = _publishmentSystemId,
                        TagDescription      = AtomUtility.GetDcElementContent(entry.AdditionalElements, "TagDescription"),
                        TagContent          = AtomUtility.GetDcElementContent(entry.AdditionalElements, "TagContent")
                    };


                    var stlTag = DataProvider.StlTagDao.GetStlTagInfo(_publishmentSystemId, stlTagInfo.TagName);
                    if (stlTag != null)
                    {
                        if (overwrite)
                        {
                            DataProvider.StlTagDao.Update(stlTag);
                        }
                    }
                    else
                    {
                        DataProvider.StlTagDao.Insert(stlTagInfo);
                    }
                }
            }
        }