Ejemplo n.º 1
0
        /// <summary>
        /// 创建静态页面
        /// </summary>
        /// <param name="InfoIDArr">需要更新的信息ID列表</param>
        /// <param name="IsLog">是否需要将信息写入日志</param>
        /// <param name="UpdateMsg">处理的日志</param>
        /// <returns></returns>
        public bool CreateStaticPageVideo(string InfoID, string HtmlUrlStr, Tz888.Model.TPVideo TheVideo, ref string UpdateMsg)
        {
            System.Text.StringBuilder sbUpdateMsg = new System.Text.StringBuilder();
            try
            {
                #region 变量定义

                string ApplicationRootPath = ConfigurationManager.AppSettings["ApplicationRootPath"].ToString(); ////系统路径,静态页面的根目录
                string TempVideoPath       = ConfigurationManager.AppSettings["VideoTmpPath"].ToString();        ////模板路径,融资模板的存放位置
                string TempVideoPathTo     = ConfigurationManager.AppSettings["VideoTmpPathTo"].ToString();      ////目标路径,融资模板的存放位置
                string ImageDomain         = ConfigurationManager.AppSettings["ImageDomain"].ToString();         //图片域名
                //Tz888.Model.TPVideo TheVideo = new Tz888.Model.TPVideo();

                string   AuditingRemark = "";
                int      AuditingStatus = 0;
                string   Author         = "";
                string   CityID         = "";
                string   Content        = "";
                string   CountyID       = "";
                string   Createby       = "";
                DateTime Created        = new DateTime();
                string   Descript       = "";
                long     Hit            = 0;
                string   HtmlURL        = "";
                string   InfoCode       = "";
                long     infoID         = 0;
                string   infotypeID     = "";
                int      IsCore         = 0;
                int      IsRedirect     = 0;
                string   KeyWord        = "";
                string   LoginName      = "";
                string   MiniatureUrl   = "";
                string   Origin         = "";
                string   ProvinceID     = "";
                DateTime publishT       = new DateTime();
                string   RedirectUrl    = "";
                string   strRemark      = "";
                string   subTitle       = "";
                string   Summary        = "";
                string   Title          = "";

                #endregion

                //TheVideo = this.objGetVideoInfoByInfoID(long.Parse(InfoID.Trim()));

                #region 获取模板名称与读取模板内容
                string TempName = VideoTempFeeFileName;     //获取模板名称

                //读取模板内容
                StreamReader srSource;
                string       TmpFileName;
                TmpFileName = ApplicationRootPath + TempVideoPath + TempName;
                string TmpSource = "";
                srSource = null;
                try
                {
                    srSource = new StreamReader(TmpFileName, System.Text.Encoding.GetEncoding("GB2312"));
                }
                catch (Exception e)
                {
                    sbUpdateMsg.Append("[E]模板读取出错:" + e.Message + "<br>");
                    UpdateMsg = sbUpdateMsg.ToString();
                    return(false);
                }
                try
                {
                    TmpSource = srSource.ReadToEnd();
                }
                catch (Exception e)
                {
                    sbUpdateMsg.Append("[E]模板读取出错:" + e.Message + "<br>");
                    UpdateMsg = sbUpdateMsg.ToString();
                    return(false);
                }
                finally
                {
                    srSource.Close();
                }
                #endregion

                #region 变量赋值
                AuditingRemark = TheVideo.AuditingRemark;
                AuditingStatus = TheVideo.AuditingStatus;
                Author         = TheVideo.Author;
                CityID         = TheVideo.CityID;
                Content        = TheVideo.Content;
                CountyID       = TheVideo.CountyID;
                Createby       = TheVideo.Createby;
                Created        = TheVideo.Created;
                Descript       = TheVideo.Descript;
                Hit            = TheVideo.Hit;
                HtmlURL        = TheVideo.HtmlURL;
                InfoCode       = TheVideo.InfoCode;
                infoID         = TheVideo.infoID;
                infotypeID     = TheVideo.infotypeID;
                IsCore         = TheVideo.IsCore;
                IsRedirect     = TheVideo.IsRedirect;
                KeyWord        = TheVideo.KeyWord;
                LoginName      = TheVideo.LoginName;
                MiniatureUrl   = TheVideo.MiniatureUrl;
                Origin         = TheVideo.Origin;
                ProvinceID     = TheVideo.ProvinceID;
                publishT       = TheVideo.publishT;
                RedirectUrl    = TheVideo.RedirectUrl;
                strRemark      = TheVideo.strRemark;
                subTitle       = TheVideo.subTitle;
                Summary        = TheVideo.Summary;
                Title          = TheVideo.Title;
                #endregion

                #region 错误判断
                if (TheVideo == null || TheVideo.infoID <= 0)
                {
                    sbUpdateMsg.Append("[E]没有找到该信息" + InfoID + "<br>");
                    UpdateMsg = sbUpdateMsg.ToString();
                    return(false);
                }

                Tz888.BLL.Register.LoginInfoBLL logionInfoBLL = new Tz888.BLL.Register.LoginInfoBLL();
                if (AuditingStatus != 1)
                {
                    sbUpdateMsg.Append("[E]信息未通过审核,不允许生成静态文件!<br>");
                    UpdateMsg = sbUpdateMsg.ToString();
                    return(false);
                }
                #endregion

                #region 替换免费的模板
                string       TmpTmpSource = "";
                string       OutPutFilePath; //输出路径
                StreamWriter swOutPut;
                long         HaveDoneCount = 0;

                if (TempName.Trim() == VideoTempFeeFileName)//免费的模板
                {
                    TmpTmpSource = TmpSource;
                    TmpTmpSource = TmpTmpSource.Replace("#@TmpPageFeild-DisplayTitle#", Title);
                    TmpTmpSource = TmpTmpSource.Replace("#@TmpPageFeild-Descript#", Descript);
                    TmpTmpSource = TmpTmpSource.Replace("#@TmpPageFeild-KeyWords#", KeyWord);
                    TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-Title#", Title);
                    TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-InfoID#", InfoID);
                    TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-AreaName#", "中国" + " " + getAddrNameById(ProvinceID, CityID, CountyID));
                    TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-KeyWord#", KeyWord);
                    TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-ValidatePeriod#", "不限");
                    TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-PublisLoginName#", publishT.ToString());
                    TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-ChangeOrFree#", "");
                    TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-VideoUrl#", ImageDomain + HtmlURL);
                    TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-Content#", Content);
                    TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-PublishT#", Created.ToShortDateString());
                }
                #endregion

                #region 输出文件
                OutPutFilePath = ApplicationRootPath + TempVideoPathTo.Trim() + HtmlUrlStr;

                //检查路径是否正确
                if (!Common.BulidFolder(OutPutFilePath, true))
                {
                    sbUpdateMsg.Append("[E]路径" + OutPutFilePath + "不正确!资源类型:Video<br>");
                    UpdateMsg = sbUpdateMsg.ToString();
                    return(false);
                }
                swOutPut = null;
                try
                {
                    swOutPut = new StreamWriter(OutPutFilePath, false, System.Text.Encoding.GetEncoding("GB2312"));
                }
                catch (Exception e)
                {
                    sbUpdateMsg.Append("[E]信息静态化[ " + InfoID.ToString() + " ]" + e.Message + "<br>");
                    UpdateMsg = sbUpdateMsg.ToString();
                    return(false);
                }

                try
                {
                    swOutPut.Write(TmpTmpSource);
                    swOutPut.Flush();
                    sbUpdateMsg.Append("[i]信息静态化[ " + InfoID.ToString() + " ]生成成功<br>");
                }
                catch (Exception e)
                {
                    sbUpdateMsg.Append("[E]信息静态化[ " + InfoID.ToString() + " ]" + e.Message + "<br>");
                    UpdateMsg = sbUpdateMsg.ToString();
                    return(false);
                }
                finally
                {
                    swOutPut.Close();
                }
                HaveDoneCount++;
                #endregion

                UpdateMsg = sbUpdateMsg.ToString();
                return(true);
            }
            catch (Exception e)
            {
                string err = e.Message.ToString().Trim();
                sbUpdateMsg.Append(err);
                UpdateMsg = sbUpdateMsg.ToString();
                return(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 ///  更新视频信息
 /// </summary>
 public bool UpdateVideoMess(Tz888.Model.TPVideo model)
 {
     try
     {
         SqlParameter[] parameters =
         {
             new SqlParameter("@infoID",         SqlDbType.BigInt,     8),
             new SqlParameter("@Title",          SqlDbType.VarChar,  100),
             new SqlParameter("@infoCode",       SqlDbType.Char,      30),
             new SqlParameter("@infotypeID",     SqlDbType.Char,      10),
             new SqlParameter("@subTitle",       SqlDbType.VarChar,  100),
             new SqlParameter("@HtmlURL",        SqlDbType.VarChar,  100),
             new SqlParameter("@Origin",         SqlDbType.VarChar,  100),
             new SqlParameter("@Author",         SqlDbType.VarChar,   20),
             new SqlParameter("@RedirectUrl",    SqlDbType.VarChar,  100),
             new SqlParameter("@IsRedirect",     SqlDbType.Bit),
             new SqlParameter("@Summary",        SqlDbType.Text),
             new SqlParameter("@Content",        SqlDbType.Text),
             new SqlParameter("@Created",        SqlDbType.DateTime,   8),
             new SqlParameter("@Createby",       SqlDbType.VarChar,   16),
             new SqlParameter("@ProvinceID",     SqlDbType.Char,      10),
             new SqlParameter("@CityID",         SqlDbType.Char,      10),
             new SqlParameter("@CountyID",       SqlDbType.Char,      10),
             new SqlParameter("@Remark",         SqlDbType.NVarChar, 400),
             new SqlParameter("@loginname",      SqlDbType.VarChar,   16),
             new SqlParameter("@KeyWord",        SqlDbType.VarChar,   50),
             new SqlParameter("@publishT",       SqlDbType.DateTime,   8),
             new SqlParameter("@Hit",            SqlDbType.BigInt,     8),
             new SqlParameter("@IsCore",         SqlDbType.Bit,        1),
             new SqlParameter("@Descript",       SqlDbType.VarChar,  100),
             new SqlParameter("@AuditingStatus", SqlDbType.TinyInt,    1),
             new SqlParameter("@MiniatureUrl",   SqlDbType.VarChar,  100),
             new SqlParameter("@AuditingRemark", SqlDbType.VarChar, 100)
         };
         parameters[0].Value  = model.infoID;
         parameters[1].Value  = model.Title;
         parameters[2].Value  = model.InfoCode;
         parameters[3].Value  = model.infotypeID;
         parameters[4].Value  = model.subTitle;
         parameters[5].Value  = model.HtmlURL;
         parameters[6].Value  = model.Origin;
         parameters[7].Value  = model.Author;
         parameters[8].Value  = model.RedirectUrl;
         parameters[9].Value  = model.IsRedirect;
         parameters[10].Value = model.Summary;
         parameters[11].Value = model.Content;
         parameters[12].Value = model.Created;
         parameters[13].Value = model.Createby;
         parameters[14].Value = model.ProvinceID;
         parameters[15].Value = model.CityID;
         parameters[16].Value = model.CountyID;
         parameters[17].Value = model.strRemark;
         parameters[18].Value = model.LoginName;
         parameters[19].Value = model.KeyWord;
         parameters[20].Value = model.publishT;
         parameters[21].Value = model.Hit;
         parameters[22].Value = model.IsCore;
         parameters[23].Value = model.Descript;
         parameters[24].Value = model.AuditingStatus;
         parameters[25].Value = model.MiniatureUrl;
         parameters[26].Value = model.AuditingRemark;
         SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "VideoInfotab_Update_Manage", parameters);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 通过InfoID获取一个Merchant的信息实体
 /// </summary>
 /// <returns></returns>
 public Tz888.Model.TPVideo objGetVideoInfoByInfoID(long InfoID)
 {
     Tz888.Model.TPVideo theTpVideo = new Tz888.Model.TPVideo();
     theTpVideo = dal.GetVideoModelByID(InfoID);
     return(theTpVideo);
 }
Ejemplo n.º 4
0
        ///<summary>
        ///获取对象,获取地址
        ///design by ww
        ///2009-05-06
        ///</summary>
        public Tz888.Model.TPVideo GetVideoModelByID(long InfoID)
        {
            Tz888.Model.TPVideo tpVideo = new Tz888.Model.TPVideo();
            string  strsql = "select * from VideoInfoVIW where InfoID=" + InfoID.ToString();
            DataSet ds     = DBUtility.DbHelperSQL.Query(strsql);

            if (ds != null && ds.Tables != null && ds.Tables.Count > 0 && ds.Tables[0] != null)
            {
                Common.ZoneSelectDAL zone = new Tz888.SQLServerDAL.Common.ZoneSelectDAL();
                tpVideo.AuditingRemark = ds.Tables[0].Rows[0]["AuditingRemark"].ToString();
                tpVideo.AuditingStatus = Convert.ToInt32(ds.Tables[0].Rows[0]["AuditingStatus"].ToString());
                tpVideo.Author         = ds.Tables[0].Rows[0]["Author"].ToString();
                if (tpVideo.CityID.Trim() == "")
                {
                    tpVideo.CityID = "";
                }
                else
                {
                    tpVideo.CityID = zone.GetCityNameByCode(ds.Tables[0].Rows[0]["CityID"].ToString());
                }
                tpVideo.Content = ds.Tables[0].Rows[0]["Content"].ToString();
                if (tpVideo.CountyID.Trim() == "")
                {
                    tpVideo.CountyID = "";
                }
                else
                {
                    tpVideo.CountyID = zone.GetCountyNameByCode(ds.Tables[0].Rows[0]["CountyID"].ToString());
                }
                tpVideo.Createby     = ds.Tables[0].Rows[0]["Createby"].ToString();
                tpVideo.Created      = Convert.ToDateTime(ds.Tables[0].Rows[0]["Created"].ToString());
                tpVideo.Descript     = ds.Tables[0].Rows[0]["Summary"].ToString();
                tpVideo.Hit          = Convert.ToInt64(ds.Tables[0].Rows[0]["Hit"].ToString());
                tpVideo.HtmlURL      = ds.Tables[0].Rows[0]["HtmlURL"].ToString();
                tpVideo.InfoCode     = ds.Tables[0].Rows[0]["InfoCode"].ToString();
                tpVideo.infoID       = Convert.ToInt64(ds.Tables[0].Rows[0]["infoID"].ToString());
                tpVideo.infotypeID   = ds.Tables[0].Rows[0]["infotypeID"].ToString();
                tpVideo.IsCore       = Convert.ToInt32(ds.Tables[0].Rows[0]["IsCore"].ToString());
                tpVideo.IsRedirect   = Convert.ToInt32(ds.Tables[0].Rows[0]["IsRedirect"].ToString());
                tpVideo.KeyWord      = ds.Tables[0].Rows[0]["KeyWord"].ToString();
                tpVideo.LoginName    = ds.Tables[0].Rows[0]["LoginName"].ToString();
                tpVideo.MiniatureUrl = ds.Tables[0].Rows[0]["MiniatureUrl"].ToString();
                tpVideo.Origin       = ds.Tables[0].Rows[0]["Origin"].ToString();
                if (tpVideo.ProvinceID.Trim() == "")
                {
                    tpVideo.ProvinceID = "";
                }
                else
                {
                    tpVideo.ProvinceID = zone.GetProvinceNameByCode(ds.Tables[0].Rows[0]["ProvinceID"].ToString());
                }
                tpVideo.publishT    = Convert.ToDateTime(ds.Tables[0].Rows[0]["publishT"].ToString());
                tpVideo.RedirectUrl = ds.Tables[0].Rows[0]["RedirectUrl"].ToString();
                tpVideo.strRemark   = ds.Tables[0].Rows[0]["Remark"].ToString();
                tpVideo.subTitle    = ds.Tables[0].Rows[0]["subTitle"].ToString();
                tpVideo.Summary     = ds.Tables[0].Rows[0]["Summary"].ToString();
                tpVideo.Title       = ds.Tables[0].Rows[0]["Title"].ToString();

                return(tpVideo);
            }
            else
            {
                return(null);
            }
        }