Ejemplo n.º 1
0
        protected string ViewTitle(int _kindId, int _parentId)
        {
            string str = "错误,暂无找到该信息标题!";

            switch (_kindId)
            {
            case (int)Channel.Article:
                DtCms.BLL.Article   abll   = new DtCms.BLL.Article();
                DtCms.Model.Article amodel = abll.GetModel(_parentId);
                if (amodel != null)
                {
                    str = amodel.Title;
                }
                break;

            case (int)Channel.Pictures:
                DtCms.BLL.Pictures   pbll   = new DtCms.BLL.Pictures();
                DtCms.Model.Pictures pmodel = pbll.GetModel(_parentId);
                if (pmodel != null)
                {
                    str = pmodel.Title;
                }
                break;

            case (int)Channel.Downloads:
                DtCms.BLL.Downloads   dbll   = new DtCms.BLL.Downloads();
                DtCms.Model.Downloads dmodel = dbll.GetModel(_parentId);
                if (dmodel != null)
                {
                    str = dmodel.Title;
                }
                break;
            }
            return(str);
        }
Ejemplo n.º 2
0
        //保存
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DtCms.BLL.Article   bll   = new DtCms.BLL.Article();
            DtCms.Model.Article model = bll.GetModel(this.Id);

            model.Title   = txtTitle.Text.Trim();
            model.Author  = txtAuthor.Text.Trim();
            model.Form    = txtForm.Text.Trim();
            model.Keyword = txtKeyword.Text.Trim();
            model.Zhaiyao = Utils.DropHTML(txtZhaiyao.Text, 250);
            model.Daodu   = Utils.DropHTML(txtDaodu.Text, 250);
            model.ClassId = int.Parse(ddlClassId.SelectedValue);
            model.ImgUrl  = txtImgUrl.Text.Trim();
            model.Content = txtContent.Value;
            model.Click   = int.Parse(txtClick.Text.Trim());

            model.IsMsg   = 0;
            model.IsTop   = 0;
            model.IsRed   = 0;
            model.IsHot   = 0;
            model.IsSlide = 0;
            if (cblItem.Items[0].Selected == true)
            {
                model.IsMsg = 1;
            }
            if (cblItem.Items[1].Selected == true)
            {
                model.IsTop = 1;
            }
            if (cblItem.Items[2].Selected == true)
            {
                model.IsRed = 1;
            }
            if (cblItem.Items[3].Selected == true)
            {
                model.IsHot = 1;
            }
            if (cblItem.Items[4].Selected == true)
            {
                model.IsSlide = 1;
            }
            bll.Update(model);
            //保存日志
            SaveLogs("[资讯模块]编辑文章:" + model.Title);
            JscriptPrint("文章编辑成功啦!", "List.aspx", "Success");
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!int.TryParse(Request.Params["id"] as string, out Id))
     {
         Server.Transfer("error.aspx");
         return;
     }
     DtCms.BLL.Article bll = new DtCms.BLL.Article();
     if (!bll.Exists(Id))
     {
         Server.Transfer("error.aspx");
         return;
     }
     model = bll.GetModel(Id);
     //浏览数+1
     bll.UpdateField(this.Id, "Click=Click+1");
 }
Ejemplo n.º 4
0
        //删除
        protected void lbtnDel_Click(object sender, EventArgs e)
        {
            chkLoginLevel("delArticle");
            DtCms.BLL.Article   bll = new DtCms.BLL.Article();
            DtCms.Model.Article model;
            //批量删除
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((Label)rptList.Items[i].FindControl("lb_id")).Text);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("cb_id");
                if (cb.Checked)
                {
                    model = bll.GetModel(id);
                    //删除图片
                    DeleteFile(model.ImgUrl);
                    //保存日志
                    SaveLogs("[资讯模块]删除文章:" + model.Title);
                    //删除记录
                    bll.Delete(kindId, id);
                }
            }

            JscriptPrint("批量删除成功啦!", "List.aspx?" + CombUrlTxt(this.classId, this.keywords, this.property) + "page=0", "Success");
        }
Ejemplo n.º 5
0
        //赋值操作
        private void ShowInfo(int _id)
        {
            DtCms.BLL.Article   bll   = new DtCms.BLL.Article();
            DtCms.Model.Article model = bll.GetModel(_id);

            txtTitle.Text            = model.Title;
            txtAuthor.Text           = model.Author;
            txtForm.Text             = model.Form;
            txtKeyword.Text          = model.Keyword;
            txtZhaiyao.Text          = model.Zhaiyao;
            ddlClassId.SelectedValue = model.ClassId.ToString();
            txtImgUrl.Text           = model.ImgUrl;
            txtDaodu.Text            = model.Daodu;
            txtContent.Value         = model.Content;
            txtClick.Text            = model.Click.ToString();
            if (model.IsMsg == 1)
            {
                cblItem.Items[0].Selected = true;
            }
            if (model.IsTop == 1)
            {
                cblItem.Items[1].Selected = true;
            }
            if (model.IsRed == 1)
            {
                cblItem.Items[2].Selected = true;
            }
            if (model.IsHot == 1)
            {
                cblItem.Items[3].Selected = true;
            }
            if (model.IsSlide == 1)
            {
                cblItem.Items[4].Selected = true;
            }
        }
