public int StaticHtml(int professionalid) { try { infoModel = infoBll.GetModel(professionalid); linkModel = linkBll.GetModel(professionalid); viewModel = viewBll.GetModel(professionalid); string TempFileName = CasesTem.ToString(); string Tem = Compage.Reader(TempFileName); //读取模板内容 string TempSoure = Tem; string ProviceName = linkBll.GetProvinceNameByCode(viewModel.ProvinceID.ToString()).Trim(); string typeName = typeBll.GetModel(viewModel.typeID).typeName; //服务类别 if (ProviceName.Trim() == "") { ProviceName = "中国"; } string systime = ""; if (viewModel.validityID == 3) { systime = "3个月"; } else if (viewModel.validityID == 6) { systime = "半年"; } else if (viewModel.validityID == 12) { systime = "1年"; } else if (viewModel.validityID == 24) { systime = "2年"; } else if (viewModel.validityID == 36) { systime = "3年"; } else if (viewModel.validityID == 60) { systime = "5年"; } string price = string.Empty; if (infoModel.chargeId == 0) { price = "免费资源"; } else { price = infoModel.price + "元"; } string xiangxi = GetTop3Data(viewModel.ProvinceID.ToString()); string desc = Gettop6Data(); TempSoure = TempSoure.Replace("$ProfessionalID$", infoModel.ProfessionalID.ToString().Trim()); TempSoure = TempSoure.Replace("$title$", infoModel.Titel.ToString().Trim()); TempSoure = TempSoure.Replace("$AreaName$", ProviceName); TempSoure = TempSoure.Replace("$typeName$", typeName); TempSoure = TempSoure.Replace("$publishT$", infoModel.creatgeDate.ToString().Substring(0, 9)); TempSoure = TempSoure.Replace("$validateID$", systime); TempSoure = TempSoure.Replace("$Content1$", viewModel.description.ToString().Trim()); TempSoure = TempSoure.Replace("$KeyWord$", viewModel.keywords.ToString().Trim()); TempSoure = TempSoure.Replace("$DisplayTitle$", viewModel.title.ToString().Trim()); TempSoure = TempSoure.Replace("$charge$", price); TempSoure = TempSoure.Replace("$CompanyName$", linkModel.CompanyName.ToString().Trim()); //TempSoure = TempSoure.Replace("$Info$", xiangxi); TempSoure = TempSoure.Replace("$Content$", xiangxi); TempSoure = TempSoure.Replace("$Content2$", desc); string inPathTo = "/dservice"; if (string.IsNullOrEmpty(infoModel.htmlUrl)) { infoModel.htmlUrl = "dservice/" + DateTime.Now.ToString("yyyyMM") + "/dservice" + DateTime.Now.ToString("yyyyMMdd") + "_" + professionalid + ".shtml"; } string htmlFile = infoModel.htmlUrl.ToString().Trim(); string[] html = htmlFile.Split('/'); string[] nn = html[2].Split('_'); string cc = nn[0].Substring(nn[0].Length - 8); string folder = ProPath + html[1].Replace("dservice", ""); if (Directory.Exists(folder) == false) { Directory.CreateDirectory(folder); } string htmlpaths = folder + inPathTo + cc + "_" + professionalid + ".shtml"; Compage.Writer(htmlpaths, TempSoure); return(1); } catch (Exception) { return(0); } }
public int StaticHtml(int professionalid) { try { infoModel = infoBll.GetModel(professionalid); linkModel = linkBll.GetModel(professionalid); plModel = viewBll.GetModel(professionalid); string TempFileName = CasesTem.ToString(); string Tem = Compage.Reader(TempFileName); //读取模板内容 string TempSoure = Tem; string ProviceName = linkBll.GetProvinceNameByCode(plModel.ProvinceID.ToString()).Trim(); //区域 string typeName = typeBll.GetList("institutionsID=" + plModel.institutionsID).Tables[0].Rows[0]["TypeName"].ToString(); //机构类别 if (ProviceName.Trim() == "") { ProviceName = "中国"; } string price = string.Empty; if (infoModel.chargeId == 0) { price = "免费资源"; } else { price = infoModel.price + "元"; } string xiangxi = GetTop3Data(plModel.ProvinceID.ToString()); string desc = Gettop6Data(); TempSoure = TempSoure.Replace("$ProfessionalID$", infoModel.ProfessionalID.ToString().Trim()); TempSoure = TempSoure.Replace("$title$", infoModel.Titel.ToString().Trim()); TempSoure = TempSoure.Replace("$AreaName$", ProviceName); TempSoure = TempSoure.Replace("$typeName$", typeName); TempSoure = TempSoure.Replace("$Enterprisesize$", plModel.Enterprisesize); //企业规模 TempSoure = TempSoure.Replace("$funds$", plModel.funds); //注册资金 TempSoure = TempSoure.Replace("$CreateTime$", plModel.companydate.ToString("yyyy-MM-dd")); //创建时间 TempSoure = TempSoure.Replace("$turnover$", plModel.turnover); //营业额 TempSoure = TempSoure.Replace("$charge$", price); //资源类型 TempSoure = TempSoure.Replace("$Content1$", plModel.description.ToString()); TempSoure = TempSoure.Replace("$KeyWord$", plModel.keywords.ToString().Trim()); TempSoure = TempSoure.Replace("$DisplayTitle$", plModel.title.ToString().Trim()); //TempSoure = TempSoure.Replace("$CompanyName$", linkModel.CompanyName.ToString().Trim()); TempSoure = TempSoure.Replace("$Content$", xiangxi);//相关项目信息 TempSoure = TempSoure.Replace("$Content2$", desc); string inPathTo = "/dservice"; if (string.IsNullOrEmpty(infoModel.htmlUrl)) { infoModel.htmlUrl = "dservice/" + DateTime.Now.ToString("yyyyMM") + "/dservice" + DateTime.Now.ToString("yyyyMMdd") + "_" + professionalid + ".shtml"; } string htmlFile = infoModel.htmlUrl.ToString().Trim(); string[] html = htmlFile.Split('/'); string[] nn = html[2].Split('_'); string cc = nn[0].Substring(nn[0].Length - 8); string folder = ProPath + html[1].Replace("dservice", ""); if (Directory.Exists(folder) == false) { Directory.CreateDirectory(folder); } string htmlpaths = folder + inPathTo + cc + "_" + professionalid + ".shtml"; Compage.Writer(htmlpaths, TempSoure); return(1); } catch (Exception) { return(0); } }
public int StaticHtml(int professionalid) { try { infoModel = infoBll.GetModel(professionalid); linkModel = linkBll.GetModel(professionalid); plModel = viewBll.GetModel(professionalid); string TempFileName = CasesTem.ToString(); string Tem = Compage.Reader(TempFileName); //读取模板内容 string TempSoure = Tem; string ProviceName = linkBll.GetProvinceNameByCode(plModel.ProvinceID.ToString()).Trim(); //区域 //string typeName = typeBll.GetList("institutionsID=" + plModel.institutionsID).Tables[0].Rows[0]["TypeName"].ToString(); //机构类别 string typeName = talentsType.GetList("typeID=" + plModel.talentsTypeID).Tables[0].Rows[0]["TypeName"].ToString(); //人才类别 string Servicetype = typeBll1.GetModel(int.Parse(plModel.servicetypeID.ToString())).typeName; if (ProviceName.Trim() == "") { ProviceName = "中国"; } string price = string.Empty; if (infoModel.chargeId == 0) { price = "免费资源"; } else { price = infoModel.price + "元"; } string xiangxi = GetTop3Data(plModel.ProvinceID.ToString()); string desc = Gettop6Data(); TempSoure = TempSoure.Replace("$ProfessionalID$", infoModel.ProfessionalID.ToString().Trim()); TempSoure = TempSoure.Replace("$title$", linkModel.UserName.ToString()); TempSoure = TempSoure.Replace("$AreaName$", ProviceName); TempSoure = TempSoure.Replace("$type$", typeName); TempSoure = TempSoure.Replace("$typeName$", Servicetype); TempSoure = TempSoure.Replace("$position$", plModel.position.ToString()); TempSoure = TempSoure.Replace("$resume$ ", plModel.resume.ToString()); TempSoure = TempSoure.Replace("$CreateTime$", plModel.companydate.ToString("yyyy-MM-dd"));//创建时间 TempSoure = TempSoure.Replace("$specialty$", plModel.specialty.ToString()); TempSoure = TempSoure.Replace("$ScuccCase$ ", plModel.ScuccCase.ToString()); TempSoure = TempSoure.Replace("$KeyWord$", plModel.keywords.ToString().Trim()); TempSoure = TempSoure.Replace("$DisplayTitle$", plModel.title.ToString().Trim()); TempSoure = TempSoure.Replace("$image$", "http://www.topfo.com" + plModel.Images.ToString().Trim()); TempSoure = TempSoure.Replace("$CompanyName$", linkModel.CompanyName.ToString().Trim()); TempSoure = TempSoure.Replace("$Content$", xiangxi);//相关项目信息 TempSoure = TempSoure.Replace("$Content2$", desc); string inPathTo = "/dservice"; if (string.IsNullOrEmpty(infoModel.htmlUrl)) { infoModel.htmlUrl = "dservice/" + DateTime.Now.ToString("yyyyMM") + "/dservice" + DateTime.Now.ToString("yyyyMMdd") + "_" + professionalid + ".shtml"; } string htmlFile = infoModel.htmlUrl.ToString().Trim(); string[] html = htmlFile.Split('/'); string[] nn = html[2].Split('_'); string cc = nn[0].Substring(nn[0].Length - 8); string folder = ProPath + html[1].Replace("dservice", ""); if (Directory.Exists(folder) == false) { Directory.CreateDirectory(folder); } string htmlpaths = folder + inPathTo + cc + "_" + professionalid + ".shtml"; Compage.Writer(htmlpaths, TempSoure); return(1); } catch (Exception) { return(0); } }