⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 article_modify.aspx.cs

📁 易想商城系统
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Shop.Web.UI;

namespace YXShop.Web.Admin.Article
{
    public partial class Article_Modify : System.Web.UI.Page
    {
        public string articleID_Temp = "";
        public string _channelID = "1";
        public string _classID = "0";
        BasePage bp = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!PowerTree.PowerPass.isPass("012001004", PowerTree.PowerPanel.PowerType.update))
            {
                bp = new BasePage();
                bp.PageError("对不起,你没有修改文章的权限!", "../index.aspx");
            }
            if (Request["channelID"] != "")
            {
                this.articleID_Temp = Request["articleId"];
            }
            else
            {
                YXShop.Common.alert.show("参数传递错误!该文章不存在!");
            }
            //控制查询范围为具体的频道及该频道的类别------ 
            if (Request["channelID"] != "")
            {
                this._channelID = Request.QueryString["channelID"];
            }
            if (Request["Class_ID"] != "")
            {
                this._classID = Request.QueryString["Class_ID"];
            }
            //-----------------------------------
           if (!Page.IsPostBack)
            {
                YXShop.Common.WebUtility.WebControlOnblur(title_text);
                YXShop.Common.WebUtility.WebControlOnblur(subtitle_text);
                YXShop.Common.WebUtility.WebControlOnblur(author_text);
                YXShop.Common.WebUtility.WebControlOnblur(artFrom_text);
                YXShop.Common.WebUtility.WebControlOnblur(artUrl_text);
            YXShop.Common.WebUtility.WebControlOnblur(artKeyword_text);
            YXShop.Common.WebUtility.WebControlOnblur(hits_text);
            YXShop.Common.WebUtility.WebControlOnblur(createDate_text);
            YXShop.Common.WebUtility.WebControlOnblur(modiDate_text);
            YXShop.Common.WebUtility.WebControlOnblur(inputerl_text);
            this.classId_droplist.Attributes.Add("onchange", "onChangeVal()");
            this.channelId_droplist.Attributes.Add("onchange", "load(this.options[this.selectedIndex].value)");
            this.hits_text.Attributes.Add("onblur", "isNumber(this.value)");
            this.modiArtBtn.Attributes.Add("onclick", "return checkVal();");
            this.createDate_text.Attributes.Add("onblur", "checkDateTime(this)");
            this.modiDate_text.Attributes.Add("onblur", "checkDateTime(this)");
            BindData(this.articleID_Temp);
            }
        }

        protected void BindData(string articleId)
        {
            try
            {
                YXShop.BLL.YixiangArticle bllArt = new YXShop.BLL.YixiangArticle();
                YXShop.Model.Yixiang_Article bllObj = new YXShop.Model.Yixiang_Article();
                bllObj = bllArt.GetSingleArticleInfo(articleId);
                BindDropDownList_Channel(bllObj.channelID.ToString());

                title_text.Text = bllObj.title.ToString();
                subtitle_text.Text = bllObj.subTitle.ToString();
                author_text.Text = bllObj.author.ToString();
                inputerl_text.Text = bllObj.inputer.ToString();
                artFrom_text.Text = bllObj.copyFrom.ToString();
                artUrl_text.Text = bllObj.linkUrl.ToString();
                artDes_text.Text = bllObj.articleInstr.ToString();
                FCKeditor1.Value = bllObj.content.ToString();
                artKeyword_text.Text = bllObj.keyWord.ToString();
                hits_text.Text = bllObj.hits.ToString();
                createDate_text.Text = bllObj.createTime.ToShortDateString();
                modiDate_text.Text = bllObj.updateTime.ToShortDateString();
                if (bllObj.isPic) { isPic_text.Checked = true; } else { isPic_text.Checked = false; }
                picPath.Text = bllObj.picTitle.ToString();
                if (bllObj.onTop) { isTop_cbox.Checked = true; } else { isTop_cbox.Checked = false; }
                if (bllObj.elite) { isTj_cbox.Checked = true; } else { isTj_cbox.Checked = false; }
                if (bllObj.stateNow == 1) { stateNow_lable.Checked = true; } else { stateNow_lable.Checked = false; }
            }
            catch { }
        }

        #region 绑定频道数据
        public void BindDropDownList_Channel(string _channelId)
        {
            try
            {
                channelId_droplist.DataSource = YXShop.DBUtility.SqlHelper.ExecuteDataSet(YXShop.DBUtility.SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, "SELECT * FROM YX_InforChannel where Putout=1", null);
                channelId_droplist.DataTextField = "YX_Name";
                channelId_droplist.DataValueField = "YX_ID";
                channelId_droplist.DataBind();
          
 
            channelId_droplist.SelectedValue =_channelId;  }
            catch { }
        }
        #endregion

 

        protected void modiArtBtn_Click(object sender, EventArgs e)
        {try{
            
            if (FCKeditor1.Value == "")
            { 
                YXShop.Common.alert.show("请输入文章内容!");
            }
            if (channelId_droplist.SelectedValue != "" && classId_droplistVal.Value != "" && artDes_text.Text != "" && artKeyword_text.Text != "" && FCKeditor1.Value != "")
            {

                //上传缩略图片
                if (isPic_text.Checked)
                {
                    if (!string.IsNullOrEmpty(FileUpload1.FileName.ToString()))
                    {
                        string fileStr = YXShop.DBUtility.UploadFile.UploadPicFile(FileUpload1, "ArtUploadPic", "Art", Convert.ToInt32(YXShop.DBUtility.UploadFile.ArticleMaxSize));
                        if (fileStr.IndexOf("error") == -1)
                        {
                            picPath.Text = fileStr;
                        }
                        else
                        {
                            YXShop.Common.alert.show("上传失败!" + fileStr);
                        }
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(picPath.Text.ToString()))
                        {
                            YXShop.Common.alert.show("你设置该文章为:包含缩略图片,但你当前尚未选择所要上传的图片或直接在 [缩略图片路径]中输入指定图片路径,请检查!");
                        }
                    }

                }
                //----------------

                YXShop.BLL.YixiangArticle bll = new YXShop.BLL.YixiangArticle();
                int result = bll.UpdateArticle(
                    this.articleID_Temp,
                    YXShop.Common.WebUtility.InputText(channelId_droplist.SelectedValue.ToString(), channelId_droplist.SelectedValue.ToString().Length),
                    YXShop.Common.WebUtility.InputText(classId_droplistVal.Value.ToString(), classId_droplistVal.Value.ToString().Length),
                    YXShop.Common.WebUtility.InputText(title_text.Text.ToString(), title_text.Text.ToString().Length),
                    YXShop.Common.WebUtility.InputText(subtitle_text.Text.ToString(), subtitle_text.Text.ToString().Length),
                    YXShop.Common.WebUtility.InputText(author_text.Text.ToString(), author_text.Text.ToString().Length),
                    YXShop.Common.WebUtility.InputText(artFrom_text.Text.ToString(), artFrom_text.Text.ToString().Length),
                    YXShop.Common.WebUtility.InputText(artUrl_text.Text.ToString(), artUrl_text.Text.ToString().Length),
                    YXShop.Common.WebUtility.InputText(inputerl_text.Text.ToString(), inputerl_text.Text.ToString().Length),
                    YXShop.Common.WebUtility.InputText(inputerl_text.Text.ToString(), inputerl_text.Text.ToString().Length),
                    YXShop.Common.WebUtility.InputText(artKeyword_text.Text.ToString(), artKeyword_text.Text.ToString().Length),
                    YXShop.Common.WebUtility.InputText(hits_text.Text.ToString(), hits_text.Text.ToString().Length),
                    YXShop.Common.WebUtility.InputText(artDes_text.Text.ToString(), artDes_text.Text.ToString().Length),
                    YXShop.Common.WebUtility.InputText(createDate_text.Text.ToString(), createDate_text.Text.ToString().Length),
                    YXShop.Common.WebUtility.InputText(modiDate_text.Text.ToString(), modiDate_text.Text.ToString().Length),
                    isTop_cbox.Checked == true ? "1" : "0",
                    isTj_cbox.Checked == true ? "1" : "0",
                    FCKeditor1.Value.ToString(),
                    isPic_text.Checked == true ? "1" : "0", "0", "0",
                    stateNow_lable.Checked == true ? "1" : "0",
                    YXShop.Common.WebUtility.InputText(picPath.Text.ToString(), picPath.Text.ToString().Length)
                    );
                if (result == 1)
                {
                    YXShop.Common.alert.showAndGo("修改文章成功!", "Article_Manage.aspx?Class_ID=" + this._classID + "&channelID=" + this._channelID);
                }
                else
                {
                    YXShop.Common.alert.show("出现异常!修改文章失败!");
                }
           
            }} catch{}
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -