Beispiel #1
0
        //設定操作
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            //ChkAdminLevel("channel_" + this.channel_name + "_list", TWEnums.ActionEnum.Edit.ToString()); //檢查權限
            int id = Convert.ToInt32(((HiddenField)e.Item.FindControl("hidId")).Value);

            BLL.about   bll   = new BLL.about();
            Model.about model = bll.GetModel(id);
            switch (e.CommandName)
            {
            case "lbtnIsMsg":
                if (model.is_msg == 1)
                {
                    bll.UpdateField(id, "is_msg=0");
                }
                else
                {
                    bll.UpdateField(id, "is_msg=1");
                }
                break;

            case "lbtnIsSlide":
                if (model.is_slide == 1)
                {
                    bll.UpdateField(id, "is_slide=0");
                }
                else
                {
                    bll.UpdateField(id, "is_slide=1");
                }
                break;
            }
            this.RptBind(this.channel_id, this.category_id, "id>0" + CombSqlTxt(this.keywords, this.property, this.status), "sort_id desc,add_time desc,id desc");
        }
Beispiel #2
0
        //批次刪除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevelEdit("site_help", "Edit");
            //ChkAdminLevel("channel_" + this.channel_name + "_list", TWEnums.ActionEnum.Delete.ToString()); //檢查權限
            int sucCount   = 0; //成功數量
            int errorCount = 0; //失敗數量

            BLL.about bll     = new BLL.about();
            Repeater  rptList = new Repeater();

            rptList = this.rptList1;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(TWEnums.ActionEnum.Edit.ToString(), "刪除" + this.channel_name + "頻道內容成功" + sucCount + "條,失敗" + errorCount + "條"); //記錄日誌
            JscriptMsg("刪除成功" + sucCount + "條,失敗" + errorCount + "條!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&status={4}",
                                                                                        this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, this.status));
        }
Beispiel #3
0
        private bool DoAdd()
        {
            bool result = false;

            Model.about model = new Model.about();
            BLL.about   bll   = new BLL.about();

            model.channel_id      = this.channel_id;
            model.category_id     = Utils.StrToInt(ddlCategoryId.SelectedValue, 0);
            model.call_index      = txtCallIndex.Text.Trim();
            model.user_name       = ddlFabu.SelectedValue;
            model.title           = txtTitle.Text.Trim();
            model.link_url        = txtLinkUrl.Text.Trim();
            model.img_url         = txtImgUrl.Text;
            model.seo_title       = txtSeoTitle.Text.Trim();
            model.seo_keywords    = txtSeoKeywords.Text.Trim();
            model.seo_description = txtSeoDescription.Text.Trim();
            //内容摘要提取内容前255个字符
            if (string.IsNullOrEmpty(txtZhaiyao.Text.Trim()))
            {
                model.zhaiyao = Utils.DropHTML(txtContent.Value, 255);
            }
            else
            {
                model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 255);
            }
            model.content = txtContent.Value;
            model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            model.click   = int.Parse(txtClick.Text.Trim());
            model.status  = Utils.StrToInt(rblStatus.SelectedValue, 0);
            model.is_msg  = 0;

            model.is_slide = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_msg = 1;
            }

            if (cblItem.Items[1].Selected == true)
            {
                model.is_slide = 1;
            }
            model.is_sys = 1; //管理员发布

            model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim());
            DateTime _end_time;

            if (DateTime.TryParse(txtEndTime.Text.Trim(), out _end_time))
            {
                model.update_time = _end_time;
            }
            if (bll.Add(model) > 0)
            {
                AddAdminLog(TWEnums.ActionEnum.Add.ToString(), "添加" + this.channel_name + "频道内容:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }
Beispiel #4
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.about   bll   = new BLL.about();
            Model.about model = bll.GetModel(_id);

            model.channel_id      = this.channel_id;
            model.category_id     = Utils.StrToInt(ddlCategoryId.SelectedValue, 0);
            model.call_index      = txtCallIndex.Text.Trim();
            model.title           = txtTitle.Text.Trim();
            model.link_url        = txtLinkUrl.Text.Trim();
            model.img_url         = txtImgUrl.Text;
            model.seo_title       = txtSeoTitle.Text.Trim();
            model.seo_keywords    = txtSeoKeywords.Text.Trim();
            model.seo_description = txtSeoDescription.Text.Trim();
            //內容摘要提取內容前255個字元
            if (string.IsNullOrEmpty(txtZhaiyao.Text.Trim()))
            {
                model.zhaiyao = Utils.DropHTML(txtContent.Value, 255);
            }
            else
            {
                model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 255);
            }
            model.content = txtContent.Value;
            model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            model.click   = int.Parse(txtClick.Text.Trim());
            model.status  = Utils.StrToInt(rblStatus.SelectedValue, 0);
            model.is_msg  = 0;

            model.is_slide = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.is_msg = 1;
            }

            if (cblItem.Items[1].Selected == true)
            {
                model.is_slide = 1;
            }
            model.add_time    = Utils.StrToDateTime(txtAddTime.Text.Trim());
            model.update_time = DateTime.Now;
            if (bll.Update(model))
            {
                AddAdminLog(TWEnums.ActionEnum.Edit.ToString(), "修改" + this.channel_name + "頻道內容:" + model.title); //記錄日誌
                result = true;
            }
            return(result);
        }
