Пример #1
0
        public async Task AddData(Article_Info data, List <PicDTO> bannerpic, List <string> CategoryList, List <string> TagList)
        {
            await _article_InfoBus.AddDataAsync(data, bannerpic, CategoryList, TagList);

            //data.InitEntity();

            //var bannerid = new Data_FileBusiness().AddBannerPic(data.Id, bannerpic);//插入导航图并返回图片id
            //data.ReleaseTime = DateTime.Now;
            //data.LastModifiedTime = data.ReleaseTime;
            //await _article_InfoBus.UpdateDataAsync(data);//修改文章
        }
Пример #2
0
        public async Task SaveData(Article_Info data)
        {
            if (data.Id.IsNullOrEmpty())
            {
                data.InitEntity();

                await _article_InfoBus.AddDataAsync(data);
            }
            else
            {
                await _article_InfoBus.UpdateDataAsync(data);
            }
        }
Пример #3
0
        /// <summary>
        /// 获取指定ID文章实体
        /// </summary>
        /// <param name="ID">文档ID</param>
        public List <Archive> GetArticleInfo(int ID)
        {
            string         strSql   = "SELECT ID,ClassID,C.ClassName,TitleFlag,Title,ShortTitle,TitleStyle,A.ImgUrl,Author,A.Description,Click,Good,Bad,PubDate,Tags,Editor,Source,Templet,A.Keywords,Acontent,A.Readaccess,Money,A.IsComment,IsPaging,FilePath,SimilarArticle FROM {0}Arc_Article A LEFT JOIN {0}Arc_Class C ON classID=C.CID WHERE A.ID={1} AND IsHidden=0 ORDER BY PubDate DESC";
            List <Archive> lst      = new List <Archive>();
            int            _classID = 0;

            using (SqlDataReader dr = dbHelper.ExecuteReader(CommandType.Text, string.Format(strSql, tablePrefix, ID), null))
            {
                if (dr.Read())
                {
                    Article_Info model = new Article_Info();
                    model.ID        = dbHelper.GetInt(dr["ID"]);
                    model.ClassID   = _classID = dbHelper.GetInt(dr["ClassID"]);
                    model.ClassName = dbHelper.GetString(dr["ClassName"]);
                    //model.ClassUrl = dbHelper.GetString(dr["ClassPath"]);
                    model.Title          = dbHelper.GetString(dr["Title"]);
                    model.ShortTitle     = dbHelper.GetString(dr["ShortTitle"]);
                    model.TitleStyle     = dbHelper.GetString(dr["TitleStyle"]);
                    model.TitleFlag      = dbHelper.GetByte(dr["TitleFlag"]);
                    model.Tags           = dbHelper.GetString(dr["Tags"]);
                    model.Keywords       = dbHelper.GetString(dr["Keywords"]);
                    model.Description    = dbHelper.GetString(dr["Description"]);
                    model.Content        = dbHelper.GetString(dr["Acontent"]);
                    model.ImgUrl         = dbHelper.GetString(dr["ImgUrl"]);
                    model.Author         = dbHelper.GetString(dr["Author"]);
                    model.Editor         = dbHelper.GetString(dr["Editor"]);
                    model.Source         = dbHelper.GetString(dr["Source"]);
                    model.Click          = dbHelper.GetInt(dr["Click"]);
                    model.Good           = dbHelper.GetInt(dr["Good"]);
                    model.Bad            = dbHelper.GetInt(dr["Bad"]);
                    model.Url            = dbHelper.GetString(dr["FilePath"]);
                    model.Readaccess     = dbHelper.GetInt16(dr["Readaccess"]);
                    model.Money          = dbHelper.GetInt16(dr["Money"]);
                    model.IsComment      = dbHelper.GetByte(dr["IsComment"]);
                    model.IsPaging       = dbHelper.GetByte(dr["IsPaging"]);
                    model.Templet        = dbHelper.GetString(dr["Templet"]);
                    model.SimilarArticle = dbHelper.GetString(dr["SimilarArticle"]);
                    model.PubDate        = dbHelper.GetDateTime(dr["PubDate"]);

                    lst.Add(model);
                }
            }

            //获取上一篇、下一篇
            strSql = "SELECT TOP 1 ID,Title,FilePath FROM {0}Arc_Article WHERE ClassID={1} AND ID<{2} ORDER BY ID DESC";
            using (SqlDataReader dr = dbHelper.ExecuteReader(CommandType.Text, string.Format(strSql, tablePrefix, _classID, ID), null))
            {
                if (dr.Read())
                {
                    Article_Info model = new Article_Info();
                    model.ID    = dbHelper.GetInt(dr["ID"]);
                    model.Title = dbHelper.GetString(dr["Title"]);
                    model.Url   = dbHelper.GetString(dr["FilePath"]);

                    lst.Add(model);
                }
            }

            strSql = "SELECT TOP 1 ID,Title,FilePath FROM {0}Arc_Article WHERE ClassID={1} AND ID>{2} ORDER BY ID ASC";
            using (SqlDataReader dr = dbHelper.ExecuteReader(CommandType.Text, string.Format(strSql, tablePrefix, _classID, ID), null))
            {
                if (dr.Read())
                {
                    Article_Info model = new Article_Info();
                    model.ID    = dbHelper.GetInt(dr["ID"]);
                    model.Title = dbHelper.GetString(dr["Title"]);
                    model.Url   = dbHelper.GetString(dr["FilePath"]);

                    lst.Add(model);
                }
            }

            return(lst);
        }
