public void SaveContent() { string _arttitle = Parameters["parttitle"]; string _titlestyle = Parameters["ptitlestyle"]; string _author = Parameters["pauthor"]; string _comefrom = Parameters["pcomefrom"]; string _releasetime = Parameters["preleasetime"]; string _clicknum = Parameters["pclicknum"]; string _url = Parameters["purl"]; string _picflag = Parameters["ppicflag"]; string _picpath = Parameters["ppicpath"]; string _commentflag = Parameters["pcommentflag"]; string _seotitle = Parameters["pseotitle"]; string _seokeyword = Parameters["pseokeyword"]; string _seodesc = Parameters["pseodesc"]; string _briefcontent = Parameters["pbriefcontent"]; string _content = Parameters["pcontent"]; string _listid = Parameters["plistid"]; PortalArticleBiz biz = new PortalArticleBiz(); PortalArticle item = new PortalArticle(); item.FArticleAuthor = _author; item.FArticleClickNum = Convert.ToInt32(_clicknum); item.FArticleComeFrom = _comefrom; if (string.IsNullOrEmpty(_releasetime)) { item.FArticleTime = DateTime.Now; } else { item.FArticleTime = Convert.ToDateTime(_releasetime); } item.FArticlePic = _picpath; item.FArticlePicFlag = _picflag; item.FArticleStyle = _titlestyle; item.FArticleTitle = _arttitle; item.FArticleUrl = _url; item.FBriefContent = _briefcontent; item.FCommentFlag = _commentflag; item.FContent = _content; item.FSEODescription = _seodesc; item.FSEOKeyWord = _seokeyword; item.FSEOTitle = _seotitle; if (string.IsNullOrEmpty(_listid)) { } else { item.FListId = Convert.ToInt64(_listid); } ErrorEntity ErrInfo = new ErrorEntity(); biz.Insert(item, out ErrInfo); Response.Write(ErrInfo.ToJson()); }
public Int64 Insert(PortalArticle item, out ErrorEntity ErrInfo) { //if (item.FListId == 0) //{ // ErrInfo = new ErrorEntity(RespCode.Pa010001); // return -1; //} if (string.IsNullOrEmpty(item.FArticleTitle)) { ErrInfo = new ErrorEntity(RespCode.Pa010002); return -1; } if (item.FArticlePicFlag == "1") { if (string.IsNullOrEmpty(item.FArticlePic)) { ErrInfo = new ErrorEntity(RespCode.Pa010003); return -1; } } NameValueCollection parameters = new NameValueCollection(); if (item.FListId != 0) { parameters.Add("FListId", item.FListId.ToString()); } parameters.Add("FArticleTitle", item.FArticleTitle); parameters.Add("FArticleStyle", item.FArticleStyle); if (string.IsNullOrEmpty(item.FArticleAuthor)) { item.FArticleAuthor = "佚名"; } parameters.Add("FArticleAuthor", item.FArticleAuthor); if(string.IsNullOrEmpty(item.FArticleComeFrom)) { item.FArticleComeFrom = "未知"; } parameters.Add("FArticleComeFrom", item.FArticleComeFrom); parameters.Add("FArticleTime", item.FArticleTime.ToString()); parameters.Add("FArticleClickNum", item.FArticleClickNum.ToString()); parameters.Add("FArticleUrl", item.FArticleUrl); if (!string.IsNullOrEmpty(item.FArticlePic)) { parameters.Add("FArticlePic", item.FArticlePic); } parameters.Add("FArticlePicFlag", item.FArticlePicFlag); if (!string.IsNullOrEmpty(item.FSEOTitle)) { parameters.Add("FSEOTitle", item.FSEOTitle); } if (!string.IsNullOrEmpty(item.FSEOKeyWord)) { parameters.Add("FSEOKeyWord", item.FSEOKeyWord); } if (!string.IsNullOrEmpty(item.FSEODescription)) { parameters.Add("FSEODescription", item.FSEODescription); } parameters.Add("FCommentFlag", item.FCommentFlag); parameters.Add("FBriefContent", item.FBriefContent); parameters.Add("FContent", item.FContent); return Insert(parameters, out ErrInfo); }
protected void Page_Load(object sender, EventArgs e) { string FArtId = Parameters["id"]; sartid = FArtId; PortalArticle item = new PortalArticle(); PortalArticleBiz biz = new PortalArticleBiz(); item = biz.Select(FArtId); if (item != null) { sarttitle = item.FArticleTitle; if (item.FListId != 0) { sartlistid = item.FListId.ToString(); } spicpath = item.FArticlePic; sarticlecontent = item.FContent; sseotitle = item.FSEOTitle; sseokeyword = item.FSEOKeyWord; sseodesc = item.FSEODescription; stitlestyle = item.FArticleStyle; sauthor = item.FArticleAuthor; scomefrom = item.FArticleComeFrom; sreleasetime = item.FArticleTimeStr; sclicknum = item.FArticleClickNum.ToString(); surl = item.FArticleUrl; picflag = item.FArticlePicFlag; scommentflag = item.FCommentFlag; sbriefcontent = item.FBriefContent; } }