예제 #1
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        Tz888.Model.TPMerchant TPMerchantModel = new Tz888.Model.TPMerchant();
        TPMerchantModel.infoID         = Convert.ToInt64(Request.QueryString["id"].ToString());
        TPMerchantModel.NewsTypeID     = ViewState["NewsType"].ToString();
        TPMerchantModel.publishT       = System.DateTime.Now;
        TPMerchantModel.KeyWord        = "";
        TPMerchantModel.Descript       = "";
        TPMerchantModel.DisplayTitle   = "";
        TPMerchantModel.HtmlFile       = "";
        TPMerchantModel.Hit            = 0;
        TPMerchantModel.Title          = this.txtTitle.Value.Trim();
        TPMerchantModel.LoginName      = Page.User.Identity.Name.ToString();
        TPMerchantModel.Author         = "";
        TPMerchantModel.IsCore         = 0;
        TPMerchantModel.Origin         = this.txtSource.Value.Trim();
        TPMerchantModel.Content        = Tz888.Common.Utility.PageValidate.TxtToHtml(this.txtContent.Value.Trim());
        TPMerchantModel.Pic1           = Convert.ToString(ViewState["strSavePath"]);
        TPMerchantModel.PicAbout       = this.txtInstruction.Value.Trim();
        TPMerchantModel.ProvinceID     = this.ZoneSelectControl1.ProvinceID.Trim();
        TPMerchantModel.CityID         = this.ZoneSelectControl1.CityID.Trim();
        TPMerchantModel.CountyID       = this.ZoneSelectControl1.CountyID.Trim();
        TPMerchantModel.IsRedirect     = 0;
        TPMerchantModel.NewsLblStatus  = "";
        TPMerchantModel.NewsIndustryID = "*";
        TPMerchantModel.PageCharCount  = 0;
        TPMerchantModel.RedirectUrl    = "";
        TPMerchantModel.ResearchSpot   = "";
        TPMerchantModel.strRemark      = "";
        TPMerchantModel.Summary        = "";
        TPMerchantModel.subTitle       = this.txtTitle.Value.Trim();
        TPMerchantModel.ShortTitle     = this.txtTitle.Value.Trim();
        TPMerchantModel.ShortContent   = "";
        if (this.txtContent.Value.Trim().Length > 100)
        {
            TPMerchantModel.ShortContent = this.txtContent.Value.Trim().Substring(0, 100);
        }
        TPMerchantModel.PageStatus         = 0;
        TPMerchantModel.ShortInfoControlID = "";
        TPMerchantModel.InfoCode           = "ZSNEWS";
        TPMerchantModel.auditingstatus     = 0;
        TPMerchantModel.AuditingRemark     = "";

        Tz888.SQLServerDAL.TPMerchant tpm = new Tz888.SQLServerDAL.TPMerchant();
        bool infoID = tpm.UpdateMerchantNews(TPMerchantModel);

        if (infoID == true)
        {
            Response.Write("<script>alert('更新成功!');window.close();</script>");
        }
        else
        {
            RegisterStartupScript("alertMessage", "<script>alert('更新失败!'); </script>");
        }
    }
