コード例 #1
0
ファイル: PageStatic.cs プロジェクト: 262734254/TopfoManage
        /// <summary>
        ///创建招商静态页面
        /// </summary>
        /// <param name="NewsID">编号</param>
        /// <param name="title">标题</param>
        /// <param name="publishT">时间</param>
        /// <param name="Content">详细内容</param>
        public int StaticHtml(int infoID, string title, string publishT, string AreaName, string Content, string IndustryCarveOutID, string MerchantNameTotal, string validateID, string Idstuny, string IsVip, string KeyWord, string DisplayTitle, string Descript, string pic)
        {
            string Money = "";

            Tz888.BLL.Info.MarchantInfoBLL    bll   = new Tz888.BLL.Info.MarchantInfoBLL();
            Tz888.Model.Info.MerchantSetModel model = bll.GetIntegrityModel(Convert.ToInt64(infoID));

            string Type = model.MerchantInfoModel.CapitalCurrency.ToString().Trim();

            if (Type == "CNY")
            {
                Type = "人民币";
            }
            if (Type == "HKD")
            {
                Type = "港币";
            }
            if (Type == "USD")
            {
                Type = "美元";
            }
            if (model.MainInfoModel.MainPointCount.ToString().Trim() == "0")
            {
                Money = "该资源为免费资源";
            }
            else
            {
                Money = model.MainInfoModel.MainPointCount.ToString().Trim() + "元";
            }
            #region 图片属性
            string Pic1   = "";
            string Pic1_c = "";
            string Pic1_s = "";
            string Pic1_r = "";
            string Pic2   = "";
            string Pic2_c = "";
            string Pic2_s = "";
            string Pic2_r = "";
            string Pic3   = "";
            string Pic3_c = "";
            string Pic3_s = "";
            string Pic3_r = "";
            string Pic4   = "";
            string Pic4_c = "";
            string Pic4_s = "";
            string Pic4_r = "";
            string Pic5   = "";
            string Pic5_c = "";
            string Pic5_s = "";
            string Pic5_r = "";
            string Pic6   = "";
            string Pic6_c = "";
            string Pic6_s = "";
            string Pic6_r = "";
            string p1     = "";
            string p2     = "";
            string p3     = "";
            string p4     = "";
            string p5     = "";
            string p6     = "";

            #endregion
            #region 图片封装
            ArrayList arrListPic = new ArrayList();
            ArrayList arrListDoc = new ArrayList();
            if (model.InfoResourceModels != null)
            {
                foreach (Tz888.Model.Info.InfoResourceModel objModelResource in model.InfoResourceModels)
                {
                    //ResourceType 0:其他文档 1:图片 2:视频
                    if (objModelResource.ResourceType.ToString().Trim() == "1")
                    {
                        string[] arTempPic = new string[2];
                        arTempPic[0] = objModelResource.ResourceAddr.Trim();
                        arTempPic[1] = objModelResource.ResourceName.Trim();
                        arrListPic.Add(arTempPic);
                    }
                    if (objModelResource.ResourceType.ToString().Trim() == "0")
                    {
                        string[] arTempDoc = new string[2];
                        arTempDoc[0] = objModelResource.ResourceAddr.Trim();
                        arTempDoc[1] = objModelResource.ResourceName.Trim();
                        arrListDoc.Add(arTempDoc);
                    }
                }
            }

            if (arrListPic.Count > 0)
            {
                string[] sPicTemp = (string[])arrListPic[0];
                Pic1   = sPicTemp[0];
                Pic1_c = sPicTemp[1];
                //Pic1_s = Common.GetMiniPic(Pic1);
                Pic1_s = Pic1;
                Pic1_r = "<li id=\"tab_tophome_1\" class=\"on\"><a href=" + MerchantPicPath.Trim() + Pic1_s.Trim() + " target=\"_blank\"  onmousemove=\"startIndex=1;setTab('tophome',1,1,'out','on');\" onclick=\"javascript:pgvSendClick({hottag:'KF.SERVICE.INDEX.SOSO_2'});\"><img src=" + MerchantPicPath.Trim() + Pic1_s.Trim() + " class=\"tab_img\" alt=\"4\"/></a></li>";
                p1     = "<div id=\"con_tophome_1\"  ><a href=" + MerchantPicPath.Trim() + Pic1_s.Trim() + " target=\"_blank\"   onclick=\"javascript:pgvSendClick({hottag:'KF.SERVICE.INDEX.STUDY_1'});\"><img  src=" + MerchantPicPath.Trim() + Pic1_s.Trim() + "  alt=\"3\" /></a></div>";
                //Pic1_r = "<li><a href=\"" + MerchantPicPath.Trim() + Pic1_s.Trim() + "\" target=\"_blank\"><img src=\"http://www.topfo.com/V4/img/chakan.jpg\"></a></li>";
            }

            if (arrListPic.Count > 1)
            {
                string[] sPicTemp = (string[])arrListPic[1];
                Pic2   = sPicTemp[0];
                Pic2_c = sPicTemp[1];
                //Pic2_s = Common.GetMiniPic(Pic2);
                Pic2_s = Pic2;
                Pic2_r = "<li id=\"tab_tophome_2\" class=\"out\"><a href=" + MerchantPicPath.Trim() + Pic2_s.Trim() + " target=\"_blank\"   onmousemove=\"startIndex=2;setTab('tophome',2,2,'out','on');\" onclick=\"javascript:pgvSendClick({hottag:'KF.SERVICE.INDEX.SOSO_2'});\"><img src=" + MerchantPicPath.Trim() + Pic2_s.Trim() + " class=\"tab_img\" alt=\"4\"/></a></li>";
                p2     = "<div id=\"con_tophome_2\" class=\"hidecontent\" ><a href=" + MerchantPicPath.Trim() + Pic2_s.Trim() + " target=\"_blank\"   onclick=\"javascript:pgvSendClick({hottag:'KF.SERVICE.INDEX.STUDY_1'});\"><img  src=" + MerchantPicPath.Trim() + Pic2_s.Trim() + "  alt=\"3\" /></a></div>";
            }
            if (arrListPic.Count > 2)
            {
                string[] sPicTemp = (string[])arrListPic[2];
                Pic3   = sPicTemp[0];
                Pic3_c = sPicTemp[1];
                //Pic3_s = Common.GetMiniPic(Pic3);
                Pic3_s = Pic3;
                Pic3_r = "<li id=\"tab_tophome_3\" class=\"out\"><a href=" + MerchantPicPath.Trim() + Pic3_s.Trim() + " target=\"_blank\"   onmousemove=\"startIndex=6;setTab('tophome',3,3,'out','on');\" onclick=\"javascript:pgvSendClick({hottag:'KF.SERVICE.INDEX.SOSO_2'});\"><img src=" + MerchantPicPath.Trim() + Pic3_s.Trim() + " class=\"tab_img\" alt=\"4\"/></a></li>";
                p3     = "<div id=\"con_tophome_3\"  class=\"hidecontent\"><a href=" + MerchantPicPath.Trim() + Pic3_s.Trim() + "  target=\"_blank\"  onclick=\"javascript:pgvSendClick({hottag:'KF.SERVICE.INDEX.STUDY_1'});\"><img  src=" + MerchantPicPath.Trim() + Pic3_s.Trim() + "  alt=\"3\" /></a></div>";
                //Pic3_r = "<li><a href=\"" + MerchantPicPath.Trim() + Pic3_s.Trim() + "\" target=\"_blank\"><img src=\"http://www.topfo.com/V4/img/chakan.jpg\"></a></li>";
            }
            if (arrListPic.Count > 3)
            {
                string[] sPicTemp = (string[])arrListPic[3];
                Pic4   = sPicTemp[0];
                Pic4_c = sPicTemp[1];
                //Pic4_s = Common.GetMiniPic(Pic4);
                Pic4_s = Pic4;
                Pic4_r = "<li id=\"tab_tophome_4\" class=\"out\"><a href=" + MerchantPicPath.Trim() + Pic4_s.Trim() + " target=\"_blank\"  onmousemove=\"startIndex=4;setTab('tophome',4,4,'out','on');\" onclick=\"javascript:pgvSendClick({hottag:'KF.SERVICE.INDEX.SOSO_2'});\"><img src=" + MerchantPicPath.Trim() + Pic4_s.Trim() + " class=\"tab_img\" alt=\"4\"/></a></li>";
                p4     = "<div id=\"con_tophome_4\"  class=\"hidecontent\"><a href=" + MerchantPicPath.Trim() + Pic4_s.Trim() + " target=\"_blank\"   onclick=\"javascript:pgvSendClick({hottag:'KF.SERVICE.INDEX.STUDY_1'});\"><img  src=" + MerchantPicPath.Trim() + Pic4_s.Trim() + "  alt=\"3\" /></a></div>";

                //Pic4_r = "<li><a href=\"" + MerchantPicPath.Trim() + Pic4_s.Trim() + "\" target=\"_blank\"><img src=\"http://www.topfo.com/V4/img/chakan.jpg\"></a></li>";
            }
            if (arrListPic.Count > 4)
            {
                string[] sPicTemp = (string[])arrListPic[4];
                Pic5   = sPicTemp[0];
                Pic5_c = sPicTemp[1];
                //Pic5_s = Common.GetMiniPic(Pic5);
                Pic5_s = Pic5;
                Pic5_r = "<li id=\"tab_tophome_5\" class=\"out\"><a href=" + MerchantPicPath.Trim() + Pic5_s.Trim() + " target=\"_blank\"   onmousemove=\"startIndex=5;setTab('tophome',5,5,'out','on');\" onclick=\"javascript:pgvSendClick({hottag:'KF.SERVICE.INDEX.SOSO_2'});\"><img src=" + MerchantPicPath.Trim() + Pic5_s.Trim() + " class=\"tab_img\" alt=\"4\"/></a></li>";
                p5     = "<div id=\"con_tophome_5\"  class=\"hidecontent\"><a href=" + MerchantPicPath.Trim() + Pic5_s.Trim() + " target=\"_blank\"   onclick=\"javascript:pgvSendClick({hottag:'KF.SERVICE.INDEX.STUDY_1'});\"><img  src=" + MerchantPicPath.Trim() + Pic5_s.Trim() + "  alt=\"3\" /></a></div>";

                //Pic5_r = "<li><a href=\"" + MerchantPicPath.Trim() + Pic5_s.Trim() + "\" target=\"_blank\"><img src=\"http://www.topfo.com/V4/img/chakan.jpg\"></a></li>";
            }
            if (arrListPic.Count > 5)
            {
                string[] sPicTemp = (string[])arrListPic[5];
                Pic6   = sPicTemp[0];
                Pic6_c = sPicTemp[1];
                //Pic6_s = Common.GetMiniPic(Pic6);
                Pic6_s = Pic6;
                Pic6_r = "<li id=\"tab_tophome_6\" class=\"out\"><a href=" + MerchantPicPath.Trim() + Pic6_s.Trim() + " target=\"_blank\"   onmousemove=\"startIndex=6;setTab('tophome',6,6,'out','on');\" onclick=\"javascript:pgvSendClick({hottag:'KF.SERVICE.INDEX.SOSO_2'});\"><img src=" + MerchantPicPath.Trim() + Pic6_s.Trim() + " class=\"tab_img\" alt=\"4\"/></a></li>";
                p6     = "<div id=\"con_tophome_5\"  class=\"hidecontent\"><a href=" + MerchantPicPath.Trim() + Pic6_s.Trim() + " target=\"_blank\"  onclick=\"javascript:pgvSendClick({hottag:'KF.SERVICE.INDEX.STUDY_1'});\"><img  src=" + MerchantPicPath.Trim() + Pic6_s.Trim() + "  alt=\"3\" /></a></div>";

                //Pic6_r = "<li><a href=\"" + MerchantPicPath.Trim() + Pic6_s.Trim() + "\" target=\"_blank\"><img src=\"http://www.topfo.com/V4/img/chakan.jpg\"></a></li>";
            }


            #endregion
            if (pic == "0")
            {
                pic = "面谈";
            }
            else
            {
                pic = pic + "%";
            }
            try
            {
                string TempFileName = Merchant.ToString();
                string Tem          = Compage.Reader(TempFileName); //读取模板内容
                #region 替换模版
                string TempSoure = Tem;
                TempSoure = TempSoure.Replace("$infoID$", Convert.ToString(infoID));
                TempSoure = TempSoure.Replace("$title$", title);                                       //标题
                TempSoure = TempSoure.Replace("$publishT$", publishT);                                 //时间
                TempSoure = TempSoure.Replace("$AreaName$", AreaName);                                 //区域
                TempSoure = TempSoure.Replace("$Content$", Content);                                   //内容
                TempSoure = TempSoure.Replace("$IndustryCarveOutID$", IndustryCarveOutID);             //行业
                TempSoure = TempSoure.Replace("$MerchantNameTotal$", MerchantNameTotal + "万元" + Type); //总投资金额
                TempSoure = TempSoure.Replace("$validateID$", validateID);                             //有效期
                TempSoure = TempSoure.Replace("$XianXi$", Idstuny);                                    //详细信息
                TempSoure = TempSoure.Replace("$Merchant$", IsVip);                                    //设置重大投资
                TempSoure = TempSoure.Replace("$KeyWord$", KeyWord);                                   //网页关键字
                TempSoure = TempSoure.Replace("$Descript$", Descript);                                 //网页描述
                TempSoure = TempSoure.Replace("$DisplayTitle$", DisplayTitle);                         //网页标题
                TempSoure = TempSoure.Replace("$pic$", pic);                                           //关键字
                TempSoure = TempSoure.Replace("#@TmpFeild-Pic1#", Pic1_r);
                TempSoure = TempSoure.Replace("#@TmpFeild-Pic2#", Pic2_r);
                TempSoure = TempSoure.Replace("#@TmpFeild-Pic3#", Pic3_r);
                TempSoure = TempSoure.Replace("#@TmpFeild-Pic4#", Pic4_r);
                TempSoure = TempSoure.Replace("#@TmpFeild-Pic5#", Pic5_r);
                TempSoure = TempSoure.Replace("#@TmpFeild-Pic6#", Pic6_r);
                TempSoure = TempSoure.Replace("#@p1@#", p1);
                TempSoure = TempSoure.Replace("#@p2@#", p2);
                TempSoure = TempSoure.Replace("#@p3@#", p3);
                TempSoure = TempSoure.Replace("#@p4@#", p4);
                TempSoure = TempSoure.Replace("#@p5@#", p5);
                TempSoure = TempSoure.Replace("#@p6@#", p6);
                TempSoure = TempSoure.Replace("$Money$", Money);
                if (arrListPic.Count == 0)
                {
                    string tupian = "display:none";

                    TempSoure = TempSoure.Replace("$tupian$", tupian);
                }
                else
                {
                    string tupian = "display:block";

                    TempSoure = TempSoure.Replace("$tupian$", tupian);
                }



                #endregion
                #region
                string inPathTo = "/Merchant";

                string   sql1     = "select a.HtmlFile from MainInfoTab as a inner join MerchantInfoTab as b on a.InfoID=b.InfoID where a.InfoID=" + infoID + "";
                string   htmlFile = Tz888.DBUtility.DbHelperSQL.GetSingle(sql1).ToString();
                string[] html     = htmlFile.Split('/');
                string[] nn       = html[2].Split('_');
                string   cc       = nn[0].Substring(nn[0].Length - 8);

                string wenjian = MerchantTmpPathTo + html[1].Replace("Merchant", "");
                if (Directory.Exists(wenjian) == false)
                {
                    Directory.CreateDirectory(wenjian);
                }

                string htmlpaths = wenjian + inPathTo + cc + "_" + infoID + ".shtml";
                Compage.Writer(htmlpaths, TempSoure);
                return(1);
            }

            catch (Exception e)
            {
                return(0);
            }
            #endregion
        }