Пример #4
0
 public async Task UpdateData(Article_Info data, List <PicDTO> bannerpic, List <string> CategoryList, List <string> TagList)
 {
     await _article_InfoBus.UpdateArticleDataAsync(data, bannerpic, CategoryList, TagList);
 }
Пример #5
0
        public JsonHelp Save(string type, string id, string title, string content, int ReadNum, string userid, string name)
        {
            JsonHelp json = new JsonHelp()
            {
                Status = "n", Msg = "保存失败"
            };
            int intid = 0;

            int.TryParse(id, out intid);
            switch (type)
            {
            case "1":    //编辑新闻
                News_Info entity1 = DB.News_Info.FindEntity(intid);
                if (entity1 != null)
                {
                    entity1.Title        = title;
                    entity1.Comment      = content;
                    entity1.ReadNum      = ReadNum;
                    entity1.LastEditTime = DateTime.Now;
                    if (Update(entity1))
                    {
                        json.Status = "y";
                        json.Msg    = "保存成功";
                        json.ReUrl  = "/Admin_Information/News/Index";
                        //添加操作日志
                        DB.SysLogs.setAdminLog("Edit", "更新标题为[" + entity1.Title + "]的新闻信息");
                    }
                }
                break;

            case "2":    //添加新闻
                News_Info entity2 = new News_Info();
                entity2.Title         = title;
                entity2.Comment       = content;
                entity2.ReadNum       = ReadNum;
                entity2.LastEditTime  = DateTime.Now;
                entity2.CreateEmpId   = userid;
                entity2.CreateEmpName = name;
                if (Insert(entity2))
                {
                    json.Status = "y";
                    json.Msg    = "保存成功";
                    json.ReUrl  = "/Admin_Information/News/Index";
                    //添加操作日志
                    DB.SysLogs.setAdminLog("Add", "新增标题为[" + entity2.Title + "]的新闻信息");
                }
                break;

            case "3":    //公司简介
                Article_Info entity3 = DB.Article_Info.FindEntity(intid);
                if (entity3 != null)
                {
                    entity3.Title        = title;
                    entity3.Comment      = content;
                    entity3.ReadNum      = ReadNum;
                    entity3.LastEditTime = DateTime.Now;
                    if (DB.Article_Info.Update(entity3))
                    {
                        json.Status = "y";
                        json.Msg    = "保存成功";
                        //添加操作日志
                        DB.SysLogs.setAdminLog("Edit", "更新标题为[" + entity3.Title + "]的公司简介");
                    }
                }
                break;

            case "4":    //公司账户
                Article_Info entity4 = DB.Article_Info.FindEntity(intid);
                if (entity4 != null)
                {
                    entity4.Title        = title;
                    entity4.Comment      = content;
                    entity4.ReadNum      = ReadNum;
                    entity4.LastEditTime = DateTime.Now;
                    if (DB.Article_Info.Update(entity4))
                    {
                        json.Status = "y";
                        json.Msg    = "保存成功";
                        //添加操作日志
                        DB.SysLogs.setAdminLog("Edit", "更新标题为[" + entity4.Title + "]的公司简介");
                    }
                }
                break;

            case "5":    //销售方案
                Article_Info entity5 = DB.Article_Info.FindEntity(intid);
                if (entity5 != null)
                {
                    entity5.Title        = title;
                    entity5.Comment      = content;
                    entity5.ReadNum      = ReadNum;
                    entity5.LastEditTime = DateTime.Now;
                    if (DB.Article_Info.Update(entity5))
                    {
                        json.Status = "y";
                        json.Msg    = "保存成功";
                        //添加操作日志
                        DB.SysLogs.setAdminLog("Edit", "更新标题为[" + entity5.Title + "]的公司简介");
                    }
                }
                break;

            default:
                break;
            }
            return(json);
        }