예제 #2
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (this.hidradioType.Value != "67")
        {
            Tz888.Model.TPMerchant TPMerchantModel = new Tz888.Model.TPMerchant();
            TPMerchantModel.infoID         = 0;
            TPMerchantModel.NewsTypeID     = this.hidradioType.Value.Trim();
            TPMerchantModel.Title          = this.txtTitle.Value.Trim(); //标题
            TPMerchantModel.KeyWord        = "";
            TPMerchantModel.Descript       = "";
            TPMerchantModel.publishT       = System.DateTime.Now;                                                       //时间
            TPMerchantModel.Hit            = 0;
            TPMerchantModel.LoginName      = "262734254";                                                               // Page.User.Identity.Name.ToString();
            TPMerchantModel.Author         = "";
            TPMerchantModel.Origin         = this.txtSource.Value.Trim();                                               //来源
            TPMerchantModel.Content        = Tz888.Common.Utility.PageValidate.TxtToHtml(this.txtContent.Value.Trim()); //正文
            TPMerchantModel.Pic1           = Convert.ToString(ViewState["strSavePath"]);
            TPMerchantModel.PicAbout       = this.txtInstruction.Value.Trim();                                          //图片说明
            TPMerchantModel.ProvinceID     = this.ZoneSelectControl1.ProvinceID.Trim();
            TPMerchantModel.CityID         = this.ZoneSelectControl1.CityID.Trim();
            TPMerchantModel.CountyID       = this.ZoneSelectControl1.CountyID.Trim();
            TPMerchantModel.IsRedirect     = 0;
            TPMerchantModel.NewsLblStatus  = "";
            TPMerchantModel.NewsIndustryID = "*";
            TPMerchantModel.PageCharCount  = 0;
            TPMerchantModel.RedirectUrl    = "";
            TPMerchantModel.ResearchSpot   = "";
            TPMerchantModel.strRemark      = "";
            TPMerchantModel.Summary        = "";
            TPMerchantModel.subTitle       = this.txtTitle.Value.Trim(); //标题
            TPMerchantModel.ShortTitle     = this.txtTitle.Value.Trim(); //标题
            TPMerchantModel.ShortContent   = "";
            if (this.txtContent.Value.Trim().Length > 100)
            {
                TPMerchantModel.ShortContent = this.txtContent.Value.Trim().Substring(0, 100);
            }
            TPMerchantModel.PageStatus         = 0;
            TPMerchantModel.ShortInfoControlID = "";
            TPMerchantModel.IsCore             = 0;
            TPMerchantModel.InfoCode           = "ZSNEWS";
            TPMerchantModel.auditingstatus     = 0;

            Tz888.SQLServerDAL.TPMerchant tpm = new Tz888.SQLServerDAL.TPMerchant();
            bool infoID = tpm.InsertMerchantNews(TPMerchantModel);
            if (infoID == true)
            {
                RegisterStartupScript("alertMessage", "<script>alert('发布成功!'); </script>");
                //Response.Redirect("NewsSuccess.aspx");
            }
            else
            {
                RegisterStartupScript("alertMessage", "<script>alert('发布失败!'); </script>");
            }
        }
        else
        {
            Tz888.Model.TPMerchant TPMerchantModel = new Tz888.Model.TPMerchant();
            TPMerchantModel.infoID         = 0;
            TPMerchantModel.NewsTypeID     = this.hidradioType.Value.Trim();
            TPMerchantModel.Title          = this.txtName.Value.Trim();
            TPMerchantModel.publishT       = System.DateTime.Now;
            TPMerchantModel.Hit            = 0;
            TPMerchantModel.KeyWord        = "";
            TPMerchantModel.Descript       = "";
            TPMerchantModel.LoginName      = Page.User.Identity.Name.ToString();
            TPMerchantModel.Author         = "";
            TPMerchantModel.Origin         = "";
            TPMerchantModel.Content        = Tz888.Common.Utility.PageValidate.TxtToHtml(this.txtContent2.Value.Trim());
            TPMerchantModel.Pic1           = Convert.ToString(ViewState["strSavePath"]);
            TPMerchantModel.PicAbout       = this.txtRemarks.Value.Trim();
            TPMerchantModel.ProvinceID     = this.ZoneSelectControl1.ProvinceID.Trim();
            TPMerchantModel.CityID         = this.ZoneSelectControl1.CityID.Trim();
            TPMerchantModel.CountyID       = this.ZoneSelectControl1.CountyID.Trim();
            TPMerchantModel.IsRedirect     = 0;
            TPMerchantModel.NewsLblStatus  = "";
            TPMerchantModel.NewsIndustryID = "*";
            TPMerchantModel.PageCharCount  = 0;
            TPMerchantModel.RedirectUrl    = "";
            TPMerchantModel.ResearchSpot   = "";
            TPMerchantModel.strRemark      = "";
            TPMerchantModel.Summary        = "";
            TPMerchantModel.subTitle       = this.txtName.Value.Trim();
            TPMerchantModel.ShortTitle     = this.txtName.Value.Trim();
            TPMerchantModel.ShortContent   = "";
            if (this.txtContent.Value.Trim().Length > 100)
            {
                TPMerchantModel.ShortContent = this.txtContent.Value.Trim().Substring(0, 100);
            }
            TPMerchantModel.PageStatus         = 0;
            TPMerchantModel.ShortInfoControlID = "";

            TPMerchantModel.activeAdress     = this.txtAddress.Value.Trim();
            TPMerchantModel.activeDateFrom   = this.stime.Value.Trim();
            TPMerchantModel.activeDateTo     = "";
            TPMerchantModel.mainUnit         = Tz888.Common.Utility.PageValidate.TxtToHtml(this.txtHostUnit.Value.Trim());
            TPMerchantModel.secondUnit       = Tz888.Common.Utility.PageValidate.TxtToHtml(this.txtHandleUnit.Value.Trim());
            TPMerchantModel.OrganizationName = "";
            TPMerchantModel.Name             = this.txtNam.Value.Trim() + " " + this.txtNam1.Value.Trim() + " " + this.txtNam2.Value.Trim() + " " + this.txtNam3.Value.Trim() + " " + this.txtNam4.Value.Trim() + " " + this.txtNam5.Value.Trim();
            TPMerchantModel.Mobile           = this.txtPhone.Value.Trim() + " " + this.txtPhone1.Value.Trim() + " " + this.txtPhone2.Value.Trim() + " " + this.txtPhone3.Value.Trim() + " " + this.txtPhone4.Value.Trim() + " " + this.txtPhone5.Value.Trim();
            TPMerchantModel.TelCountryCode   = this.txtPhoneCountryCode.Value.Trim();
            TPMerchantModel.TelStateCode     = this.txtPhoneCityCode.Value.Trim();
            TPMerchantModel.TelNum           = this.txtPhoneNum.Value.Trim();
            TPMerchantModel.FaxCountryCode   = this.txtFaxCountryCode.Value.Trim();
            TPMerchantModel.FaxStateCode     = this.txtFaxCityCode.Value.Trim();
            TPMerchantModel.FaxNum           = this.txtFaxNum.Value.Trim();
            TPMerchantModel.address          = this.txtAddres.Value.Trim();
            TPMerchantModel.WebSite          = this.txtNet.Value.Trim();
            TPMerchantModel.PostCode         = this.txtZipCode.Value.Trim();
            TPMerchantModel.Email            = this.txtEmail.Value.Trim();
            TPMerchantModel.IsCore           = 0;
            TPMerchantModel.auditingstatus   = 0;

            Tz888.SQLServerDAL.TPMerchant tpm = new Tz888.SQLServerDAL.TPMerchant();
            bool infoID = tpm.InsertMerchantActiveNews(TPMerchantModel);
            if (infoID == true)
            {
                RegisterStartupScript("alertMessage", "<script>alert('发布成功!'); </script>");
                //Response.Redirect("NewsSuccess.aspx");
            }
            else
            {
                RegisterStartupScript("alertMessage", "<script>alert('发布失败!'); </script>");
            }
        }
    }
