Пример #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);
        }
Пример #2
0
        private void RptBind(string strWhere, string orderby)
        {
            if (!int.TryParse(Request.Params["page"] as string, out this.page))
            {
                this.page = 0;
            }
            DtCms.BLL.Article bll = new DtCms.BLL.Article();
            //获得总条数
            this.pcount = bll.GetCount(strWhere);
            if (this.pcount > 0)
            {
                this.lbtnDel.Enabled = true;
            }
            else
            {
                this.lbtnDel.Enabled = false;
            }
            if (this.classId > 0)
            {
                this.ddlClassId.SelectedValue = this.classId.ToString();
            }
            this.txtKeywords.Text          = this.keywords;
            this.ddlProperty.SelectedValue = this.property;

            this.rptList.DataSource = bll.GetPageList(this.pagesize, this.page, strWhere, orderby);
            this.rptList.DataBind();
        }
Пример #3
0
        /// <summary>
        /// 文章调用类(文字)公司动态
        /// </summary>
        /// <param name="top">显示条数</param>
        /// <param name="txtNum">显示字数</param>
        /// <param name="isTime">显示时间</param>
        /// <param name="chrico">显示符号</param>
        /// <param name="where">查询条件</param>
        /// <param name="orderby">排序条件</param>
        /// <returns></returns>
        public static string ViewTxtList_lines(int top, int txtNum, int isTime, string chrico, string strWhere, string orderby)
        {
            DtCms.BLL.Article bll    = new DtCms.BLL.Article();
            StringBuilder     strTxt = new StringBuilder();
            DataSet           ds     = bll.GetList(top, strWhere, orderby);

            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];
                    strTxt.Append("<tr>");
                    if (isTime == 1)
                    {
                        strTxt.Append("<span>[" + string.Format("{yyyy-0:MM-dd}", dr["AddTime"]) + "]</span>");
                    }
                    strTxt.Append(chrico);
                    strTxt.Append("<td width=\"85%\" height=\"28\" align=\"left\" class=\"xuxian-heng\">▪ <a target=\"_blank\" title=\"" + dr["Title"].ToString() + "\" href=\"News_View.aspx?id=" + dr["Id"] + "\">" + StringPlus.CutString(dr["Title"].ToString(), txtNum) + "</a></td>");
                    strTxt.Append("<td width=\"15%\" align=\"center\" class=\"xuxian-heng\">[" + string.Format("{0:d}", dr["AddTime"]) + "]</td>");
                    strTxt.Append("</tr>");
                }
            }
            else
            {
                strTxt.Append("<tr>暂无数据显示...</tr>");
            }
            return(strTxt.ToString());
        }
Пример #4
0
        /// <summary>
        /// 文章调用类(文字)
        /// </summary>
        /// <param name="top">显示条数</param>
        /// <param name="txtNum">显示字数</param>
        /// <param name="isTime">显示时间</param>
        /// <param name="chrico">显示符号</param>
        /// <param name="where">查询条件</param>
        /// <param name="orderby">排序条件</param>
        /// <returns></returns>
        public static string ViewTxtList(int top, int txtNum, int isTime, string chrico, string strWhere, string orderby)
        {
            DtCms.BLL.Article bll    = new DtCms.BLL.Article();
            StringBuilder     strTxt = new StringBuilder();
            DataSet           ds     = bll.GetList(top, strWhere, orderby);

            if (ds.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    DataRow dr = ds.Tables[0].Rows[i];
                    strTxt.Append("<li>");
                    if (isTime == 1)
                    {
                        strTxt.Append("<span>[" + string.Format("{0:MM-dd}", dr["AddTime"]) + "]</span>");
                    }
                    strTxt.Append(chrico);
                    strTxt.Append("<a target=\"_blank\" title=\"" + dr["Title"].ToString() + "\" href=\"News_View.aspx?id=" + dr["Id"] + "\">" + StringPlus.CutString(dr["Title"].ToString(), txtNum) + "</a>");
                    strTxt.Append("</li>");
                }
            }
            else
            {
                strTxt.Append("<li>暂无数据显示...</li>");
            }
            return(strTxt.ToString());
        }
Пример #5
0
        /// <summary>
        /// 返回资讯的ID,用于上一条或下一条链接
        /// </summary>
        protected int GetArticleId(string _where)
        {
            DtCms.BLL.Article bll = new DtCms.BLL.Article();
            DataSet           ds  = bll.GetList(1, _where, "AddTime desc");

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(Convert.ToInt32(ds.Tables[0].Rows[0]["Id"]));
            }
            return(-1);
        }
Пример #6
0
 //删除
 protected void lbtnDel_Click(object sender, EventArgs e)
 {
     chkLoginLevel("delArticle");
     DtCms.BLL.Article bll = new DtCms.BLL.Article();
     //批量删除
     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)
         {
             bll.Delete(id);
         }
     }
     JscriptPrint("批量删除成功啦!", "List.aspx?" + CombUrlTxt(this.classId, this.keywords, this.property) + "page=0", "Success");
 }
Пример #7
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");
 }
Пример #9
0
        /// <summary>
        /// 绑定Repeater控件数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Article_List_DataBind(object sender, EventArgs e)
        {
            Repeater _rpt = sender as Repeater;

            if (_rpt == null)
            {
                return;
            }
            DtCms.BLL.Article bll = new DtCms.BLL.Article();
            //绑定数据
            if (_rpt.PageSize > 0)
            {
                _rpt.DataSource = bll.GetPageList(_rpt.PageSize, _rpt.PageIndex, _rpt.Where, "AddTime desc");
            }
            else
            {
                _rpt.DataSource = bll.GetList(_rpt.Top, _rpt.Where, "AddTime desc");
            }
            _rpt.DataBind();
        }
Пример #10
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");
        }
Пример #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                DataTable dt = DtCms.DBUtility.DbHelperOleDb.Query("select * from Article order by AddTime desc").Tables[0];

                if (dt.Rows.Count > 0)
                {
                    path = dt.Rows[0]["ImgUrl"].ToString();

                    title = dt.Rows[0]["Title"].ToString();
                }

                this.Repeater1.DataSource = dt;
                this.Repeater1.DataBind();

                if (!string.IsNullOrEmpty(Request.QueryString["id"] + ""))
                {
                    DtCms.Model.Article art = new DtCms.BLL.Article().GetModel(int.Parse(Request.QueryString["id"].ToString()));

                    title = art.Title;
                }
            }
        }
Пример #12
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;
            }
        }
Пример #13
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");
        }
Пример #14
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("视频文件过大!", "", "");
            }
        }