Beispiel #5
0
        private void ShowInfo(int _id)
        {
            BLL.about   bll   = new BLL.about();
            Model.about model = bll.GetModel(_id);

            ddlCategoryId.SelectedValue = model.category_id.ToString();
            txtCallIndex.Text           = model.call_index;
            txtTitle.Text   = model.title;
            txtLinkUrl.Text = model.link_url;
            //不是相册图片就绑定
            string filename = model.img_url.Substring(model.img_url.LastIndexOf("/") + 1);

            if (!filename.StartsWith("thumb_"))
            {
                txtImgUrl.Text = model.img_url;
            }
            txtSeoTitle.Text        = model.seo_title;
            txtSeoKeywords.Text     = model.seo_keywords;
            txtSeoDescription.Text  = model.seo_description;
            txtZhaiyao.Text         = model.zhaiyao;
            txtContent.Value        = model.content;
            txtSortId.Text          = model.sort_id.ToString();
            txtClick.Text           = model.click.ToString();
            rblStatus.SelectedValue = model.status.ToString();
            ddlFabu.SelectedValue   = model.user_name;
            if (action == TWEnums.ActionEnum.Edit.ToString())
            {
                txtAddTime.Text = model.add_time.ToString("yyyy-MM-dd");
            }
            if (model.is_msg == 1)
            {
                cblItem.Items[0].Selected = true;
            }

            if (model.is_slide == 1)
            {
                cblItem.Items[1].Selected = true;
            }

            if (model.update_time != null)
            {
                txtEndTime.Text = model.update_time.GetValueOrDefault().ToString("yyyy-M-d");
            }
        }
Beispiel #6
0
        private bool DoAdd()
        {
            bool result = false;

            Model.about model = new Model.about();
            BLL.about   bll   = new BLL.about();
            model.channel_id      = this.channel_id;
            model.category_id     = Utils.StrToInt(ddlCategoryId.SelectedValue, 0);
            model.call_index      = txtCallIndex.Text.Trim();
            model.title           = txtTitle.Text.Trim();
            model.link_url        = txtLinkUrl.Text.Trim();
            model.img_url         = txtImgUrl.Text;
            model.seo_title       = txtSeoTitle.Text.Trim();
            model.seo_keywords    = txtSeoKeywords.Text.Trim();
            model.seo_description = txtSeoDescription.Text.Trim();
            //內容摘要提取內容前255個字元
            if (string.IsNullOrEmpty(txtZhaiyao.Text.Trim()))
            {
                model.zhaiyao = Utils.DropHTML(txtContent.Value, 255);
            }
            else
            {
                model.zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 255);
            }
            model.content = txtContent.Value;
            model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            model.click   = int.Parse(txtClick.Text.Trim());
            model.status  = Utils.StrToInt(rblStatus.SelectedValue, 0);
            model.is_msg  = 0;

            model.is_sys    = 1;                        //管理員發佈
            model.user_name = GetAdminInfo().user_name; //獲得當前登入用戶名
            model.add_time  = Utils.StrToDateTime(txtAddTime.Text.Trim());

            if (bll.Add(model) > 0)
            {
                AddAdminLog(TWEnums.ActionEnum.Add.ToString(), "添加" + this.channel_name + "頻道內容:" + model.title); //記錄日誌
                result = true;
            }
            return(result);
        }
Beispiel #7
0
        //儲存排序
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //ChkAdminLevel("channel_" + this.channel_name + "_list", TWEnums.ActionEnum.Edit.ToString()); //檢查權限
            BLL.about bll     = new BLL.about();
            Repeater  rptList = new Repeater();

            rptList = this.rptList1;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                int sortId;
                if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
                {
                    sortId = 99;
                }
                bll.UpdateField(id, "sort_id=" + sortId.ToString());
            }
            AddAdminLog(TWEnums.ActionEnum.Edit.ToString(), "儲存" + this.channel_name + "頻道內容排序"); //記錄日誌
            JscriptMsg("儲存排序成功!", Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&status={4}",
                                                   this.channel_id.ToString(), this.category_id.ToString(), this.keywords, this.property, this.status));
        }
Beispiel #8
0
        private void RptBind(int _channel_id, int _category_id, string _strWhere, string _orderby)
        {
            this.page = TWRequest.GetQueryInt("page", 1);
            if (this.category_id > 0)
            {
                this.ddlCategoryId.SelectedValue = _category_id.ToString();
            }
            this.ddlProperty.SelectedValue = this.property;
            this.ddlStatus.SelectedValue   = this.status.ToString();
            this.txtKeywords.Text          = this.keywords;
            //圖表或列表顯示
            BLL.about bll = new BLL.about();

            this.rptList1.DataSource = bll.GetList(_channel_id, _category_id, this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList1.DataBind();

            //綁定頁碼
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("list.aspx", "channel_id={0}&category_id={1}&keywords={2}&property={3}&page={4}",
                                              _channel_id.ToString(), _category_id.ToString(), this.keywords, this.property, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }