public int articleadd(CMS_ArticleSSS ss) { int i = 0; List <CMS_User> u = d.CMS_User.Where(a => a.uname == ss.uname).ToList(); foreach (var item in u) { i = item.uid; } CMS_Article s = new CMS_Article() { istop = ss.istop, ahtml = ss.ahtml, author = ss.author, cid = ss.cid, title = ss.title, uid = i, hits = 0, ctime = DateTime.Now, ptime = DateTime.Now, comments = 0 }; return(db.articleadd(s)); }
public int articleadds(CMS_Article art) { art.state = 2; if (art.istop == null) { art.istop = false; } return(db.articleadd(art)); }
public int articleedit(CMS_Article a) { var b = d.CMS_User.Where(c => c.uid == a.uid).ToList(); foreach (var item in b) { } return(db.editArticle(a)); }
/// <summary> /// 添加 /// </summary> /// <param name="art">对象</param> /// <returns>int</returns> public static dynamic Add(CMS_Article art) { try { return(CMS_Article_DAL.Add(art)); } catch (Exception error) { throw error; } }
/// <summary> /// 修改 /// </summary> /// <param name="artFilter">条件对象</param> /// <returns>int</returns> public static dynamic Edit(CMS_Article artFilter) { try { return(CMS_Article_DAL.Edit(artFilter)); } catch (Exception error) { throw error; } }
public ActionResult Edit(CMS_Article art) { try { var count = CMS_Article_BLL.Edit(art); return(Json(count)); } catch (Exception ex) { throw ex; } }
public int UpdArtByAid(CMS_Article a) { var ls = d1.CMS_Article.Find(a.aid); ls.title = a.title; ls.cid = a.cid; ls.hits = a.hits; ls.comments = a.comments; ls.state = a.state; ls.ahtml = a.ahtml; return(d1.SaveChanges()); }
/// <summary> /// 查找文章 /// </summary> /// <param name="artFilter">条件</param> /// <returns>list</returns> public static dynamic Find(CMS_Article artFilter) { try { var list = CMS_Article_DAL.Find(artFilter); return(list); } catch (Exception ex) { throw ex; } }
/// <summary> /// 添加 /// </summary> /// <param name="art">对象</param> /// <returns>int</returns> public static dynamic Add(CMS_Article art) { try { using (CMSDatabase_Model cms = new CMSDatabase_Model()) { cms.CMS_Article.Add(art); var count = cms.SaveChanges(); return(count); } } catch (Exception error) { throw error; } }
/// <summary> /// 修改 /// </summary> /// <param name="artFilter">条件对象</param> /// <returns>int</returns> public static dynamic Edit(CMS_Article artFilter) { try { using (CMSDatabase_Model cms = new CMSDatabase_Model()) { cms.Entry(artFilter).State = System.Data.Entity.EntityState.Modified; var count = cms.SaveChanges(); return(count); } } catch (Exception error) { throw error; } }
protected override void AddTempData(JinianNet.JNTemplate.TemplateContext context) { base.AddTempData(context); List <CMS_Article> liArticle = new List <CMS_Article>(); ArticleDAL dal = new ArticleDAL(); DataSet ds = dal.GetCategoryList(SiteCode, strCatID); foreach (DataRow row in ds.Tables[0].Rows) { CMS_Article model = DataConvert.DataRowToModel <CMS_Article>(row); liArticle.Add(model); } context.TempData["Article_list"] = liArticle; }
public ActionResult Add(CMS_Article art) { try { art.ptime = DateTime.Now; art.ctime = DateTime.Now; art.uid = 1; art.istop = false; art.state = 2; art.hits = 0; art.comments = 0; var count = CMS_Article_BLL.Add(art); return(Json(count, JsonRequestBehavior.AllowGet)); } catch (Exception er) { throw er; } }
protected override bool BeforeLoad() { string strArticleID = string.Empty; if (null == Request.QueryString["id"]) { return(false); } strArticleID = Common.Common.NoHtml(Request.QueryString["id"].ToString()); ArticleDAL dal = new ArticleDAL(); DataSet ds = dal.GetArticleDetail(strArticleID); model = new CMS_Article(); if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { model = DataConvert.DataRowToModel <CMS_Article>(ds.Tables[0].Rows[0]); } SiteCode = model.SiteCode; return(base.BeforeLoad()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strSiteCode = string.Empty; string strCatID = string.Empty; if (null == Request.QueryString["SiteCode"]) { strSiteCode = "VYIGO"; } if (null == Request.QueryString["CatID"]) { strCatID = "VYIGO"; } strSiteCode = Common.Common.NoHtml(Request.QueryString["SiteCode"].ToString()); strCatID = Common.Common.NoHtml(Request.QueryString["CatID"].ToString()); DAL.CMS.ArticleDAL dalCat = new DAL.CMS.ArticleDAL(); DataSet dsArt = dalCat.GetCategoryList(strSiteCode, strCatID); List <CMS_Article> liArtList = new List <CMS_Article>(); if (null != dsArt && dsArt.Tables.Count > 0 && dsArt.Tables[0].Rows.Count > 0) { foreach (DataRow row in dsArt.Tables[0].Rows) { CMS_Article model = DataConvert.DataRowToModel <CMS_Article>(row); liArtList.Add(model); } } string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/helpdoc.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["artList"] = liArtList; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); } }
public int AddArt(CMS_Article u) { if (u.state == 1) { u.ctime = DateTime.Now; u.ptime = null; } else if (u.state == 2) { u.ctime = DateTime.Now; u.ptime = DateTime.Now; } d1.CMS_Article.Add(u); if (d1.SaveChanges() > 0) { return(1); } else { return(0); } }
public ActionResult EditIsTop(int aid) { try { CMS_Article artFilter = new CMS_Article(); artFilter.aid = aid; var list = CMS_Article_BLL.Find(artFilter); if (list[0].istop == false) { list[0].istop = true; } else if (list[0].istop == true) { list[0].istop = false; } var count = CMS_Article_BLL.Edit(list[0]); return(Json(count, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { throw ex; } }
/// <summary> /// 查找文章 /// </summary> /// <param name="artFilter">条件</param> /// <returns>list</returns> public static dynamic Find(CMS_Article artFilter) { using (CMSDatabase_Model cms = new CMSDatabase_Model()) { try { var list = from data in cms.CMS_Article select data; if (artFilter.cid > 0) { list = list.Where(data => data.cid == artFilter.cid).Select(data => data); } if (artFilter.aid > 0) { list = list.Where(data => data.aid == artFilter.aid).Select(data => data); } return(list.ToList()); } catch (Exception error) { throw error; } } }
protected void ShowEditor() { CMS_Article bArt = new CMS_Article(); CMS_Column bCol = new CMS_Column(); Model.CMS_Article mArt = new Model.CMS_Article(); if (CurrentId > 0)//如果是编辑 { mArt = bArt.GetModel(CurrentId); if (mArt.ColumnId != 0) { DoSetting(Convert.ToInt32(mArt.ColumnId), "修改"); } ddlTitCor.Items.FindByValue(mArt.titleColor).Selected = true; ddlTitSty.Items.FindByValue(mArt.titleFont.ToString()).Selected = true; } //tbAuthor.Text = mArt.Author; tbAuthor.Text = CurrentAdmin.Name; if (mArt.IsPic == true) { //显示图片 Image1.Visible = true; Image1.ImageUrl = "~\\userfiles\\" + mArt.PicUrl.Substring(mArt.PicUrl.LastIndexOf("\\") + 1);; } //tbPicUrl.Text = mArt.PicUrl; tbTitle.Text = mArt.Title; FCKeditor1.Value = mArt.Body; //构造SQL语句查询出没有子栏目并且不是跳转网址的栏目 string strSql = "select * from CMS_Column as a where (Len(GotoUrl)=0 or GotoUrl is NULL) and not EXISTS(select b.Id from CMS_Column as b where b.ParentId=a.Id) order by code"; DataTable dt = bCol.CustomGetList(strSql); //光往栏目下拉列表中加入"无"项 ListItem theLi = new ListItem("无", "0"); ddlCol.Items.Add(theLi); //通过循环将数据库中满足条件的栏目包装成带缩进的样子加入栏目的下拉列表 foreach (DataRow dr in dt.Rows) { ListItem li = new ListItem(); li.Text = GetColumnName(dr["Title"].ToString(), dr["Code"].ToString()); li.Value = dr["Id"].ToString(); //若是编辑则将当前栏目选中 if (li.Value == mArt.ColumnId.ToString()) { li.Selected = true; } ddlCol.Items.Add(li); } /*以下是专题的不过没什么用*/ //在视频的第五单元第四课时里 //根据ListItem选项值修改背景颜色 字体粗细 foreach (ListItem lt in ddlTitCor.Items) { lt.Attributes.CssStyle.Add(HtmlTextWriterStyle.BackgroundColor, lt.Value); } ddlTitSty.Items[0].Attributes.CssStyle.Add(HtmlTextWriterStyle.FontStyle, "bold"); ddlTitSty.Items[1].Attributes.CssStyle.Add(HtmlTextWriterStyle.FontWeight, "bold"); ddlTitSty.Items[2].Attributes.CssStyle.Add(HtmlTextWriterStyle.FontStyle, "italic"); ddlTitSty.Items[3].Attributes.CssStyle.Add(HtmlTextWriterStyle.FontWeight, "bold"); ddlTitSty.Items[3].Attributes.CssStyle.Add(HtmlTextWriterStyle.FontStyle, "italic"); }
public int articleadd(CMS_Article art) { db.CMS_Article.Add(art); return(db.SaveChanges()); }
public int editArticle(CMS_Article a) { db.Entry <CMS_Article>(a).State = System.Data.Entity.EntityState.Modified; return(db.SaveChanges()); }