コード例 #2
0
ファイル: PageStatic.cs プロジェクト: 262734254/TopfoManage
        /// <summary>
        /// 通过InfoID获取一个Merchant的信息实体
        /// </summary>
        /// <returns></returns>
        public PageStatic objGetMerchantInfoByInfoID(long InfoID)
        {
            PageStatic page = new PageStatic();

            Tz888.BLL.Info.MarchantInfoBLL    bll   = new Tz888.BLL.Info.MarchantInfoBLL();
            Tz888.Model.Info.MerchantSetModel model = bll.GetIntegrityModel(Convert.ToInt64(InfoID));

            page.Title           = model.MainInfoModel.Title.ToString().Trim();
            page.PublishT        = model.MainInfoModel.publishT.ToShortDateString();
            page.Hit             = Convert.ToString(model.MainInfoModel.Hit);
            page.Content         = model.MerchantInfoModel.ZoneAbout;
            page._auditingStatus = Convert.ToInt32(model.MainInfoModel.AuditingStatus);
            page.AreaName        = "";


            if (model.MerchantInfoModel != null)
            {
                if (!string.IsNullOrEmpty(model.MerchantInfoModel.CountryName))
                {
                    page.AreaName = model.MerchantInfoModel.CountryName.Trim();
                }
                if (!string.IsNullOrEmpty(model.MerchantInfoModel.ProvinceName))
                {
                    page.AreaName += " " + model.MerchantInfoModel.ProvinceName.Trim();
                }
                if (!string.IsNullOrEmpty(model.MerchantInfoModel.CityName))
                {
                    page.AreaName += " " + model.MerchantInfoModel.CityName.Trim();
                }
                if (!string.IsNullOrEmpty(model.MerchantInfoModel.CountyName))
                {
                    page.AreaName += " " + model.MerchantInfoModel.CountyName.Trim();
                }
            }
            //所属于行业
            page.IndustryCarveOutID = " ";
            page.Are = model.MerchantInfoModel.ProvinceID.Trim();
            foreach (string sTempIndustry in model.MerchantInfoModel.IndustryBName)
            {
                page.IndustryCarveOutID = page.IndustryCarveOutID + sTempIndustry.Trim() + " ";
            }
            page.MerchantNameTotal = model.MerchantInfoModel.CapitalTotal.ToString().Trim();//总金额


            if (model.MainInfoModel.ValidateTerm.ToString().Trim() != null)
            {
                string ValidateTerm = "";
                switch (model.MainInfoModel.ValidateTerm.ToString().Trim())
                {
                case "3": ValidateTerm = "3个月"; break;

                case "6": ValidateTerm = "6个月"; break;

                case "36": ValidateTerm = "3年"; break;

                case "60": ValidateTerm = "5年"; break;

                case "12": ValidateTerm = "1年"; break;

                case "14": ValidateTerm = "2年"; break;

                case "24": ValidateTerm = "2年"; break;
                }
                page.ValidateID = ValidateTerm;
            }
            else
            {
                page.ValidateID = "暂无";
            }

            page.Keword         = model.MainInfoModel.KeyWord;
            page.Descript       = model.MainInfoModel.Descript;
            page.DisplayTitles  = model.MainInfoModel.DisplayTitle;
            page.merchanreturns = Convert.ToString(model.MerchantInfoModel.Merchanreturns);



            return(page);
        }