protected void btnUpdate_Click(object sender, EventArgs e)
    {
        long _infoID = Convert.ToInt32(Request["infoID"].ToString());

        Tz888.Model.Info.MerchantSetModel model = new Tz888.Model.Info.MerchantSetModel();
        #region 招商信息实体
        model.MerchantInfoModel.MerchantTypeID    = "";// this.rblMerchantType.SelectedValue;
        model.MerchantInfoModel.CountryCode       = this.ZoneSelectControl1.CountryID;
        model.MerchantInfoModel.ProvinceID        = this.ZoneSelectControl1.ProvinceID;
        model.MerchantInfoModel.CityID            = this.ZoneSelectControl1.CityID;
        model.MerchantInfoModel.CountyID          = this.ZoneSelectControl1.CountyID;
        model.MerchantInfoModel.IndustryClassList = this.SelectIndustryControl1.IndustryString;
        model.MerchantInfoModel.CapitalCurrency   = this.ddlCapitalCurrency.SelectedValue;
        model.MerchantInfoModel.CapitalTotal      = Convert.ToDecimal(this.txtCapitalTotal.Text.Trim());
        model.MerchantInfoModel.MerchantCurrency  = ""; //this.ddlMerchantCurrency.SelectedValue;
        model.MerchantInfoModel.MerchantTotal     = ""; //this.ddlMerchantTotal.SelectedValue;
        model.MerchantInfoModel.Merchanreturns    = Convert.ToInt32(this.txtHuiBao.Text.Trim());
        //项目现状及规划
        model.MerchantInfoModel.ProjectStatus = "";// txtProjectStatus.Text;
        //项目优势及市场分析
        model.MerchantInfoModel.Market = Tz888.Common.Utility.PageValidate.TxtToHtml("");
        //地方经济指标描述
        model.MerchantInfoModel.EconomicIndicators = Tz888.Common.Utility.PageValidate.TxtToHtml("");
        //投资环境描述
        model.MerchantInfoModel.InvestmentEnvironment = Tz888.Common.Utility.PageValidate.TxtToHtml("");
        //经济效益分析
        model.MerchantInfoModel.Benefit = Tz888.Common.Utility.PageValidate.TxtToHtml("");

        model.MerchantInfoModel.ZoneAbout = Tz888.Common.Utility.PageValidate.TxtToHtml(Tz888.Common.Utility.PageValidate.FiltrateHTMLTag(this.txtZoneAbout.Value.ToString()));
        if (ViewState["ZoneAboutBrief"] != null)
        {
            model.MerchantInfoModel.ZoneAboutBrief = ViewState["ZoneAboutBrief"].ToString();
        }

        ViewState["ZoneAboutBrief"] = model.MerchantInfoModel.ZoneAboutBrief;

        model.MerchantInfoModel.CooperationDemandType = "";


        #endregion
        model.MainInfoModel.InfoID = Convert.ToInt64(this.ViewState["InfoID"]);
        if (!string.IsNullOrEmpty(this.txtMerchantTopic.Text.Trim()))
        {
            model.MainInfoModel.Title = Tz888.Common.Utility.PageValidate.FiltrateHTMLTag(this.txtMerchantTopic.Text.Trim());
        }
        model.MainInfoModel.publishT = Convert.ToDateTime(this.ViewState["PublishT"]);

        model.MainInfoModel.LoginName = ViewState["UserName"].ToString();//用户名称
        if (chkIsPoint.Checked == true)
        {
            model.MainInfoModel.FixPriceID     = "2";
            model.MainInfoModel.MainPointCount = Convert.ToInt32(txtPointCount.Text.Trim());
        }
        else
        {
            model.MainInfoModel.MainPointCount = 0;
            model.MainInfoModel.FixPriceID     = "1";
        }

        string keyword = "";

        byte AuditingOrigin = Convert.ToByte(ViewState["AuditingStatus"]);
        byte AuditingStatus = 0;
        if (rdAudit.Checked == true)
        {
            AuditingStatus = 0;

            model.MainInfoModel.HtmlFile = "";
        }
        if (rdPass.Checked == true)
        {
            AuditingStatus = 1;

            model.MainInfoModel.HtmlFile = "Merchant/" + DateTime.Now.ToString("yyyyMM") + "/Merchant" + DateTime.Now.ToString("yyyyMMdd") + "_" + _infoID + ".shtml";
        }
        if (rdNopass.Checked == true)
        {
            AuditingStatus = 2;

            model.MainInfoModel.HtmlFile = "";
        }
        model.MainInfoModel.AuditingStatus = AuditingStatus;
        //招商重大投资商机设置
        Tz888.BLL.MerchantOppor objOppor = new Tz888.BLL.MerchantOppor();
        if (chkIsVip.Checked)
        {
            objOppor.IsVip(_infoID, 1, txtIsVipAbout.Text.Trim());
        }
        else
        {
            objOppor.IsVip(_infoID, 0, "");
        }
        model.MainInfoModel.Hit = Convert.ToInt32(tbHits.Text.ToString().Trim());
        string KeyWord      = this.txtKeord.Text.ToString().Trim();    //关键字
        string DisplayTitle = this.txtWtitle.Text.Trim();              //网页标题
        string Descript     = this.txtDescript.Text.ToString().Trim(); //网页描述
        model.MainInfoModel.KeyWord      = Tz888.Common.Utility.PageValidate.FiltrateHTMLTag(KeyWord);
        model.MainInfoModel.DisplayTitle = Tz888.Common.Utility.PageValidate.FiltrateHTMLTag(DisplayTitle);
        model.MainInfoModel.Descript     = txtDescript.Text.ToString().Trim();

        model.MainInfoModel.FrontDisplayTime  = System.DateTime.Now;
        model.MainInfoModel.ValidateStartTime = System.DateTime.Now;

        //项目有效期限
        model.MainInfoModel.ValidateTerm = Convert.ToInt32(this.rdlValiditeTerm.SelectedValue.Trim());
        model.MainInfoModel.InfoTypeID   = "Merchant";
        model.MainInfoModel.TemplateID   = "001";


        model.ShortInfoModel.ShortInfoControlID = "";// Convert.ToString(ViewState["ShortInfoControlID"]);
        //if (ViewState["ShortTitle"] != null)
        //{
        //    model.ShortInfoModel.ShortTitle = ViewState["ShortTitle"].ToString();
        //}
        //if (ViewState["ShortContent"] != null)
        //{
        model.ShortInfoModel.ShortContent = ""; //ViewState["ShortContent"].ToString();
        //}


        model.InfoContactModel.Address          = txtAddress.Text.ToString().Trim();
        model.InfoContactModel.Email            = txtEmail.Text.ToString().Trim();
        model.InfoContactModel.Mobile           = txtMobile.Text.ToString().Trim();
        model.InfoContactModel.OrganizationName = txtCompanyName.Text.ToString().Trim();
        model.InfoContactModel.Name             = txtName.Text.ToString().Trim();
        model.InfoContactModel.TelCountryCode   = txtTelCountry.Text.ToString().Trim();
        model.InfoContactModel.TelStateCode     = txtTelZoneCode.Text.ToString().Trim();
        model.InfoContactModel.TelNum           = txtTelNumber.Text.ToString().Trim();


        //List<Tz888.Model.Info.InfoResourceModel> infoResourceModels;
        //infoResourceModels = FilesUploadControl1.InfoList;
        ////List<Tz888.Model.Info.InfoResourceModel> infoResourceModels = Tz888.Common.InfoResourceManage.ImageTransfer("Image", "Merchant", Tz888.Common.ResourceType.Image, Tz888.Common.ResourceProperty.InfoImage, FilesUploadControl1.InfoList);
        //if (infoResourceModels != null)
        //    model.InfoResourceModels.AddRange(infoResourceModels);

        //修改附件
        Tz888.BLL.Info.InfoResourceBLL obj2 = new Tz888.BLL.Info.InfoResourceBLL();
        obj2.DeleteByInfoID(long.Parse(this.ViewState["InfoID"].ToString()));
        List <Tz888.Model.Info.InfoResourceModel> infoResourceModels = new List <Tz888.Model.Info.InfoResourceModel>();
        infoResourceModels = this.FilesUploadControl1.InfoList;
        if (infoResourceModels != null)
        {
            model.InfoResourceModels.AddRange(infoResourceModels);
        }
        if (infoResourceModels != null)
        {
            foreach (Tz888.Model.Info.InfoResourceModel ResModel in infoResourceModels)
            {
                ResModel.InfoID = long.Parse(this.ViewState["InfoID"].ToString());
                obj2.Insert(ResModel);
            }
        }
        Tz888.BLL.Info.InfoAuditMailBLL MailBll = new Tz888.BLL.Info.InfoAuditMailBLL();
        Tz888.BLL.Info.MarchantInfoBLL  bll     = new Tz888.BLL.Info.MarchantInfoBLL();
        if (bll.UpdateMerchantSet(model))
        {
            string AuditingRemark = "";
            Tz888.Model.Info.InfoAuditModel auditModel = new Tz888.Model.Info.InfoAuditModel();
            #region 写入信息审核记录
            auditModel = new Tz888.Model.Info.InfoAuditModel();

            auditModel.InfoID       = model.MainInfoModel.InfoID;
            auditModel.InfoTypeID   = theInfoType;
            auditModel.LoginName    = ViewState["UserName"].ToString();
            auditModel.PostDate     = System.DateTime.Now;
            auditModel.Title        = model.MainInfoModel.Title;
            auditModel.AuditingDate = System.DateTime.Now;
            auditModel.AuditingBy   = Page.User.Identity.Name;
            auditModel.Memo         = "";
            switch (AuditingOrigin)
            {
            case 0:
                switch (AuditingStatus)
                {
                case 0:
                    break;

                case 1:
                    AuditingRemark            = "未审核->审核通过";
                    auditModel.FeedBackNote   = "";
                    auditModel.AuditStatus    = AuditingStatus;
                    auditModel.AuditingRemark = AuditingRemark;

                    auditModel.FeedbackStatus = 0;         //0,可修改|1,即将删除
                    break;

                case 2:
                    AuditingRemark = "未审核->审核未通过";

                    auditModel.AuditStatus    = AuditingStatus;
                    auditModel.AuditingRemark = AuditingRemark;
                    auditModel.FeedbackStatus = Convert.ToInt32(this.rblFeedbackStatus.SelectedValue.Trim());         //0,可修改|1,即将删除
                    auditModel.FeedBackNote   = tbAuditingRemark.Text.ToString().Trim();


                    break;

                default:
                    break;
                }
                break;

            case 1:
                switch (AuditingStatus)
                {
                case 0:
                    AuditingRemark            = "审核通过->未审核";
                    auditModel.FeedBackNote   = "";
                    auditModel.AuditStatus    = AuditingStatus;
                    auditModel.AuditingRemark = AuditingRemark;
                    auditModel.FeedbackStatus = 0;
                    break;

                case 1:
                    AuditingRemark = "审核通过->审核通过(修改)";
                    bool c = mainBll.HasAuditing(_infoID, AuditingStatus, true, Convert.ToInt32(this.tbHits.Text.Trim()), model.MainInfoModel.LoginName,
                                                 AuditingRemark, model.MainInfoModel.HtmlFile, "", 0, 0);
                    break;

                case 2:
                    AuditingRemark            = "审核通过->审核未通过";
                    auditModel.AuditStatus    = AuditingStatus;
                    auditModel.AuditingRemark = AuditingRemark;
                    auditModel.FeedBackNote   = this.tbAuditingRemark.Text.Trim();
                    auditModel.FeedbackStatus = Convert.ToInt32(this.rblFeedbackStatus.SelectedValue.Trim());

                    break;

                default:
                    break;
                }
                break;

            case 2:
                switch (AuditingOrigin)
                {
                case 0:
                    AuditingRemark            = "审核未通过->未审核";
                    auditModel.FeedbackStatus = 0;
                    auditModel.FeedBackNote   = "";
                    auditModel.AuditStatus    = AuditingStatus;
                    auditModel.AuditingRemark = AuditingRemark;
                    break;

                case 1:
                    AuditingRemark            = "审核未通过->审核通过";
                    auditModel.FeedbackStatus = 0;
                    auditModel.FeedBackNote   = "";
                    auditModel.AuditStatus    = AuditingStatus;
                    auditModel.AuditingRemark = AuditingRemark;
                    break;

                case 2:
                    AuditingRemark            = "审核通过->审核未通过";
                    auditModel.FeedBackNote   = this.tbAuditingRemark.Text.Trim();
                    auditModel.AuditStatus    = AuditingStatus;
                    auditModel.AuditingRemark = AuditingRemark;
                    auditModel.FeedbackStatus = Convert.ToInt32(this.rblFeedbackStatus.SelectedValue.Trim());
                    break;

                default:
                    break;
                }
                break;

            default:
                break;
            }
            bool b = mainBll.InfoAuditNote(auditModel);
            if (b)
            {
                if (model.MainInfoModel.AuditingStatus == 1)
                {
                    int num = page.ModifyHtmlFile(Convert.ToInt32(_infoID));
                    if (num >= 0)
                    {
                        page = page.objGetMerchantInfoByInfoID(_infoID);                       //根ID获取信息
                        string IsVip   = Mercahrstatic.SelIsVip();                             //查询为重大商机的信息
                        string Idstuny = page.SelectLndus(model.MerchantInfoModel.ProvinceID); //根据区域查询信息
                        int    sum     = page.StaticHtml(Convert.ToInt32(_infoID), page.Title, page.PublishT, page.AreaName, page.Content, page.IndustryCarveOutID, page.MerchantNameTotal, page.ValidateID, Idstuny, IsVip, KeyWord, DisplayTitle, Descript, page.Merchanreturns);
                    }
                    else
                    {
                        this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('生成静态页面失败!');location.href='MerchantManage.aspx'", true);
                    }
                }
                Response.Redirect("MerchantManage.aspx");
            }
            else
            {
                this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核信息失败!');location.href='MerchantManage.aspx'", true);
            }

            #endregion
        }
        else
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核信息失败!');location.href='MerchantManage.aspx'", true);
        }
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        //结束部分
        //实体部分
        // this.imgLoding.Visible = true;
        Tz888.Model.Info.MainInfoModel              mainInfoModel        = new Tz888.Model.Info.MainInfoModel();              //创建主体信息实体
        Tz888.Model.Info.MerchantInfoModel          merchantInfoModel    = new Tz888.Model.Info.MerchantInfoModel();          //创建招商信息实体
        Tz888.Model.Info.InfoContactModel           infoContactModel     = new Tz888.Model.Info.InfoContactModel();           //创建信息联系方式主体
        Tz888.Model.Info.ShortInfoModel             shortInfoModel       = new Tz888.Model.Info.ShortInfoModel();             //创建短信息实体
        List <Tz888.Model.Common.IndustryModel>     industryModels       = new List <Tz888.Model.Common.IndustryModel>();     //融资行业实体列表
        List <Tz888.Model.Info.InfoContactManModel> infoContactManModels = new List <Tz888.Model.Info.InfoContactManModel>(); //联系人实体列表
        List <Tz888.Model.Info.InfoResourceModel>   infoResourceModels   = new List <Tz888.Model.Info.InfoResourceModel>();   //招商信息资源信息实体

        DateTime time_now = DateTime.Now;

        industryModels = this.SelectIndustryControl1.IndustryModels;
        //这里是多个联系方式的添加


        #region 招商信息实体赋值
        merchantInfoModel.MerchantTypeID = "";// rblMerchantType.SelectedValue;
        merchantInfoModel.CountryCode    = ZoneSelectControl1.CountryID;
        merchantInfoModel.ProvinceID     = ZoneSelectControl1.ProvinceID;
        merchantInfoModel.CityID         = ZoneSelectControl1.CityID;
        merchantInfoModel.CountyID       = ZoneSelectControl1.CountyID;

        //联系方式赋值
        infoContactModel.OrganizationName = this.txtCompanyName.Text;
        infoContactModel.Name             = this.txtName.Text;
        infoContactModel.Position         = "";// this.txtPosition.Text;
        infoContactModel.TelCountryCode   = this.txtTelCountry.Text;
        infoContactModel.TelStateCode     = this.txtTelZoneCode.Text;
        infoContactModel.TelNum           = this.txtTelNumber.Text;
        infoContactModel.Mobile           = this.txtMobile.Text;
        infoContactModel.Email            = this.txtEmail.Text;
        infoContactModel.Address          = this.txtAddress.Text;

        merchantInfoModel.CooperationDemandType = "";
        merchantInfoModel.CapitalCurrency       = this.ddlCapitalCurrency.SelectedValue;

        if (!string.IsNullOrEmpty(this.txtCapitalTotal.Text.Trim()))
        {
            merchantInfoModel.CapitalTotal = Convert.ToDecimal(this.txtCapitalTotal.Text.Trim());
        }

        merchantInfoModel.MerchantCurrency = ""; // this.ddlMerchantCurrency.SelectedValue;
        merchantInfoModel.MerchantTotal    = ""; // this.ddlMerchantTotal.SelectedValue;

        if (!string.IsNullOrEmpty(this.txtZoneAbout.Value.Trim()))
        {
            merchantInfoModel.ZoneAbout = Tz888.Common.Utility.PageValidate.TxtToHtml(this.txtZoneAbout.Value.Trim());
        }

        //这里是2010-06-01新加的招商信息
        //if (!string.IsNullOrEmpty(this.txtZoneAboutBrief.Value.Trim()))
        merchantInfoModel.ZoneAboutBrief = Tz888.Common.Utility.PageValidate.TxtToHtml("");
        // if (!string.IsNullOrEmpty(this.txtBenefit.Value.Trim()))
        merchantInfoModel.Benefit = Tz888.Common.Utility.PageValidate.TxtToHtml("");

        // if (!string.IsNullOrEmpty(this.txtEconomicIndicators.Value.Trim()))
        merchantInfoModel.EconomicIndicators = Tz888.Common.Utility.PageValidate.TxtToHtml("");
        //if (!string.IsNullOrEmpty(this.txtInvestmentEnvironment.Value.Trim()))
        merchantInfoModel.InvestmentEnvironment = Tz888.Common.Utility.PageValidate.TxtToHtml("");
        //if (!string.IsNullOrEmpty(this.txtProjectStatus.Value.Trim()))
        merchantInfoModel.ProjectStatus = Tz888.Common.Utility.PageValidate.TxtToHtml("");
        //  if (!string.IsNullOrEmpty(this.txtMarket.Value.Trim()))

        merchantInfoModel.Market = Tz888.Common.Utility.PageValidate.TxtToHtml("");
        //merchantInfoModel.Merchanreturns = Convert.ToInt32(this.txtHuiBao.Text.Trim());//回报率
        if (txtHuiBao.Text.ToString().Trim() == "")
        {
            merchantInfoModel.Merchanreturns = 0;
        }
        else
        {
            merchantInfoModel.Merchanreturns = Convert.ToInt32(this.txtHuiBao.Text.Trim());
        }
        //结束处
        foreach (Tz888.Model.Common.IndustryModel model in industryModels)
        {
            merchantInfoModel.IndustryClassList += model.IndustryBID + ",";
        }

        //2010-06-08以下是对信息完整度的统计
        merchantInfoModel.InformationIntegrity = Tz888.BLL.Info.MarchantInfoBLL.CountInfoInte(merchantInfoModel, infoContactModel);

        #endregion

        if (!string.IsNullOrEmpty(this.txtMerchantTopic.Text.Trim()))
        {
            mainInfoModel.Title = Tz888.Common.Utility.PageValidate.FiltrateHTMLTag(this.txtMerchantTopic.Text.Trim());
        }

        mainInfoModel.InfoCode = Tz888.BLL.Info.Common.CreateInfoCode("Merchant", industryModels[0].IndustryBID, this.ZoneSelectControl1.CountryID, DateTime.Now);
        mainInfoModel.publishT = time_now;
        mainInfoModel.Hit      = Convert.ToInt32(tbHits.Text.Trim());

        mainInfoModel.IsCore = true;
        //注意这里是添加主信息表与用户登陆表的通过用户名相联系
        //mainInfoModel.LoginName = "111111";
        mainInfoModel.LoginName          = bp.LoginName;
        mainInfoModel.InfoOriginRoleName = "0"; //用户角色
        mainInfoModel.GradeID            = "0";
        if (chkIsPoint.Checked == true)
        {
            mainInfoModel.FixPriceID     = "2";
            mainInfoModel.MainPointCount = Convert.ToInt32(txtPointCount.Text.Trim());
        }
        else
        {
            mainInfoModel.MainPointCount = 0;
            mainInfoModel.FixPriceID     = "1";
        }
        mainInfoModel.FeeStatus = 0;
        mainInfoModel.KeyWord   = Tz888.Common.Utility.PageValidate.FiltrateHTMLTag(this.txtMerchantTopic.Text.Trim());
        mainInfoModel.Descript  = Tz888.Common.Utility.PageValidate.FiltrateHTMLTag(this.txtMerchantTopic.Text.Trim());
        if (!string.IsNullOrEmpty(this.txtMerchantTopic.Text.Trim()))
        {
            mainInfoModel.DisplayTitle = Tz888.Common.Utility.PageValidate.FiltrateHTMLTag(this.txtMerchantTopic.Text.Trim());
        }
        mainInfoModel.FrontDisplayTime  = time_now;
        mainInfoModel.ValidateStartTime = time_now;
        mainInfoModel.ValidateTerm      = Convert.ToInt32(this.rdlValiditeTerm.SelectedValue.Trim());
        mainInfoModel.TemplateID        = "001";
        byte AuditingStatus = 0;

        if (rdAudit.Checked == true)
        {
            AuditingStatus = 0;
        }
        if (rdPass.Checked == true)
        {
            AuditingStatus = 1;
        }
        if (rdNopass.Checked == true)
        {
            AuditingStatus = 2;
        }
        mainInfoModel.AuditingStatus      = AuditingStatus;
        mainInfoModel.HtmlFile            = Tz888.Common.Utility.PageValidate.TxtToHtml("");
        shortInfoModel.ShortInfoControlID = "MerchantIndex1";
        if (!string.IsNullOrEmpty(this.txtMerchantTopic.Text.Trim()))
        {
            shortInfoModel.ShortTitle = Tz888.Common.Utility.PageValidate.FiltrateHTMLTag(this.txtMerchantTopic.Text.Trim());
        }
        shortInfoModel.ShortContent = "";
        shortInfoModel.Remark       = "";

        //将已上传的图片从临时目录迁移到正式目录
        //infoResourceModels = Tz888.Common.InfoResourceManage.ImageTransfer("Image", "Merchant", Tz888.Common.ResourceType.Image, Tz888.Common.ResourceProperty.InfoImage, FilesUploadControl1.InfoList);
        infoResourceModels = FilesUploadControl1.InfoList;

        Tz888.BLL.Info.MarchantInfoBLL marchantObj = new Tz888.BLL.Info.MarchantInfoBLL();
        //插入数据
        long infoID = marchantObj.Insert(mainInfoModel, merchantInfoModel, infoContactModel, shortInfoModel, infoResourceModels);
        if (infoID > 0)
        {
            if (rdPass.Checked == true)
            {
                Tz888.Model.Info.MerchantSetModel model = new Tz888.Model.Info.MerchantSetModel();

                string url = "Merchant/" + DateTime.Now.ToString("yyyyMM") + "/Merchant" + DateTime.Now.ToString("yyyyMMdd") + "_" + infoID + ".shtml";
                merstatic.UpdateUrl(url, infoID);

                page = page.objGetMerchantInfoByInfoID(infoID);                   //根ID获取信息
                string IsVip   = Mercahrstatic.SelIsVip();                        //查询为重大商机的信息
                string Idstuny = page.SelectLndus(ZoneSelectControl1.ProvinceID); //根据区域查询信息
                int    sum     = page.StaticHtml(Convert.ToInt32(infoID), page.Title, page.PublishT, page.AreaName, page.Content, page.IndustryCarveOutID, page.MerchantNameTotal, page.ValidateID, Idstuny, IsVip, page.Title, page.Title, page.Title, page.Merchanreturns);
            }
            //招商重大投资商机设置
            Tz888.BLL.MerchantOppor objOppor = new Tz888.BLL.MerchantOppor();
            if (chkIsVip.Checked)
            {
                objOppor.IsVip(infoID, 1, txtIsVipAbout.Text.Trim());
            }
            else
            {
                objOppor.IsVip(infoID, 0, "");
            }
            Response.Redirect("MerchantManage.aspx");
        }
        else
        {
            Tz888.Common.MessageBox.Show(this.Page, "发布失败!");
        }
    }