Ejemplo n.º 6
0
        //设置操作
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int id = Convert.ToInt32(((Label)e.Item.FindControl("lb_id")).Text);

            DtCms.BLL.Article   bll   = new DtCms.BLL.Article();
            DtCms.Model.Article model = bll.GetModel(id);
            switch (e.CommandName.ToLower())
            {
            case "ibtnmsg":
                if (model.IsMsg == 1)
                {
                    bll.UpdateField(id, "IsMsg=0");
                }
                else
                {
                    bll.UpdateField(id, "IsMsg=1");
                }
                break;

            case "ibtntop":
                if (model.IsTop == 1)
                {
                    bll.UpdateField(id, "IsTop=0");
                }
                else
                {
                    bll.UpdateField(id, "IsTop=1");
                }
                break;

            case "ibtnred":
                if (model.IsRed == 1)
                {
                    bll.UpdateField(id, "IsRed=0");
                }
                else
                {
                    bll.UpdateField(id, "IsRed=1");
                }
                break;

            case "ibtnhot":
                if (model.IsHot == 1)
                {
                    bll.UpdateField(id, "IsHot=0");
                }
                else
                {
                    bll.UpdateField(id, "IsHot=1");
                }
                break;

            case "ibtnslide":
                if (model.IsSlide == 1)
                {
                    bll.UpdateField(id, "IsSlide=0");
                }
                else
                {
                    bll.UpdateField(id, "IsSlide=1");
                }
                break;
            }
            RptBind("Id>0" + CombSqlTxt(this.kindId, this.classId, this.keywords, this.property), "AddTime desc");
        }
Ejemplo n.º 7
0
        //保存
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                DtCms.BLL.Article   bll   = new DtCms.BLL.Article();
                DtCms.Model.Article model = bll.GetModel(this.Id);

                //保存用户头像
                if (!string.IsNullOrEmpty(FileUpload1.FileName))
                {
                    if (FileUpload1.PostedFile.ContentLength / 1024 > 100)
                    {
                        JscriptPrint("上传的视频过大,视频文件要低于100MB!", "", "");
                    }
                    else
                    {
                        string ext   = FileUpload1.FileName.Substring(FileUpload1.FileName.LastIndexOf('.'));
                        string spath = @"video/" + DateTime.Now.ToString("yyyyMMddhhmmss") + ext;//相对路径
                        if (ext.ToLower() == ".swf")
                        {
                            FileUpload1.SaveAs(Server.MapPath(spath));
                            model.ImgUrl = spath;
                        }
                        else
                        {
                            JscriptPrint("只支持swf视频文件!", "", "");
                        }
                    }
                }

                model.Title   = txtTitle.Text.Trim();
                model.Author  = txtAuthor.Text.Trim();
                model.Form    = txtForm.Text.Trim();
                model.Keyword = txtKeyword.Text.Trim();
                model.Zhaiyao = StringPlus.DropHTML(txtZhaiyao.Text, 250);
                model.Daodu   = StringPlus.DropHTML(txtDaodu.Text, 250);
                model.ClassId = int.Parse(ddlClassId.SelectedValue);
                model.Content = FCKeditor.Value;
                model.Click   = int.Parse(txtClick.Text.Trim());

                model.IsMsg   = 0;
                model.IsTop   = 0;
                model.IsRed   = 0;
                model.IsHot   = 0;
                model.IsSlide = 0;
                if (cblItem.Items[0].Selected == true)
                {
                    model.IsMsg = 1;
                }
                if (cblItem.Items[1].Selected == true)
                {
                    model.IsTop = 1;
                }
                if (cblItem.Items[2].Selected == true)
                {
                    model.IsRed = 1;
                }
                if (cblItem.Items[3].Selected == true)
                {
                    model.IsHot = 1;
                }
                if (cblItem.Items[4].Selected == true)
                {
                    model.IsSlide = 1;
                }
                bll.Update(model);
                JscriptPrint("编辑成功啦!", "List.aspx", "Success");
            }
            catch (Exception)
            {
                JscriptPrint("视频文件过大!", "", "");
            }
        }