예제 #3
0
 /// <summary>
 ///  更新资讯信息
 /// </summary>
 public bool UpdateMerchantNews(Tz888.Model.TPMerchant model)
 {
     return(dal.UpdateMerchantNews(model));
 }
예제 #4
0
        /// <summary>
        /// 创建静态页面
        /// </summary>
        /// <param name="InfoIDArr">需要更新的信息ID列表</param>
        /// <param name="IsLog">是否需要将信息写入日志</param>
        /// <param name="UpdateMsg">处理的日志</param>
        /// <returns></returns>
        public bool CreateStaticPageNews(string InfoID, ref string UpdateMsg)
        {
            System.Text.StringBuilder sbUpdateMsg = new System.Text.StringBuilder();
            try
            {
                #region 变量定义

                //系统路径
                string ApplicationRootPath = ConfigurationManager.AppSettings["ApplicationRootPath"].ToString(); //静态页面的根目录
                //模板路径
                string TempNewsPath = ConfigurationManager.AppSettings["NewsTmpPath"].ToString();                //融资模板的存放位置
                //目标路径
                string TempNewsPathTo = ConfigurationManager.AppSettings["NewsTmpPathTo"].ToString();            //融资模板的存放位置

                string ImageDomain = ConfigurationManager.AppSettings["ImageDomain"].ToString();                 //图片域名

                Tz888.Model.TPMerchant TheNews = new Tz888.Model.TPMerchant();

                byte   AuditingStatus;
                string Title;
                string FrontDisplayTime;
                string DisplayTitle;
                string KeyWord;
                string Descript;
                int    TemplateID;
                string HtmlFile;
                string loginName;
                string Origin;
                string Author;
                string Pic1;
                string PicAbout;
                string Content;

                float  InfoPrice;
                string InfoPriceName; //用于显示

                string       TmpTmpSource = "";
                string       OutPutFilePath; //输出路径
                StreamWriter swOutPut;

                long   HaveDoneCount = 0;
                string LodgeMsg      = "";
                string Recommend     = "";

                string NewsTypeName;    //资讯类型

                string PublishT;        //发布日期
                string PublisLoginName; //发布者
                #endregion
                TheNews = obj.objGetNewsInfoByInfoID(long.Parse(InfoID.Trim()));
                #region 读取模板内容

                StreamReader srSource;
                string       TmpFileName;
                TmpFileName = ApplicationRootPath + TempNewsPath + NewsTempFileName;
                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 错误判断

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

                loginName = TheNews.LoginName.Trim();

                Tz888.BLL.Register.LoginInfoBLL logionInfoBLL = new Tz888.BLL.Register.LoginInfoBLL();
                string MemberGradeID = logionInfoBLL.GetMemberGradeID(loginName).Trim();

                AuditingStatus = (byte)TheNews.auditingstatus;
                if (AuditingStatus > 1)
                {
                    sbUpdateMsg.Append("[E]审核未通过的信息不允许生成静态文件!<br>");
                    UpdateMsg = sbUpdateMsg.ToString();
                    return(false);
                }
                if (AuditingStatus != 1 && MemberGradeID != "1002")
                {
                    sbUpdateMsg.Append("[E]信息未审核且不是拓富通会员信息,不允许生成静态文件!<br>");
                    UpdateMsg = sbUpdateMsg.ToString();
                    return(false);
                }

                #endregion

                #region 变量赋值

                NewsTypeName = TheNews.NewsTypeName.Trim();


                //开始时间
                PublishT        = TheNews.ValidateStartTime.ToShortDateString().Trim();
                PublisLoginName = TheNews.LoginName.ToString().Trim();


                Title   = TheNews.Title;
                Content = TheNews.Content;

                loginName = TheNews.LoginName.Trim();
                Origin    = TheNews.Origin;
                Author    = TheNews.Author;
                Pic1      = TheNews.Pic1;
                PicAbout  = TheNews.PicAbout;


                KeyWord = TheNews.KeyWord;
                string[] keys = KeyWord.Split(',');
                KeyWord = "";
                foreach (string temp in keys)
                {
                    if (!string.IsNullOrEmpty(temp))
                    {
                        KeyWord += temp + " ";
                    }
                }

                if (string.IsNullOrEmpty(KeyWord))
                {
                    KeyWord = "资讯";
                }

                LodgeMsg = InfoID + "&Title=" + Title;

                HtmlFile = TheNews.HtmlFile;
                if (HtmlFile.Trim() == "")
                {
                    HtmlFile = Tz888.BLL.Info.Common.createStaticPageFileName("News", TheNews.InfoCode.Trim(), TheNews.infoID);
                    bool status = false;
                    status = obj.UpdateHtmlFile(TheNews.infoID, HtmlFile);
                    if (status == false)
                    {
                        sbUpdateMsg.Append("生成HtmlFile失败");
                        UpdateMsg = sbUpdateMsg.ToString();
                        return(false);
                    }
                }
                Recommend = InfoID + "&PageUrl=" + HtmlFile;

                if (TheNews.DisplayTitle == "")
                {
                    TheNews.DisplayTitle = Title;
                }
                DisplayTitle = TheNews.DisplayTitle + "-" + "中国招商投资网";
                Descript     = TheNews.Descript;
                TemplateID   = Convert.ToInt32(TheNews.TemplateID);

                FrontDisplayTime = TheNews.FrontDisplayTime.ToShortDateString();

                #endregion

                #region 替换模版
                TmpTmpSource = TmpSource;

                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-InfoID#", InfoID);

                TmpTmpSource = TmpTmpSource.Replace("#@TmpReffer-NewsTypeName#", NewsTypeName);

                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-Title#", Title);
                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-PublishT#", PublishT);

                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-PublisLoginName#", PublisLoginName);

                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-FrontDisplayTime#", FrontDisplayTime);

                TmpTmpSource = TmpTmpSource.Replace("#@TmpLinkFeild-Collection#", InfoID);
                TmpTmpSource = TmpTmpSource.Replace("#@LastCommentList#", "InfoID=" + InfoID + "&Title=" + Title);
                TmpTmpSource = TmpTmpSource.Replace("#@TmpLinkFeild-Recommend#", InfoID);
                TmpTmpSource = TmpTmpSource.Replace("#@TmpPageFeild-DisplayTitle#", DisplayTitle);
                TmpTmpSource = TmpTmpSource.Replace("#@TmpPageFeild-KeyWord#", KeyWord);
                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-KeyWord#", KeyWord);
                TmpTmpSource = TmpTmpSource.Replace("#@TmpPageFeild-Descript#", Descript);
                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-Domain#", Common.GetDomain());
                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-LoginName#", loginName);

                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-InfoID#", InfoID);

                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-Origin#", Origin);
                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-Author#", Author);
                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-Editor#", loginName);
                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-PicUrl-1#", Pic1);
                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-Content#", Content);
                TmpTmpSource = TmpTmpSource.Replace("#@TmpFeild-MatchII#", "");

                #endregion

                #endregion

                #region 输出文件


                OutPutFilePath = ApplicationRootPath + TempNewsPathTo.Trim() + HtmlFile;

                //检查路径是否正确
                if (!Common.BulidFolder(OutPutFilePath, true))
                {
                    sbUpdateMsg.Append("[E]路径" + OutPutFilePath + "不正确!资源类型:News<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);
            }
        }
예제 #5
0
 /// <summary>
 ///  添加活动资讯信息
 /// </summary>
 public bool InsertMerchantActiveNews(Tz888.Model.TPMerchant model)
 {
     return(dal.InsertMerchantActiveNews(model));
 }