Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
        }