Ejemplo n.º 1
0
        public InnerLinkInfo GetInnerLinkInfo(string innerLinkName, int publishmentSystemId)
        {
            InnerLinkInfo innerLinkInfo = null;

            var sqlString = "SELECT InnerLinkName, PublishmentSystemID, LinkUrl FROM siteserver_InnerLink WHERE InnerLinkName = @InnerLinkName AND PublishmentSystemID = 0";

            if (publishmentSystemId != 0)
            {
                sqlString = "SELECT InnerLinkName, PublishmentSystemID, LinkUrl FROM siteserver_InnerLink WHERE InnerLinkName = @InnerLinkName AND (PublishmentSystemID = 0 OR PublishmentSystemID = @PublishmentSystemID)";
            }
            var selectParms = new IDataParameter[]
            {
                GetParameter(ParmInnerLinkName, EDataType.NVarChar, 255, innerLinkName),
                GetParameter(ParmPublishmentsystemid, EDataType.Integer, publishmentSystemId)
            };

            using (var rdr = ExecuteReader(sqlString, selectParms))
            {
                if (rdr.Read())
                {
                    var i = 0;
                    innerLinkInfo = new InnerLinkInfo(GetString(rdr, i++), GetInt(rdr, i++), GetString(rdr, i));
                }
                rdr.Close();
            }

            return(innerLinkInfo);
        }
Ejemplo n.º 2
0
        public void Update(InnerLinkInfo innerLinkInfo)
        {
            var updateParms = new IDataParameter[]
            {
                GetParameter(ParmLinkUrl, EDataType.VarChar, 200, innerLinkInfo.LinkUrl),
                GetParameter(ParmInnerLinkName, EDataType.NVarChar, 255, innerLinkInfo.InnerLinkName),
                GetParameter(ParmPublishmentsystemid, EDataType.Integer, innerLinkInfo.PublishmentSystemID)
            };

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

            var innerLinkInfo = new InnerLinkInfo();

            innerLinkInfo.InnerLinkName       = InnerLinkName.Text;
            innerLinkInfo.PublishmentSystemID = PublishmentSystemId;
            innerLinkInfo.LinkUrl             = LinkUrl.Text;

            if (Body.IsQueryExists("InnerLinkName"))
            {
                try
                {
                    if (Body.GetQueryString("InnerLinkName") == innerLinkInfo.InnerLinkName)
                    {
                        DataProvider.InnerLinkDao.Update(innerLinkInfo);
                        Body.AddSiteLog(PublishmentSystemId, "修改站内链接", $"站内链接:{innerLinkInfo.InnerLinkName}");
                        isChanged = true;
                    }
                    else
                    {
                        var innerLinkNameList = DataProvider.InnerLinkDao.GetInnerLinkNameList(PublishmentSystemId);
                        if (innerLinkNameList.IndexOf(InnerLinkName.Text) != -1)
                        {
                            FailMessage("站内链接修改失败,站内链接名称已存在!");
                        }
                        else
                        {
                            DataProvider.InnerLinkDao.Delete(Body.GetQueryString("InnerLinkName"), PublishmentSystemId);
                            DataProvider.InnerLinkDao.Insert(innerLinkInfo);
                            Body.AddSiteLog(PublishmentSystemId, "修改站内链接", $"站内链接:{innerLinkInfo.InnerLinkName}");
                            isChanged = true;
                        }
                    }
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "站内链接修改失败!");
                }
            }
            else
            {
                var innerLinkNameList = DataProvider.InnerLinkDao.GetInnerLinkNameList(PublishmentSystemId);
                if (innerLinkNameList.IndexOf(InnerLinkName.Text) != -1)
                {
                    FailMessage("站内链接添加失败,站内链接名称已存在!");
                }
                else
                {
                    try
                    {
                        DataProvider.InnerLinkDao.Insert(innerLinkInfo);
                        Body.AddSiteLog(PublishmentSystemId, "添加站内链接", $"站内链接:{innerLinkInfo.InnerLinkName}");
                        isChanged = true;
                    }
                    catch (Exception ex)
                    {
                        FailMessage(ex, "站内链接添加失败!");
                    }
                }
            }

            if (isChanged)
            {
                PageUtils.CloseModalPage(Page);
            }
        }