public int UpdateNewsTab(Tz888.Model.NewsTab newstab, int newsid) { string sql = "Update NewsTab set NTitle=@ntitle ,TypeID=@typeid,recommendID=@recommendID,urlhtml=@urlhtml where Newsid=@Newsid "; SqlParameter[] ps = new SqlParameter[] { new SqlParameter("@ntitle", newstab.NTitle) , new SqlParameter("@typeid", newstab.TypeID) , new SqlParameter("@recommendID", newstab.RecommendID) , new SqlParameter("@urlhtml", newstab.Urlhtml) , new SqlParameter("@Newsid", newsid) }; int result = DBHelpe.ExecuteSql(sql, ps); return(result); }
public int InsertNewsTab(Tz888.Model.NewsTab newstab, Tz888.Model.NewsTypeTab newstypetab, Tz888.Model.NewsViewTab newsviewtab) { int rowsAffected = 0; SqlParameter[] parameters = { new SqlParameter("@TypeID", SqlDbType.Int, 4), new SqlParameter("@UserName", SqlDbType.VarChar, 200), new SqlParameter("@NTitle", SqlDbType.VarChar, 200), new SqlParameter("@audit", SqlDbType.Int, 4), new SqlParameter("@FromID", SqlDbType.Int, 4), new SqlParameter("@urlhtml", SqlDbType.VarChar, 200), new SqlParameter("@createdate", SqlDbType.DateTime), new SqlParameter("@title", SqlDbType.VarChar, 200), new SqlParameter("@keywords", SqlDbType.VarChar, 200), new SqlParameter("@description", SqlDbType.VarChar, 200), new SqlParameter("@NewView", SqlDbType.Text, 10000), new SqlParameter("@form", SqlDbType.VarChar, 2000), new SqlParameter("@author", SqlDbType.VarChar, 200), new SqlParameter("@zhaiyao", SqlDbType.VarChar, 200), new SqlParameter("@recommendID", SqlDbType.Int, 4), new SqlParameter("@ImagesUrls", SqlDbType.NVarChar, 400) }; parameters[0].Value = newstab.TypeID; parameters[1].Value = newstab.UserName; parameters[2].Value = newstab.NTitle; parameters[3].Value = newstab.Audit; parameters[4].Value = newstab.FromID; parameters[5].Value = newstab.Urlhtml; parameters[6].Value = newstab.Createdate; parameters[7].Value = newsviewtab.Title; parameters[8].Value = newsviewtab.Keywords; parameters[9].Value = newsviewtab.Description; parameters[10].Value = newsviewtab.NewView; parameters[11].Value = newsviewtab.Formid; parameters[12].Value = newsviewtab.Author; parameters[13].Value = newsviewtab.Zhaiyao; parameters[14].Value = newstab.RecommendID; parameters[15].Value = newstab.Imagesurls; DBHelper.RunProcedure("NewsTab_InsertList", parameters, out rowsAffected); return(rowsAffected); }
public Tz888.Model.NewsTab GetNewsTabByNewId(int NewId) { string sql = "select * from NewsTab where Newsid=@newid"; Tz888.Model.NewsTab newstab = null; DataSet set = DBHelpe.Query(sql, new SqlParameter("newid", NewId)); foreach (DataRow row in set.Tables[0].Rows) { newstab = new Tz888.Model.NewsTab(); newstab.Newsid = Convert.ToInt32(row["Newsid"]); newstab.NTitle = row["NTitle"].ToString().Trim(); newstab.UserName = row["UserName"].ToString().Trim(); newstab.TypeID = Convert.ToInt32(row["TypeID"]); newstab.Audit = Convert.ToInt32(row["Audit"]); newstab.FromID = Convert.ToInt32(row["FromID"]); newstab.Urlhtml = row["urlhtml"].ToString().Trim(); newstab.Createdate = row["Createdate"].ToString().Trim(); newstab.RecommendID = Convert.ToInt32(row["RecommendID"]); } return(newstab); }
public int InsertNewsTab(Tz888.Model.NewsTab newstab, Tz888.Model.NewsTypeTab newstypetab, Tz888.Model.NewsViewTab newsviewtab) { return(newstabdal.InsertNewsTab(newstab, newstypetab, newsviewtab)); }
public int UpdateNewsTab(Tz888.Model.NewsTab newstab, int newsid) { return(newstabdal.UpdateNewsTab(newstab, newsid)); }
/// <summary> ///创建贷款静态页面 /// </summary> public int StaticHtml(int newsid) { try { string TempFileName = CasesTem.ToString(); string Tem = Compage.Reader(TempFileName); //读取模板内容 string TempSoure = Tem; Tz888.Model.NewsTab newstab = newstabbll.GetNewsTabByNewId(newsid); Tz888.Model.NewsViewTab newsviewtab = newsviewtabbll.GetNewsViewByNewId(newsid); string titlelist = sethtmls(); string context = sethtml(); string tupianss = newstab.Imagesurls; string tupians = ""; string[] num = tupianss.Split('$'); for (int t = 0; t < num.Length; t++) { if (num[t].Trim() != "") { tupians += "<input type=\"image\" id=\"" + num[t].Trim() + "\" src=\"" + tupianlu + "" + num[t].Trim() + "\"/>"; } } string contextname = newsviewtab.NewView.ToString().Replace("/images/", "crm.topfo.com/images/").ToString(); TempSoure = TempSoure.Replace("$infoID$", newsid.ToString().Trim()); TempSoure = TempSoure.Replace("$NewsTitle$", newstab.NTitle.ToString().Trim()); TempSoure = TempSoure.Replace("$Createtime$", newstab.Createdate.Substring(0, 9).Trim()); TempSoure = TempSoure.Replace("$FormId$", newsviewtab.Formid.ToString().Trim()); TempSoure = TempSoure.Replace("$Author$", newsviewtab.Author.ToString().Trim()); TempSoure = TempSoure.Replace("$ZhaiYao$", newsviewtab.Zhaiyao.ToString().Trim()); TempSoure = TempSoure.Replace("$NewsView$", contextname); TempSoure = TempSoure.Replace("$tupian$", tupians); TempSoure = TempSoure.Replace("$TitleList$", titlelist.ToString().Trim()); TempSoure = TempSoure.Replace("$Context$", context.ToString().Trim()); TempSoure = TempSoure.Replace("$DisplayTitle$", newsviewtab.Title.ToString().Trim()); TempSoure = TempSoure.Replace("$KeyWord$", newsviewtab.Keywords.ToString().Trim()); TempSoure = TempSoure.Replace("$description$", newsviewtab.Description.ToString().Trim()); string inPathTo = "/news"; string htmlFile = newstab.Urlhtml.ToString().Trim(); string[] html = htmlFile.Split('/'); string[] nn = html[2].Split('_'); string cc = nn[0].Substring(nn[0].Length - 8); string wenjian = MerchantTmpPathTo + html[1].Replace("news", ""); if (Directory.Exists(wenjian) == false) { Directory.CreateDirectory(wenjian); } string htmlpaths = wenjian + inPathTo + cc + "_" + newsid + ".shtml"; Compage.Writer(htmlpaths, TempSoure); return(1); } catch (Exception e) { return(0); } }