Exemplo n.º 1
0
        public object GetValue(string attributeName)
        {
            foreach (var name in AllAttributes)
            {
                if (StringUtils.EqualsIgnoreCase(name, attributeName))
                {
                    var nameVlaue = GetType().GetProperty(name).GetValue(this, null);

                    if (attributeName == "ResourceType")
                    {
                        return(EResourceTypeUtils.GetEnumType(nameVlaue.ToString()));
                    }

                    return(nameVlaue);
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        public List <KeywordResourceInfo> GetKeywordResourceInfoList(int publishmentSystemId, int keywordId)
        {
            var list = new List <KeywordResourceInfo>();

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

            using (var rdr = ExecuteReader(SqlSelectAll, parms))
            {
                while (rdr.Read())
                {
                    var resourceInfo = new KeywordResourceInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetInt32(2), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), EResourceTypeUtils.GetEnumType(rdr.GetValue(6).ToString()), TranslateUtils.ToBool(rdr.GetValue(7).ToString()), rdr.GetValue(8).ToString(), rdr.GetValue(9).ToString(), rdr.GetInt32(10), rdr.GetInt32(11), rdr.GetInt32(12));
                    list.Add(resourceInfo);
                }
                rdr.Close();
            }

            return(list);
        }
Exemplo n.º 3
0
        public KeywordResourceInfo GetFirstResourceInfo(int keywordId)
        {
            KeywordResourceInfo resourceInfo = null;

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

            using (var rdr = ExecuteReader(SqlSelectFirst, parms))
            {
                if (rdr.Read())
                {
                    resourceInfo = new KeywordResourceInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetInt32(2), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), EResourceTypeUtils.GetEnumType(rdr.GetValue(6).ToString()), TranslateUtils.ToBool(rdr.GetValue(7).ToString()), rdr.GetValue(8).ToString(), rdr.GetValue(9).ToString(), rdr.GetInt32(10), rdr.GetInt32(11), rdr.GetInt32(12));
                }
                rdr.Close();
            }

            return(resourceInfo);
        }
Exemplo n.º 4
0
        public List <KeywordResourceInfo> GetKeywordResourceInfoList(int publishmentSystemID, int keywordID)
        {
            var list = new List <KeywordResourceInfo>();

            var parms = new IDataParameter[]
            {
                GetParameter(PARM_PUBLISHMENT_SYSTEM_ID, EDataType.Integer, publishmentSystemID),
                GetParameter(PARM_KEYWORD_ID, EDataType.Integer, keywordID)
            };

            using (var rdr = ExecuteReader(SQL_SELECT_ALL, parms))
            {
                while (rdr.Read())
                {
                    var resourceInfo = new KeywordResourceInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetInt32(2), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), EResourceTypeUtils.GetEnumType(rdr.GetValue(6).ToString()), TranslateUtils.ToBool(rdr.GetValue(7).ToString()), rdr.GetValue(8).ToString(), rdr.GetValue(9).ToString(), rdr.GetInt32(10), rdr.GetInt32(11), rdr.GetInt32(12));
                    list.Add(resourceInfo);
                }
                rdr.Close();
            }

            return(list);
        }
Exemplo n.º 5
0
        public KeywordResourceInfo GetResourceInfo(int resourceID)
        {
            KeywordResourceInfo resourceInfo = null;

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

            using (var rdr = ExecuteReader(SQL_SELECT, parms))
            {
                if (rdr.Read())
                {
                    resourceInfo = new KeywordResourceInfo(rdr.GetInt32(0), rdr.GetInt32(1), rdr.GetInt32(2), rdr.GetValue(3).ToString(), rdr.GetValue(4).ToString(), rdr.GetValue(5).ToString(), EResourceTypeUtils.GetEnumType(rdr.GetValue(6).ToString()), TranslateUtils.ToBool(rdr.GetValue(7).ToString()), rdr.GetValue(8).ToString(), rdr.GetValue(9).ToString(), rdr.GetInt32(10), rdr.GetInt32(11), rdr.GetInt32(12));
                }
                rdr.Close();
            }

            return(resourceInfo);
        }
Exemplo n.º 6
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                try
                {
                    var resourceInfo = new KeywordResourceInfo();
                    resourceInfo.PublishmentSystemID = PublishmentSystemID;
                    resourceInfo.KeywordID           = keywordID;

                    if (resourceID > 0)
                    {
                        resourceInfo = DataProviderWX.KeywordResourceDAO.GetResourceInfo(resourceID);
                    }

                    resourceInfo.Title          = tbTitle.Text;
                    resourceInfo.Taxis          = Convert.ToInt32(tbTaxis.Text);
                    resourceInfo.ResourceType   = EResourceTypeUtils.GetEnumType(Request.Form["resourceType"]);
                    resourceInfo.ImageUrl       = Request.Form["imageUrl"];
                    resourceInfo.Summary        = tbSummary.Text;
                    resourceInfo.IsShowCoverPic = TranslateUtils.ToBool(Request.Form["isShowCoverPic"]);
                    resourceInfo.Content        = breContent.Text;
                    resourceInfo.NavigationUrl  = tbNavigationUrl.Text;
                    resourceInfo.ChannelID      = TranslateUtils.ToInt(Request.Form["channelID"]);
                    resourceInfo.ContentID      = TranslateUtils.ToInt(Request.Form["contentID"]);

                    var isError = false;

                    if (resourceInfo.ResourceType == EResourceType.Site)
                    {
                        if (resourceInfo.ChannelID == 0)
                        {
                            FailMessage("图文回复保存失败,请选择需要显示的微网站页面!");
                            ltlScript.Text +=
                                $@"<script>$('.nav a.{EResourceTypeUtils.GetValue(EResourceType.Site)}').click();</script>";
                            isError = true;
                        }
                    }
                    else if (resourceInfo.ResourceType == EResourceType.Url)
                    {
                        if (string.IsNullOrEmpty(resourceInfo.NavigationUrl))
                        {
                            FailMessage("图文回复保存失败,请填写需要链接的网址!");
                            ltlScript.Text +=
                                $@"<script>$('.nav a.{EResourceTypeUtils.GetValue(EResourceType.Url)}').click();</script>";
                            isError = true;
                        }
                    }

                    if (!isError)
                    {
                        if (resourceID > 0)
                        {
                            DataProviderWX.KeywordResourceDAO.Update(resourceInfo);

                            StringUtility.AddLog(PublishmentSystemID, "修改关键词图文回复");
                            SuccessMessage("关键词图文回复修改成功!");
                        }
                        else
                        {
                            resourceID = DataProviderWX.KeywordResourceDAO.Insert(resourceInfo);

                            StringUtility.AddLog(PublishmentSystemID, "新增关键词图文回复");
                            SuccessMessage("关键词图文回复新增成功!");
                        }

                        FileUtilityWX.CreateWeiXinContent(PublishmentSystemInfo, keywordID, resourceID);

                        var redirectUrl = BackgroundKeywordNewsAdd.GetRedirectUrl(PublishmentSystemID, keywordID, resourceID, isSingle);
                        ltlScript.Text +=
                            $@"<script>setTimeout(""parent.redirect('{redirectUrl}')"", 1500);</script>";
                    }
                }
                catch (Exception ex)
                {
                    FailMessage(ex, "关键词图文回复配置失败!");
                }
            }
        }