protected void btnEUpdate_Click(object sender, EventArgs e)
    {
        string txtHVPID = gridViewCSReviewList.DataKeys[gridViewCSReviewList.EditIndex][0].ToString();
        string txtELID = txtHVPID;
        string txtSORE = "0";

        if (!String.IsNullOrEmpty(txtELID) && !System.Text.RegularExpressions.Regex.IsMatch(txtELID, @"^[0-9]*$"))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error1").ToString();
            return;
        }

        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
        ELRelationDBEntity ELRelationDBEntity = new ELRelationDBEntity();

        ELRelationDBEntity.HVPID = txtHVPID.Trim();
        ELRelationDBEntity.ELongID = txtELID.Trim();
        ELRelationDBEntity.Source = txtSORE.Trim();
        //ELRelationDBEntity.HOTELNM = txtHOTELNM.Trim();

        _elRelationEntity.ELRelationDBEntity.Add(ELRelationDBEntity);
        int iResult = ELRelationBP.UpdateELList(_elRelationEntity).Result;

        _commonEntity.LogMessages = _elRelationEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        commonDBEntity.Event_Type = "ELong酒店管理-保存";
        commonDBEntity.Event_ID = txtHVPID.Trim();
        string conTent = GetLocalResourceObject("EventUpdateMessage").ToString();

        conTent = string.Format(conTent, ELRelationDBEntity.HVPID, ELRelationDBEntity.ELongID, ELRelationDBEntity.HOTELNM, ELRelationDBEntity.Source);
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateSuccess").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("UpdateSuccess").ToString();
            gridViewCSReviewList.EditIndex = -1;
            BindReviewListGrid();//重新绑定显示的页面
            gridViewCSReviewList.SelectedIndex = -1;
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("UpdateError").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
    }
    public void bingData(string hotelId, string cityName)
    {
        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
        ELRelationDBEntity ELRelationDBEntity = new ELRelationDBEntity();

        ELRelationDBEntity.HVPID = hotelId.Trim();
        ELRelationDBEntity.AmountFrom = cityName.Trim();

        _elRelationEntity.ELRelationDBEntity.Add(ELRelationDBEntity);
        DataSet ds = ELRelationBP.HVPAreaSelect(_elRelationEntity).QueryResult;
        if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                sb.Append("<input type='button' id='" + ds.Tables[0].Rows[i]["AREAID"].ToString() + "' style='margin-right:10px;background-color: Transparent;background-image: url(../../images/imageButton.png); background-position: right center;background-repeat: no-repeat' onclick='removeClick(this)'  value='[" + ds.Tables[0].Rows[i]["AREAID"].ToString() + "]" + ds.Tables[0].Rows[i]["TagName"].ToString() + "     '>");
            }
            dvUserGroupList.InnerHtml = sb.ToString();
        }
    }
    public bool btnAddData()
    {
        MessageContent.InnerHtml = "";
        bool bFlag = true;
        string msgString = "";

        #region add  判断是否已和供应商酒店绑定
        //因为控件在保存的时候 还是会自动查询  所以 只能重新查询  来判断
        ELRelationEntity _ELRelationEntity = new ELRelationEntity();
        _ELRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _ELRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _ELRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _ELRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _ELRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
        ELRelationDBEntity elrelationDBEntity = new ELRelationDBEntity();
        elrelationDBEntity.HVPID = hidHotelID.Value;
        _ELRelationEntity.ELRelationDBEntity.Add(elrelationDBEntity);
        DataTable ds = ELRelationBP.HVPHotelSelectCircle(_ELRelationEntity).QueryResult.Tables[0];
        if (ds == null || ds.Rows.Count <= 0)
        {
            MessageContent.InnerHtml = "该酒店未绑定供应商酒店ID,请先绑定再设置商圈" + "<br/>";
            //bFlag = false;
            return false;
        }
        #endregion

        #region 编辑酒店各项验证
        if (String.IsNullOrEmpty(txtHotelNM.Text.ToString().Trim()))
        {
            msgString = msgString + GetLocalResourceObject("UpdateError3").ToString() + "<br/>";
            bFlag = false;
        }

        if (StringUtility.Text_Length(txtHotelNM.Text.ToString().Trim()) > 100)
        {
            msgString = msgString + GetLocalResourceObject("UpdateError2").ToString() + "<br/>";
            bFlag = false;
        }

        //酒店下线 必须选择下线原因
        if (this.ddpStatusList.SelectedValue == "0")//下线
        {
            if (String.IsNullOrEmpty(this.ddpStatusListRemark.SelectedValue))
            {
                msgString = msgString + GetLocalResourceObject("UpdateErrorDdpStatusListRemark").ToString() + "<br/>";
                bFlag = false;
            }
        }

        if (StringUtility.Text_Length(txtHotelNMEN.Text.ToString().Trim()) > 100)
        {
            msgString = msgString + GetLocalResourceObject("UpdateError12").ToString() + "<br/>";
            bFlag = false;
        }

        if (StringUtility.Text_Length(txtAddress.Text.ToString().Trim()) > 150)
        {
            msgString = msgString + GetLocalResourceObject("UpdateError4").ToString() + "<br/>";
            bFlag = false;
        }

        if (StringUtility.Text_Length(txtWebSite.Text.ToString().Trim()) > 200)
        {
            msgString = msgString + GetLocalResourceObject("UpdateError5").ToString() + "<br/>";
            bFlag = false;
        }

        //if (String.IsNullOrEmpty(txtPhone.Text.ToString().Trim()))
        //{
        //    msgString = msgString + GetLocalResourceObject("UpdateError61").ToString() + "<br/>";
        //    bFlag = false;
        //}

        //if (String.IsNullOrEmpty(txtFax.Text.ToString().Trim()))
        //{
        //    msgString = msgString + GetLocalResourceObject("UpdateError71").ToString() + "<br/>";
        //    bFlag = false;
        //}

        //if (!String.IsNullOrEmpty(txtPhone.Text.ToString().Trim()) && (StringUtility.Text_Length(txtPhone.Text.ToString().Trim()) > 40 ))
        //{
        //    msgString = msgString + GetLocalResourceObject("UpdateError6").ToString() + "<br/>";
        //    bFlag = false;
        //}

        //if (!String.IsNullOrEmpty(txtFax.Text.ToString().Trim()) && (StringUtility.Text_Length(txtFax.Text.ToString().Trim()) > 20 ))
        //{
        //    msgString = msgString + GetLocalResourceObject("UpdateError7").ToString() + "<br/>";
        //    bFlag = false;
        //}

        //if (StringUtility.Text_Length(txtContactPer.Text.ToString().Trim()) > 100)
        //{
        //    msgString = msgString + GetLocalResourceObject("UpdateError10").ToString() + "<br/>";
        //    bFlag = false;
        //}

        //if (StringUtility.Text_Length(txtContactEmail.Text.ToString().Trim()) > 100)
        //{
        //    msgString = msgString + GetLocalResourceObject("UpdateError11").ToString() + "<br/>";
        //    bFlag = false;
        //}

        if ((String.IsNullOrEmpty(txtLatitude.Text.ToString().Trim())) || (String.IsNullOrEmpty(txtLongitude.Text.ToString().Trim())))
        {
            msgString = msgString + GetLocalResourceObject("UpdateError21").ToString() + "<br/>";
            bFlag = false;
        }

        if (!RegexValidateData(txtLatitude.Text.ToString().Trim()) || !RegexValidateData(txtLongitude.Text.ToString().Trim()))
        {
            msgString = msgString + GetLocalResourceObject("UpdateError31").ToString() + "<br/>";
            bFlag = false;
        }

        if (!String.IsNullOrEmpty(txtSimpleDescZh.Text.ToString().Trim()) && (StringUtility.Text_Length(txtSimpleDescZh.Text.ToString().Trim()) > 600))
        {
            msgString = msgString + GetLocalResourceObject("UpdateError8").ToString() + "<br/>";
            bFlag = false;
        }

        if (!String.IsNullOrEmpty(txtDescZh.Text.ToString().Trim()) && (StringUtility.Text_Length(txtDescZh.Text.ToString().Trim()) > 2000))
        {
            msgString = msgString + GetLocalResourceObject("UpdateError81").ToString() + "<br/>";
            bFlag = false;
        }

        string Evaluation = string.Empty;

        for (int i = 0; i < this.gridViewEvaluationList.Rows.Count; i++)
        {
            TextBox txtBox = (TextBox)gridViewEvaluationList.Rows[i].FindControl("txtEvalist");
            if (!ChkEvaContent(txtBox.Text.Trim()))//if (txtBox.Text.Trim().Contains(",") || txtBox.Text.Trim().Contains(","))
            {
                msgString = msgString + GetLocalResourceObject("UpdateError32").ToString() + "<br/>";
                bFlag = false;
                break;
            }
            Evaluation = (!string.IsNullOrEmpty(txtBox.Text.Trim())) ? Evaluation + txtBox.Text.Trim() + "," : Evaluation;
        }

        Evaluation = (Evaluation.Length > 0) ? Evaluation.Substring(0, Evaluation.Length - 1) : Evaluation;

        if (!String.IsNullOrEmpty(Evaluation) && (StringUtility.Text_Length(Evaluation) > 1000))
        {
            msgString = msgString + GetLocalResourceObject("UpdateError9").ToString() + "<br/>";
            bFlag = false;
        }

        if (String.IsNullOrEmpty(txtUHotelPN.Text.ToString().Trim()))
        {
            msgString = msgString + GetLocalResourceObject("CreateError115").ToString() + "<br/>";
            bFlag = false;
        }

        if (StringUtility.Text_Length(txtUHotelPN.Text.ToString().Trim()) > 1000)
        {
            msgString = msgString + GetLocalResourceObject("CreateError101").ToString() + "<br/>";
            bFlag = false;
        }

        if (String.IsNullOrEmpty(txtUTotalRooms.Text.ToString().Trim()))
        {
            msgString = msgString + GetLocalResourceObject("CreateError102").ToString() + "<br/>";
            bFlag = false;
        }

        if (!ChkNumber(txtUTotalRooms.Text.ToString().Trim()))
        {
            msgString = msgString + GetLocalResourceObject("CreateError103").ToString() + "<br/>";
            bFlag = false;
        }

        if (String.IsNullOrEmpty(txtUPriceLow.Text.ToString().Trim()) || !ChkNumber(txtUPriceLow.Text.ToString().Trim()))
        {
            msgString = msgString + GetLocalResourceObject("CreateError117").ToString() + "<br/>";
            bFlag = false;
        }

        if (String.IsNullOrEmpty(txtUHotelJP.Text.ToString().Trim()))
        {
            msgString = msgString + GetLocalResourceObject("CreateError116").ToString() + "<br/>";
            bFlag = false;
        }

        if (StringUtility.Text_Length(txtUHotelJP.Text.ToString().Trim()) > 1000)
        {
            msgString = msgString + GetLocalResourceObject("CreateError104").ToString() + "<br/>";
            bFlag = false;
        }

        string strCity = hidUCityID.Value.Trim();

        if (String.IsNullOrEmpty(strCity.ToString().Trim()))
        {
            msgString = msgString + GetLocalResourceObject("CreateError105").ToString() + "<br/>";
            bFlag = false;
        }
        else if (!strCity.Contains("[") && !strCity.Contains("]"))
        {
            msgString = msgString + GetLocalResourceObject("CreateError118").ToString() + "<br/>";
            bFlag = false;
        }

        if (String.IsNullOrEmpty(txtUHotelFax.Text.ToString().Trim()))
        {
            msgString = msgString + GetLocalResourceObject("CreateError71").ToString() + "<br/>";
            bFlag = false;
        }

        if (!String.IsNullOrEmpty(txtUHotelFax.Text.ToString().Trim()) && (StringUtility.Text_Length(txtUHotelFax.Text.ToString().Trim()) > 100))
        {
            msgString = msgString + GetLocalResourceObject("CreateError7").ToString() + "<br/>";
            bFlag = false;
        }

        if (!String.IsNullOrEmpty(txtURemark.Text.ToString().Trim()) && (StringUtility.Text_Length(txtURemark.Text.ToString().Trim()) > 2000))
        {
            msgString = msgString + GetLocalResourceObject("CreateError91").ToString() + "<br/>";
            bFlag = false;
        }

        if (String.IsNullOrEmpty(txtUContactPhone.Text.ToString().Trim()))
        {
            msgString = msgString + GetLocalResourceObject("CreateError110").ToString() + "<br/>";
            bFlag = false;
        }

        if (!String.IsNullOrEmpty(txtUContactPhone.Text.ToString().Trim()) && (StringUtility.Text_Length(txtUContactPhone.Text.ToString().Trim()) > 30))
        {
            msgString = msgString + GetLocalResourceObject("CreateError111").ToString() + "<br/>";
            bFlag = false;
        }

        if (String.IsNullOrEmpty(txtUHotelTel.Text.ToString().Trim()))
        {
            msgString = msgString + GetLocalResourceObject("CreateError61").ToString() + "<br/>";
            bFlag = false;
        }

        if (!String.IsNullOrEmpty(txtUHotelTel.Text.ToString().Trim()) && (StringUtility.Text_Length(txtUHotelTel.Text.ToString().Trim()) > 40))
        {
            msgString = msgString + GetLocalResourceObject("CreateError6").ToString() + "<br/>";
            bFlag = false;
        }

        //if (String.IsNullOrEmpty(txtUContactEmail.Text.ToString().Trim()))
        //{
        //    msgString = msgString + GetLocalResourceObject("CreateError113").ToString() + "<br/>";
        //    bFlag = false;
        //}

        if (StringUtility.Text_Length(txtUContactEmail.Text.ToString().Trim()) > 100)
        {
            msgString = msgString + GetLocalResourceObject("CreateError11").ToString() + "<br/>";
            bFlag = false;
        }

        if (!String.IsNullOrEmpty(hidUKeyWords.Value) && (StringUtility.Text_Length(hidUKeyWords.Value.Trim().TrimEnd(',')) > 300))
        {
            msgString = msgString + GetLocalResourceObject("CreateError10").ToString() + "<br/>";
            bFlag = false;
        }

        if (!hidOnline.Value.Equals(ddpStatusList.SelectedValue) && !chkDaveValEmpty())
        {
            msgString = msgString + GetLocalResourceObject("UpdateError91").ToString() + "<br/>";
            bFlag = false;
        }

        if (!bFlag)
        {
            MessageContent.InnerHtml = GetLocalResourceObject("UpdateError1").ToString() + "<br/>" + msgString;
            return false;
        }
        #endregion

        _hotelinfoEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _hotelinfoEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _hotelinfoEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _hotelinfoEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _hotelinfoEntity.HotelInfoDBEntity = new List<HotelInfoDBEntity>();
        HotelInfoDBEntity hotelInfoDBEntity = new HotelInfoDBEntity();

        //hotelInfoDBEntity.ID = hidHotelNo.Value;
        //hotelInfoDBEntity.HotelID = hidHotelID.Value;
        //hotelInfoDBEntity.Name_CN = txtHotelNM.Text.Trim();
        //hotelInfoDBEntity.Name_EN = txtHotelNMEN.Text.Trim();
        //hotelInfoDBEntity.Status = ddpStatusList.SelectedValue;
        //hotelInfoDBEntity.StarRating = ddpUStarRating.SelectedValue.Split(',')[0].ToString();
        //hotelInfoDBEntity.DiamondRating = ddpUStarRating.SelectedValue.Split(',')[1].ToString();
        //hotelInfoDBEntity.City = hidCityID.Value;// ddpCity.SelectedValue;
        //hotelInfoDBEntity.OpenDate = dpOpenDate.Value;
        //hotelInfoDBEntity.RepairDate = dpRepairDate.Value;
        //hotelInfoDBEntity.AddRess = txtAddress.Text.Trim();
        //hotelInfoDBEntity.WebSite = txtWebSite.Text.Trim();
        //hotelInfoDBEntity.Longitude = txtLongitude.Text.Trim();
        //hotelInfoDBEntity.Latitude = txtLatitude.Text.Trim();
        //hotelInfoDBEntity.SimpleDescZh = txtSimpleDescZh.Text.Trim();
        //hotelInfoDBEntity.DescZh = txtDescZh.Text.Trim();
        //hotelInfoDBEntity.Evaluation = Evaluation;
        //hotelInfoDBEntity.AutoTrust = "1";
        //hotelInfoDBEntity.FogStatus = hidFogStatus.Value;

        hotelInfoDBEntity.ID = hidHotelNo.Value;
        hotelInfoDBEntity.HotelID = hidHotelID.Value;
        hotelInfoDBEntity.Name_CN = txtHotelNM.Text.Trim();
        hotelInfoDBEntity.Name_EN = txtHotelNMEN.Text.Trim();
        hotelInfoDBEntity.Status = ddpStatusList.SelectedValue;
        if (ddpStatusList.SelectedValue == "0")
        {
            hotelInfoDBEntity.Remark = ddpStatusListRemark.SelectedValue;
        }
        hotelInfoDBEntity.City = (hidUCityID.Value.IndexOf("]") >= 0) ? hidUCityID.Value.Substring((hidUCityID.Value.IndexOf('[') + 1), (hidUCityID.Value.IndexOf(']') - 1)) : "";
        hotelInfoDBEntity.HotelGroup = (hidHotelGroup.Value.IndexOf("]") >= 0) ? hidHotelGroup.Value.Substring((hidHotelGroup.Value.IndexOf('[') + 1), (hidHotelGroup.Value.IndexOf(']') - 1)) : "";//酒店集团
        hotelInfoDBEntity.StarRating = ddpUStarRating.SelectedValue;
        hotelInfoDBEntity.AddRess = txtAddress.Text.Trim();
        hotelInfoDBEntity.Phone = txtUHotelTel.Text.Trim();
        hotelInfoDBEntity.Fax = txtUHotelFax.Text.Trim();
        hotelInfoDBEntity.Longitude = txtLongitude.Text.Trim();
        hotelInfoDBEntity.Latitude = txtLatitude.Text.Trim();
        hotelInfoDBEntity.BDLongitude = txtBDLongitude.Text.Trim();
        hotelInfoDBEntity.BDLatitude = txtBDLatitude.Text.Trim();
        hotelInfoDBEntity.Bussiness = hidBussList.Value.Trim();
        hotelInfoDBEntity.OpenDate = dpOpenDate.Value;
        hotelInfoDBEntity.RepairDate = dpRepairDate.Value;
        hotelInfoDBEntity.SimpleDescZh = txtSimpleDescZh.Text.Trim();
        hotelInfoDBEntity.DescZh = txtDescZh.Text.Trim();
        hotelInfoDBEntity.Status = ddpStatusList.SelectedValue.Trim();
        hotelInfoDBEntity.HotelPN = txtUHotelPN.Text.Trim();
        hotelInfoDBEntity.TotalRooms = txtUTotalRooms.Text.Trim();
        hotelInfoDBEntity.HotelJP = txtUHotelJP.Text.Trim();
        hotelInfoDBEntity.Zip = txtUZip.Text.Trim();
        hotelInfoDBEntity.PriceLow = txtUPriceLow.Text.Trim();
        hotelInfoDBEntity.ContactPer = txtUContactNameZh.Text.Trim();
        hotelInfoDBEntity.ContactPhone = txtUContactPhone.Text.Trim();
        hotelInfoDBEntity.ContactEmail = txtUContactEmail.Text.Trim();
        hotelInfoDBEntity.WebSite = txtWebSite.Text.Trim();
        hotelInfoDBEntity.Evaluation = Evaluation;
        hotelInfoDBEntity.HotelRemark = txtURemark.Text.ToString().Trim();
        hotelInfoDBEntity.FogStatus = hidFogStatus.Value;
        hotelInfoDBEntity.KeyWords = hidUKeyWords.Value.Trim().TrimEnd(',');
        hotelInfoDBEntity.IsMyHotel = ddlUpdateIsMyHotel.SelectedValue;//是否为自签酒店

        _hotelinfoEntity.HotelInfoDBEntity.Add(hotelInfoDBEntity);
        int iResult = HotelInfoBP.UpdateHotelInfo(_hotelinfoEntity).Result;

        _commonEntity.LogMessages = _hotelinfoEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        commonDBEntity.Event_Type = "酒店基础信息-保存";
        commonDBEntity.Event_ID = hidHotelID.Value;
        string conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        conTent = string.Format(conTent, hidHotelID.Value, hotelInfoDBEntity.Name_CN, hotelInfoDBEntity.Name_EN, hotelInfoDBEntity.City, hotelInfoDBEntity.StarRating, hotelInfoDBEntity.AddRess, hotelInfoDBEntity.Phone, hotelInfoDBEntity.Fax, hotelInfoDBEntity.Longitude, hotelInfoDBEntity.Latitude, hotelInfoDBEntity.Bussiness, hotelInfoDBEntity.OpenDate, hotelInfoDBEntity.RepairDate, hotelInfoDBEntity.SimpleDescZh, hotelInfoDBEntity.DescZh, hotelInfoDBEntity.Status, hotelInfoDBEntity.HotelPN, hotelInfoDBEntity.TotalRooms, hotelInfoDBEntity.HotelJP, hotelInfoDBEntity.Zip, hotelInfoDBEntity.PriceLow, hotelInfoDBEntity.ContactPer, hotelInfoDBEntity.ContactPhone, hotelInfoDBEntity.ContactEmail, hotelInfoDBEntity.WebSite, hotelInfoDBEntity.Evaluation, hotelInfoDBEntity.HotelRemark, hotelInfoDBEntity.BDLongitude, hotelInfoDBEntity.BDLatitude, hotelInfoDBEntity.KeyWords);

        //string conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        //conTent = string.Format(conTent, hotelInfoDBEntity.HotelID, hotelInfoDBEntity.Name_CN, hotelInfoDBEntity.Status, hotelInfoDBEntity.HotelGroup, hotelInfoDBEntity.StarRating, hotelInfoDBEntity.DiamondRating, hotelInfoDBEntity.City, hotelInfoDBEntity.OpenDate.ToString(), hotelInfoDBEntity.RepairDate.ToString(), hotelInfoDBEntity.AddRess, hotelInfoDBEntity.WebSite, hotelInfoDBEntity.SimpleDescZh, hotelInfoDBEntity.DescZh, hotelInfoDBEntity.Evaluation);
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateSuccess").ToString();
            MessageContent.InnerHtml = GetLocalResourceObject("UpdateSuccess").ToString();
        }
        else if (iResult == 3)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError331").ToString();
            MessageContent.InnerHtml = GetLocalResourceObject("UpdateError331").ToString();
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError1").ToString();
            MessageContent.InnerHtml = GetLocalResourceObject("UpdateError1").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);

        if (iResult == 1)
        {
            return true;
        }
        else
        {
            return false;
        }
    }
    /// <summary>
    /// 绑定酒店商圈
    /// </summary>
    public void BindHotelTagIngo()
    {
        MessageContent.InnerHtml = "";
        ELRelationEntity _ELRelationEntity = new ELRelationEntity();
        _ELRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _ELRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _ELRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _ELRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _ELRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
        ELRelationDBEntity elrelationDBEntity = new ELRelationDBEntity();
        elrelationDBEntity.HVPID = hidHotelID.Value;
        _ELRelationEntity.ELRelationDBEntity.Add(elrelationDBEntity);
        DataTable ds = ELRelationBP.HVPHotelSelectCircle(_ELRelationEntity).QueryResult.Tables[0];
        if (ds != null && ds.Rows.Count > 0)
        {
            _hotelinfoEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
            _hotelinfoEntity.LogMessages.Userid = UserSession.Current.UserAccount;
            _hotelinfoEntity.LogMessages.Username = UserSession.Current.UserDspName;
            _hotelinfoEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

            _hotelinfoEntity.HotelInfoDBEntity = new List<HotelInfoDBEntity>();
            HotelInfoDBEntity hotelInfoDBEntity = new HotelInfoDBEntity();
            hotelInfoDBEntity.HotelID = hidHotelID.Value;
            _hotelinfoEntity.HotelInfoDBEntity.Add(hotelInfoDBEntity);

            DataSet dsResult = HotelInfoBP.GetTagInfoAERA(_hotelinfoEntity).QueryResult;
            StringBuilder sb = new StringBuilder();
            if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < dsResult.Tables[0].Rows.Count; i++)
                {
                    sb.Append("<span style='background:#DBEAF9;height:15px;margin-right:10px;background-position: right center;background-repeat: no-repeat'>" + dsResult.Tables[0].Rows[i]["REVALUE_ALL"].ToString() + "</span>");
                }
            }
            sb.Append("<input type='button' id='Button1' runat='server' class='btn primary' value='修改' onclick='PopupArea()' />");
            dvUserGroupList.InnerHtml = sb.ToString();
        }
        else
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("<span style='color:red'>该酒店未绑定供应商酒店ID,请先绑定再设置商圈</span>");
            dvUserGroupList.InnerHtml = sb.ToString();
        }
    }
    private void LoadRoomInfoList(string strType, int iIndex)
    {
        hidMsg.Value = "";
        tbRoomBand.Rows.Clear();
        DataSet dsResult = (DataSet)ViewState["dsRoomList"];//dsRoomList;
        int iCsr = 0;
        HtmlTableRow tr = new HtmlTableRow();
        HtmlTableCell td = new HtmlTableCell();
        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < dsResult.Tables[0].Rows.Count; i++)
            {
                tr = new HtmlTableRow();
                tr.Style.Add("cursor", "pointer");
                td = new HtmlTableCell();
                iCsr = int.Parse(dsResult.Tables[0].Rows[i]["CSR"].ToString());
                if (!hidRoomInfoID.Value.Equals(dsResult.Tables[0].Rows[i]["room_code"].ToString()))
                {
                    tr.Style.Add("background", "#E4E4E4");
                    td.Attributes.Add("onclick", "LaodRoomInfo('" + dsResult.Tables[0].Rows[i]["room_code"].ToString() + "')");
                    td.InnerHtml = "<div style='float:left;'><img src='" + ((iCsr > 0) ? "../../Styles/images/star.png" : "../../Styles/images/hstar.png") + "' alt='' /></div><div style='float:left;margin-top:5px'>&nbsp;" + dsResult.Tables[0].Rows[i]["ROOMNM"].ToString() + (String.IsNullOrEmpty(dsResult.Tables[0].Rows[i]["TWOPRICE"].ToString()) ? "" : "(" + dsResult.Tables[0].Rows[i]["TWOPRICE"].ToString() + "元/间)") + "</div>";
                }
                else
                {
                    td.Style.Add("background", "#6379B2");
                    td.Style.Add("height", "35px");
                    //td.Attributes.Add("onclick", "LaodRoomInfo('" + dsResult.Tables[0].Rows[i]["room_code"].ToString() + "')");
                    td.InnerHtml = "<div style='float:left;'><img src='" + ((iCsr > 0) ? "../../Styles/images/star.png" : "../../Styles/images/hstar.png") + "' alt='' /></div><div style='float:left;margin-top:6px;color:White;'>&nbsp;" + dsResult.Tables[0].Rows[i]["ROOMNM"].ToString() + (String.IsNullOrEmpty(dsResult.Tables[0].Rows[i]["TWOPRICE"].ToString()) ? "" : "(" + dsResult.Tables[0].Rows[i]["TWOPRICE"].ToString() + "元/间)") + "</div><div style='float:right;margin-top:2px;margin-right:5px'><input type='button' class='btn primary' id='btnAddRoom' value=' + 添加房型供应商' onclick=btnAddRoomMapping('" + dsResult.Tables[0].Rows[i]["room_code"].ToString() + "') /></div>";

                    tr.Cells.Add(td);
                    tbRoomBand.Rows.Add(tr);

                    tr = new HtmlTableRow();
                    td = new HtmlTableCell();
                    td.ID = "tdGridAdd";

                    gridViewRoom.EmptyDataText = "&nbsp;&nbsp;未绑定供应商房型";
                    if (!"0".Equals(strType))
                    {
                        int iEdinIndex = 0;

                        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
                        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
                        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
                        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

                        _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
                        ELRelationDBEntity usergroupEntity = new ELRelationDBEntity();

                        usergroupEntity.HVPID = hidRowID.Value;
                        usergroupEntity.RoomCD = hidRoomInfoID.Value;

                        _elRelationEntity.ELRelationDBEntity.Add(usergroupEntity);
                        DataSet dsTemp = ELRelationBP.ReviewSupRoomMappingDetail(_elRelationEntity).QueryResult;

                        if ("2".Equals(strType))
                        {
                            DataRow drInsert = dsTemp.Tables[0].NewRow();
                            drInsert["SUPID"] = "";
                            drInsert["INUSE"] = "1";
                            drInsert["SOURCES"] = "ELONG";
                            drInsert["SUPNM"] = "艺龙";
                            drInsert["INUSERDIS"] = "上线";
                            drInsert["SUPHID"] = "";
                            drInsert["RTYPE"] = "1";
                            drInsert["OROWID"] = "";
                            dsTemp.Tables[0].Rows.Add(drInsert);
                        }

                        if (dsTemp.Tables[0].Rows.Count > 0)
                        {
                            if ("1".Equals(strType))
                            {
                                iEdinIndex = iIndex;
                            }
                            else if ("2".Equals(strType))
                            {
                                iEdinIndex = dsTemp.Tables[0].Rows.Count - 1;
                            }
                            else
                            {
                                iEdinIndex = dsTemp.Tables[0].Rows.Count - 1;//("0".Equals(dsTemp.Tables[0].Rows[dsTemp.Tables[0].Rows.Count - 1]["RTYPE"].ToString())) ?  : dsTemp.Tables[0].Rows.Count;
                            }
                        }

                        gridViewRoom.EditIndex = iEdinIndex;
                        gridViewRoom.DataSource = null;
                        gridViewRoom.DataSource = dsTemp.Tables[0].DefaultView;
                        gridViewRoom.DataKeyNames = new string[] { "SUPID", "INUSE", "SOURCES", "SUPHID", "RTYPE", "OSOURCES", "OROWID" };
                        gridViewRoom.DataBind();

                        string chkINUSE = gridViewRoom.DataKeys[gridViewRoom.EditIndex][1].ToString();
                        DropDownList ddl = ((DropDownList)gridViewRoom.Rows[gridViewRoom.EditIndex].Cells[0].FindControl("ddlSupDp"));
                        CheckBox chk = ((CheckBox)gridViewRoom.Rows[gridViewRoom.EditIndex].Cells[2].FindControl("chkInUse"));
                        ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(gridViewRoom.DataKeys[gridViewRoom.EditIndex][2].ToString()));
                        chk.Checked = ("1".Equals(chkINUSE)) ? true : false;

                        if ("2".Equals(strType))
                        {
                            DropDownList DDRoom = ((DropDownList)gridViewRoom.Rows[gridViewRoom.EditIndex].Cells[0].FindControl("DDlRoom"));
                            DDRoom.DataSource = getCommon_cun("ELONG");
                            DDRoom.DataTextField = "ROOMNM";
                            DDRoom.DataValueField = "ROOMCD";
                            DDRoom.DataBind();
                            HtmlGenericControl dvGDP = (HtmlGenericControl)gridViewRoom.Rows[gridViewRoom.EditIndex].Cells[0].FindControl("dvGDP");
                            HtmlGenericControl dvGTX = (HtmlGenericControl)gridViewRoom.Rows[gridViewRoom.EditIndex].Cells[0].FindControl("dvGTX");
                            dvGDP.Style.Add("display", "");
                            dvGTX.Style.Add("display", "none");
                        }
                        else
                        {
                            DropDownList DDRoom = ((DropDownList)gridViewRoom.Rows[gridViewRoom.EditIndex].Cells[0].FindControl("DDlRoom"));
                            DDRoom.DataSource = getCommon_cun(ddl.SelectedValue);
                            DDRoom.DataTextField = "ROOMNM";
                            DDRoom.DataValueField = "ROOMCD";
                            DDRoom.DataBind();
                            string strSupID = gridViewRoom.DataKeys[gridViewRoom.EditIndex][3].ToString();
                            DDRoom.SelectedIndex = DDRoom.Items.IndexOf(DDRoom.Items.FindByValue(strSupID));

                            HtmlGenericControl dvGDP = (HtmlGenericControl)gridViewRoom.Rows[gridViewRoom.EditIndex].Cells[0].FindControl("dvGDP");
                            HtmlGenericControl dvGTX = (HtmlGenericControl)gridViewRoom.Rows[gridViewRoom.EditIndex].Cells[0].FindControl("dvGTX");
                            TextBox txtRoomIDEdit = (TextBox)gridViewRoom.Rows[gridViewRoom.EditIndex].Cells[0].FindControl("txtRoomIDEdit");
                            if (((DataTable)DDRoom.DataSource).Rows.Count == 0)
                            {
                                dvGDP.Style.Add("display", "none");
                                dvGTX.Style.Add("display", "");
                                string roomID = gridViewRoom.DataKeys[gridViewRoom.EditIndex][0].ToString();
                                txtRoomIDEdit.Text = roomID;
                            }
                            else
                            {
                                dvGDP.Style.Add("display", "");
                                dvGTX.Style.Add("display", "none");
                            }
                        }
                    }
                    else
                    {
                        gridViewRoom.EditIndex = -1;
                        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
                        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
                        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
                        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

                        _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
                        ELRelationDBEntity usergroupEntity = new ELRelationDBEntity();

                        usergroupEntity.HVPID = hidRowID.Value;
                        usergroupEntity.RoomCD = hidRoomInfoID.Value;

                        _elRelationEntity.ELRelationDBEntity.Add(usergroupEntity);
                        DataSet dsTemp = ELRelationBP.ReviewSupRoomMappingDetail(_elRelationEntity).QueryResult;

                        gridViewRoom.DataSource = null;
                        gridViewRoom.DataSource = dsTemp.Tables[0].DefaultView;
                        gridViewRoom.DataKeyNames = new string[] { "SUPID", "INUSE", "SOURCES", "SUPHID", "RTYPE", "OSOURCES", "OROWID" };
                        gridViewRoom.DataBind();
                    }
                }

                tr.Cells.Add(td);
                tbRoomBand.Rows.Add(tr);
            }
        }
        else
        {
            tr = new HtmlTableRow();
            tr.Style.Add("cursor", "pointer");
            td = new HtmlTableCell();
            td.InnerHtml = "该酒店未设置房型";
            tr.Cells.Add(td);
            tbRoomBand.Rows.Add(tr);
        }

        ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "setScript", "invokeOpenList()", true);
    }
    private void LoadHotelSupDetail(string strType)
    {
        hidMsg.Value = "";
        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
        ELRelationDBEntity usergroupEntity = new ELRelationDBEntity();

        usergroupEntity.HVPID = hidRowID.Value;
        _elRelationEntity.ELRelationDBEntity.Add(usergroupEntity);
        DataSet dsResult = ELRelationBP.ReviewSupHotelMappingDetail(_elRelationEntity).QueryResult;

        if ("1".Equals(strType))
        {
            DataRow drInsert = dsResult.Tables[0].NewRow();
            drInsert["SUPID"] = "";
            drInsert["INUSE"] = "1";
            drInsert["SORC"] = "供应商:";
            drInsert["SORCID"] = "供应商ID:";
            drInsert["INUSERT"] = "状态:";
            drInsert["SOURCES"] = "ELONG";
            drInsert["SUPNM"] = "艺龙";
            drInsert["INUSERDIS"] = "上线";
            drInsert["RTYPE"] = "1";
            drInsert["OSUPID"] = "";
            dsResult.Tables[0].Rows.Add(drInsert);
        }

        gridViewCSList.DataSource = null;
        gridViewCSList.DataSource = dsResult.Tables[0].DefaultView;
        gridViewCSList.DataKeyNames = new string[] { "SUPID", "INUSE", "SOURCES", "RTYPE","OSUPID" };
        gridViewCSList.DataBind();

        UpdatePanel2.Update();
        ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "setScript", "invokeOpenList()", true);
    }
    private int CountLmSystemLog()
    {
        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
        ELRelationDBEntity usergroupEntity = new ELRelationDBEntity();

        usergroupEntity.HVPID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HVPID"].ToString())) ? null : ViewState["HVPID"].ToString();
        usergroupEntity.HVPLP = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HVPLP"].ToString())) ? null : ViewState["HVPLP"].ToString();
        usergroupEntity.HVPRP = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HVPRP"].ToString())) ? null : ViewState["HVPRP"].ToString();

        _elRelationEntity.ELRelationDBEntity.Add(usergroupEntity);
        DataSet dsResult = ELRelationBP.ReviewSupHotelMappingSelectCount(_elRelationEntity).QueryResult;

        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0 && !String.IsNullOrEmpty(dsResult.Tables[0].Rows[0][0].ToString()))
        {
            return int.Parse(dsResult.Tables[0].Rows[0][0].ToString());
        }

        return 0;
    }
    private void BindReviewListGrid()
    {
        //messageContent.InnerHtml = "";
        hidMsg.Value = "";
        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
        ELRelationDBEntity usergroupEntity = new ELRelationDBEntity();

        usergroupEntity.HVPID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HVPID"].ToString())) ? null : ViewState["HVPID"].ToString();
        usergroupEntity.HVPLP = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HVPLP"].ToString())) ? null : ViewState["HVPLP"].ToString();
        usergroupEntity.HVPRP = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HVPRP"].ToString())) ? null : ViewState["HVPRP"].ToString();
        usergroupEntity.Sales = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["SALES"].ToString())) ? null : ViewState["SALES"].ToString();

        _elRelationEntity.PageCurrent = AspNetPager1.CurrentPageIndex;
        _elRelationEntity.PageSize = gridViewCSReviewList.PageSize;

        _elRelationEntity.ELRelationDBEntity.Add(usergroupEntity);
        DataSet dsResult = ELRelationBP.ReviewSupHotelMappingSelect(_elRelationEntity).QueryResult;

        gridViewCSReviewList.DataSource = null;
        gridViewCSReviewList.DataSource = dsResult.Tables[0].DefaultView;
        gridViewCSReviewList.DataKeyNames = new string[] {"HVPID"};
        gridViewCSReviewList.DataBind();

        //DropDownList ddl;
        //for (int i = 0; i <= gridViewCSReviewList.Rows.Count - 1; i++)
        //{
        //    DataRowView drvtemp = dsResult.Tables[0].DefaultView[i];
        //    ddl = (DropDownList)gridViewCSReviewList.Rows[i].FindControl("ddlSupDDp");
        //    if (!String.IsNullOrEmpty(drvtemp["SUPID"].ToString().Trim()))
        //    {
        //        ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByValue(drvtemp["SUPID"].ToString()));
        //    }
        //}

        AspNetPager1.PageSize = gridViewCSReviewList.PageSize;
        AspNetPager1.RecordCount = CountLmSystemLog();

        ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "setScript", "SetAClickEvent()", true);
    }
    protected void gridViewRoom_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        hidMsg.Value = "";
        hidStyle.Value = "";
        string txtHVPID = hidRowID.Value;
        string txtRoomID = hidRoomInfoID.Value;

        string txtSORE = ((DropDownList)gridViewRoom.Rows[e.RowIndex].FindControl("ddlSupDp")).SelectedValue;
        string txtSUPID = GetSupIDVal(e.RowIndex);
        string txtInUse = (((CheckBox)gridViewRoom.Rows[e.RowIndex].FindControl("chkInUse")).Checked) ? "1" : "0";
        string strRtype = gridViewRoom.DataKeys[e.RowIndex][4].ToString();
        string strOSource = gridViewRoom.DataKeys[e.RowIndex][5].ToString();
        string strOSuphid = gridViewRoom.DataKeys[e.RowIndex][3].ToString();
        string strORowid = gridViewRoom.DataKeys[e.RowIndex][6].ToString();

        if (String.IsNullOrEmpty(txtSUPID.Trim()))
        {
            ReLoadRoomInfoList();
            hidMsg.Value = GetLocalResourceObject("Error5").ToString();
            return;
        }

        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
        ELRelationDBEntity ELRelationDBEntity = new ELRelationDBEntity();

        ELRelationDBEntity.HVPID = txtHVPID.Trim();
        ELRelationDBEntity.RoomCD = txtRoomID.Trim();
        ELRelationDBEntity.ELongID = txtSUPID.Trim();
        ELRelationDBEntity.Source = txtSORE.Trim();
        ELRelationDBEntity.SupType = strRtype.Trim();
        ELRelationDBEntity.InUse = txtInUse.Trim();
        ELRelationDBEntity.OSource = strOSource.Trim();
        ELRelationDBEntity.OSuphid = strOSuphid.Trim();
        ELRelationDBEntity.ORowID = strORowid.Trim();

        _elRelationEntity.ELRelationDBEntity.Add(ELRelationDBEntity);
        int iResult = ELRelationBP.UpdateSUPRoomList(_elRelationEntity).Result;

        _commonEntity.LogMessages = _elRelationEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        commonDBEntity.Event_Type = "供应商房型绑定-保存";
        commonDBEntity.Event_ID = txtHVPID.Trim();
        string conTent = GetLocalResourceObject("EventUpdateRoomMessage").ToString();

        conTent = string.Format(conTent, ELRelationDBEntity.HVPID, ELRelationDBEntity.ELongID, Server.UrlDecode(hidHLNM.Value), ELRelationDBEntity.Source, ELRelationDBEntity.InUse);
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateRoomSuccess").ToString();
            //messageContent.InnerHtml = GetLocalResourceObject("UpdateRoomSuccess").ToString();
            gridViewCSList.EditIndex = -1;
            LoadHotelSupDetail("0");
            ReLoadroomSupDetialData();
            LoadRoomInfoList("0", 0);
        }
        else if (iResult == 2)
        {
            ReLoadRoomInfoList();
            hidMsg.Value = GetLocalResourceObject("Error4").ToString();
            return;
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateRoomError").ToString();
            hidMsg.Value = GetLocalResourceObject("UpdateRoomError").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
    }
    protected void gridViewCSReviewList_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        string txtHVPID = gridViewCSReviewList.DataKeys[e.RowIndex][0].ToString();
        string txtSupType = gridViewCSReviewList.DataKeys[e.RowIndex][2].ToString();
        string txtELID = ((TextBox)gridViewCSReviewList.Rows[e.RowIndex].FindControl("txtELIDEdit")).Text;
        string txtSORE = ((DropDownList)gridViewCSReviewList.Rows[e.RowIndex].FindControl("ddlSupDDp")).SelectedValue; ;// gridViewCSReviewList.DataKeys[e.RowIndex][1].ToString();
        //string txtHOTELNM = ((Label)gridViewCSReviewList.Rows[e.RowIndex].FindControl("lblHOTELNM")).Text;

        txtELID = (!String.IsNullOrEmpty(txtSORE) && ("HUBS1".Equals(txtSORE) || "HVP".Equals(txtSORE)) && String.IsNullOrEmpty(txtELID)) ? txtHVPID : txtELID;

        if ((!"HUBS1".Equals(txtSORE) && !"HVP".Equals(txtSORE)) && String.IsNullOrEmpty(txtELID))
        {
            hidMsg.Value = GetLocalResourceObject("Error2").ToString();
            return;
        }

        //if (!String.IsNullOrEmpty(txtELID))
        //{
        //    hidMsg.Value = GetLocalResourceObject("Error1").ToString();
        //    return;
        //}

        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
        ELRelationDBEntity ELRelationDBEntity = new ELRelationDBEntity();

        ELRelationDBEntity.HVPID = txtHVPID.Trim();
        ELRelationDBEntity.ELongID = txtELID.Trim();
        ELRelationDBEntity.Source = txtSORE.Trim();
        ELRelationDBEntity.SupType = txtSupType.Trim();
        //ELRelationDBEntity.HOTELNM = txtHOTELNM.Trim();

        _elRelationEntity.ELRelationDBEntity.Add(ELRelationDBEntity);
        int iResult = ELRelationBP.UpdateELList(_elRelationEntity).Result;

        _commonEntity.LogMessages = _elRelationEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        commonDBEntity.Event_Type = "ELong酒店管理-保存";
        commonDBEntity.Event_ID = txtHVPID.Trim();
        string conTent = GetLocalResourceObject("EventUpdateMessage").ToString();

        conTent = string.Format(conTent, ELRelationDBEntity.HVPID, ELRelationDBEntity.ELongID, ELRelationDBEntity.HOTELNM, ELRelationDBEntity.Source);
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateSuccess").ToString();
            //messageContent.InnerHtml = GetLocalResourceObject("UpdateSuccess").ToString();
            gridViewCSReviewList.EditIndex = -1;
            BindReviewListGrid();//重新绑定显示的页面
            gridViewCSReviewList.SelectedIndex = -1;
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError").ToString();
            hidMsg.Value = GetLocalResourceObject("UpdateError").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
    }
    protected void gridViewCSList_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        hidMsg.Value = "";
        hidStyle.Value = "";
        string txtHVPID = hidRowID.Value;
        string txtOSupId = gridViewCSList.DataKeys[e.RowIndex][0].ToString();
        string txtSupType = gridViewCSList.DataKeys[e.RowIndex][3].ToString();
        string txtOSource = gridViewCSList.DataKeys[e.RowIndex][2].ToString();
        string txtSUPID = ((TextBox)gridViewCSList.Rows[e.RowIndex].FindControl("txtSUPIDEdit")).Text;
        string txtSORE = ((DropDownList)gridViewCSList.Rows[e.RowIndex].FindControl("ddlSupDp")).SelectedValue;
        string txtInUse = (((CheckBox)gridViewCSList.Rows[e.RowIndex].FindControl("chkInUse")).Checked) ? "1" : "0";
        string txtOsupid = gridViewCSList.DataKeys[e.RowIndex][4].ToString();
        txtSUPID = (!String.IsNullOrEmpty(txtSORE) && ("HUBS1".Equals(txtSORE) || "HVP".Equals(txtSORE)) && String.IsNullOrEmpty(txtSUPID)) ? hidRowID.Value : txtSUPID;

        if ((!"HUBS1".Equals(txtSORE) && !"HVP".Equals(txtSORE)) && String.IsNullOrEmpty(txtSUPID))
        {
            ReLoadRoomInfoList();
            hidMsg.Value = GetLocalResourceObject("Error2").ToString();
            return;
        }

        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
        ELRelationDBEntity ELRelationDBEntity = new ELRelationDBEntity();

        ELRelationDBEntity.HVPID = txtHVPID.Trim();
        ELRelationDBEntity.ELongID = txtSUPID.Trim();
        ELRelationDBEntity.Source = txtSORE.Trim();
        ELRelationDBEntity.SupType = txtSupType.Trim();
        ELRelationDBEntity.InUse = txtInUse.Trim();
        ELRelationDBEntity.OSource = txtOSource.Trim();
        ELRelationDBEntity.OSuphid = txtOsupid.Trim();
        ELRelationDBEntity.OSupId = txtOSupId.Trim();

        _elRelationEntity.ELRelationDBEntity.Add(ELRelationDBEntity);
        int iResult = ELRelationBP.UpdateSUPList(_elRelationEntity).Result;

        _commonEntity.LogMessages = _elRelationEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        commonDBEntity.Event_Type = "供应商酒店绑定-保存";
        commonDBEntity.Event_ID = txtHVPID.Trim();
        string conTent = GetLocalResourceObject("EventUpdateMessage").ToString();

        conTent = string.Format(conTent, ELRelationDBEntity.HVPID, ELRelationDBEntity.ELongID, Server.UrlDecode(hidHLNM.Value), ELRelationDBEntity.Source, ELRelationDBEntity.InUse);
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateSuccess").ToString();
            //messageContent.InnerHtml = GetLocalResourceObject("UpdateSuccess").ToString();
            gridViewCSList.EditIndex = -1;
            LoadHotelSupDetail("0");
            //LoadRoomSupDetail("0");
            ReLoadRoomInfoList();
            ddpRoomList = new DataSet();
            ddpRoomList.Tables.Add(new DataTable());
            ddpRoomList.Tables[0].Columns.Add("SUPID");
            ddpRoomList.Tables[0].Columns.Add("SUPNM");

            for (int i = 0; i < gridViewCSList.Rows.Count; i++)
            {
                DataRow dr = ddpRoomList.Tables[0].NewRow();
                dr["SUPNM"] = ((Label)gridViewCSList.Rows[i].Cells[1].FindControl("lblSUPNM")).Text;
                dr["SUPID"] = gridViewCSList.DataKeys[i][2].ToString();
                ddpRoomList.Tables[0].Rows.Add(dr);
            }
            ViewState["ddpRoomList"] = ddpRoomList;
            SetHotelRoomMappingList(txtHVPID.Trim());
            if (ELRelationDBEntity.Source.Equals(ELRelationDBEntity.OSource) || ELRelationDBEntity.ELongID.Equals(ELRelationDBEntity.OSupId))
            {
                hidMsg.Value = GetLocalResourceObject("UpdateSuccess").ToString() + " 请注意,修改酒店供应商后,需重新绑定房型!";
            }
        }
        else if (iResult == 2)
        {
            ReLoadRoomInfoList();
            hidMsg.Value = GetLocalResourceObject("Error3").ToString();
            return;
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError").ToString();
            hidMsg.Value = GetLocalResourceObject("UpdateError").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
    }
    //[WebMethod]
    //public static void SetHotelRoomMappingList(string HidRowID)
    //{
    //    ddpRoomList = new DataSet();
    //    ddpRoomList.Tables.Add(new DataTable());
    //    ddpRoomList.Tables[0].Columns.Add("SUPID");
    //    ddpRoomList.Tables[0].Columns.Add("SUPNM");
    //    dsMappingRoomList = new DataSet();
    //    dsMappingRoomList.Tables.Add(new DataTable());
    //    dsMappingRoomList.Tables[0].Columns.Add("ROOMCD");
    //    dsMappingRoomList.Tables[0].Columns.Add("ROOMNM");
    //    dsMappingRoomList.Tables[0].Columns.Add("SOURCES");
    //    ELRelationEntity _elRelationEntity = new ELRelationEntity();
    //    _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
    //    _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
    //    _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
    //    _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
    //    _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
    //    ELRelationDBEntity usergroupEntity = new ELRelationDBEntity();
    //    usergroupEntity.HVPID = HidRowID;
    //    _elRelationEntity.ELRelationDBEntity.Add(usergroupEntity);
    //    DataSet dsResult = ELRelationBP.SaSupHotelMappingDetail(_elRelationEntity).QueryResult;
    //    for (int i = 0; i < dsResult.Tables["Master"].Rows.Count; i++)
    //    {
    //        DataRow dr = ddpRoomList.Tables[0].NewRow();
    //        dr["SUPNM"] = dsResult.Tables["Master"].Rows[i]["SUPNM"].ToString();
    //        dr["SUPID"] = dsResult.Tables["Master"].Rows[i]["SOURCES"].ToString();
    //        ddpRoomList.Tables[0].Rows.Add(dr);
    //    }
    //    if (dsResult.Tables.Count > 1 && dsResult.Tables["Detail"].Rows.Count > 0)
    //    {
    //        for (int i = 0; i < dsResult.Tables["Detail"].Rows.Count; i++)
    //        {
    //            DataRow dr = dsMappingRoomList.Tables[0].NewRow();
    //            dr["ROOMCD"] = dsResult.Tables["Detail"].Rows[i]["ROOMCD"].ToString();
    //            dr["ROOMNM"] = dsResult.Tables["Detail"].Rows[i]["ROOMNM"].ToString();
    //            dr["SOURCES"] = dsResult.Tables["Detail"].Rows[i]["SOURCES"].ToString();
    //            dsMappingRoomList.Tables[0].Rows.Add(dr);
    //        }
    //    }
    //}
    public void SetHotelRoomMappingList(string HidRowID)
    {
        ddpRoomList = new DataSet();
        ddpRoomList.Tables.Add(new DataTable());
        ddpRoomList.Tables[0].Columns.Add("SUPID");
        ddpRoomList.Tables[0].Columns.Add("SUPNM");

        dsMappingRoomList = new DataSet();
        dsMappingRoomList.Tables.Add(new DataTable());
        dsMappingRoomList.Tables[0].Columns.Add("ROOMCD");
        dsMappingRoomList.Tables[0].Columns.Add("ROOMNM");
        dsMappingRoomList.Tables[0].Columns.Add("SOURCES");

        ELRelationEntity _elRelationEntity = new ELRelationEntity();
        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
        ELRelationDBEntity usergroupEntity = new ELRelationDBEntity();

        usergroupEntity.HVPID = HidRowID;
        _elRelationEntity.ELRelationDBEntity.Add(usergroupEntity);
        DataSet dsResult = ELRelationBP.SaSupHotelMappingDetail(_elRelationEntity).QueryResult;

        for (int i = 0; i < dsResult.Tables["Master"].Rows.Count; i++)
        {
            DataRow dr = ddpRoomList.Tables[0].NewRow();
            dr["SUPNM"] = dsResult.Tables["Master"].Rows[i]["SUPNM"].ToString();
            dr["SUPID"] = dsResult.Tables["Master"].Rows[i]["SOURCES"].ToString();
            ddpRoomList.Tables[0].Rows.Add(dr);
        }

        if (dsResult.Tables.Count > 1 && dsResult.Tables["Detail"].Rows.Count > 0)
        {
            for (int i = 0; i < dsResult.Tables["Detail"].Rows.Count; i++)
            {
                DataRow dr = dsMappingRoomList.Tables[0].NewRow();
                dr["ROOMCD"] = dsResult.Tables["Detail"].Rows[i]["ROOMCD"].ToString();
                dr["ROOMNM"] = dsResult.Tables["Detail"].Rows[i]["ROOMNM"].ToString();
                dr["SOURCES"] = dsResult.Tables["Detail"].Rows[i]["SOURCES"].ToString();
                dsMappingRoomList.Tables[0].Rows.Add(dr);
            }
        }

        ViewState["ddpRoomList"] = ddpRoomList;
        ViewState["dsMappingRoomList"] = dsMappingRoomList;
    }
    private void ReLoadroomSupDetialData()
    {
        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
        ELRelationDBEntity usergroupEntity = new ELRelationDBEntity();

        usergroupEntity.HVPID = hidRowID.Value;
        _elRelationEntity.ELRelationDBEntity.Add(usergroupEntity);
        //dsRoomList = ELRelationBP.ReviewSupHotelRoomMappingDetail(_elRelationEntity).QueryResult;
        ViewState["dsRoomList"] = ELRelationBP.ReviewSupHotelRoomMappingDetail(_elRelationEntity).QueryResult;
    }
    private void LoadRoomSupDetail()
    {
        hidMsg.Value = "";
        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
        ELRelationDBEntity usergroupEntity = new ELRelationDBEntity();

        usergroupEntity.HVPID = hidRowID.Value;
        _elRelationEntity.ELRelationDBEntity.Add(usergroupEntity);
        DataSet dsResult = ELRelationBP.ReviewSupHotelRoomMappingDetail(_elRelationEntity).QueryResult;
        //dsRoomList = dsResult;
        ViewState["dsRoomList"] = dsResult;
        int iCsr = 0;
        HtmlTableRow tr = new HtmlTableRow();
        HtmlTableCell td = new HtmlTableCell();

        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < dsResult.Tables[0].Rows.Count; i++)
            {
                tr = new HtmlTableRow();
                tr.Style.Add("cursor", "pointer");
                tr.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor ='#E4E4E4'");
                tr.Attributes.Add("onmouseout", "this.style.backgroundColor = c");
                td = new HtmlTableCell();
                iCsr = int.Parse(dsResult.Tables[0].Rows[i]["CSR"].ToString());
                td.Attributes.Add("onclick", "LaodRoomInfo('" + dsResult.Tables[0].Rows[i]["room_code"].ToString() + "')");
                td.InnerHtml = "<div style='float:left;'><img src='" + ((iCsr > 0) ? "../../Styles/images/star.png" : "../../Styles/images/hstar.png") + "' alt='' /></div><div style='float:left;margin-top:5px'>&nbsp;" + dsResult.Tables[0].Rows[i]["ROOMNM"].ToString() + (String.IsNullOrEmpty(dsResult.Tables[0].Rows[i]["TWOPRICE"].ToString()) ? "" : "(" + dsResult.Tables[0].Rows[i]["TWOPRICE"].ToString() + "元/间)") + "</div>";
                tr.Cells.Add(td);
                tbRoomBand.Rows.Add(tr);
            }
        }
        else
        {
            tr = new HtmlTableRow();
            tr.Style.Add("cursor", "pointer");
            td = new HtmlTableCell();
            td.InnerHtml = "该酒店未设置房型";
            tr.Cells.Add(td);
            tbRoomBand.Rows.Add(tr);
        }
        gridViewRoom.EmptyDataText = "";
        gridViewRoom.DataSource = null;
        gridViewRoom.DataBind();
        ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "setScript", "invokeOpenList()", true);
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        _elRelationEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _elRelationEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _elRelationEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _elRelationEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        string query = Request.UrlReferrer.Query;
        string[] strCity = query.Split('&');
        string hotelId = strCity[2].ToString().Substring(8, strCity[2].ToString().Length - 8);
        int iResult = 0;

        string[] strId = hidUserGroupList.Value.Trim().Split(',');
        if (hidUserGroupList.Value.Trim().TrimEnd(',').Split(',').Length > 1)
        {
            dvMessageContent.InnerHtml = "酒店商圈关联只能选择一个商圈,请修改!";
            return;
        }

        if (!string.IsNullOrEmpty(hotelId))
        {
            _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
            ELRelationDBEntity ELRelationDBEntity = new ELRelationDBEntity();

            ELRelationDBEntity.HVPID = hotelId.Trim();

            _elRelationEntity.ELRelationDBEntity.Add(ELRelationDBEntity);
            iResult = ELRelationBP.HVPAreaDelete(_elRelationEntity).Result;
        }

        _commonEntity.LogMessages = _elRelationEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();
        try
        {
            for (int i = 0; i < strId.Length; i++)
            {
                if (!string.IsNullOrEmpty(strId[i].ToString().Trim()))
                {
                    _elRelationEntity.ELRelationDBEntity = new List<ELRelationDBEntity>();
                    ELRelationDBEntity ELRelationDBEntity = new ELRelationDBEntity();

                    ELRelationDBEntity.HVPID = hotelId.Trim();
                    ELRelationDBEntity.ELongID = strId[i].Trim().Substring(1, strId[i].Trim().IndexOf("]") - 1);
                    _elRelationEntity.ELRelationDBEntity.Add(ELRelationDBEntity);
                    iResult = ELRelationBP.HVPAreaInsert(_elRelationEntity).Result;

                    commonDBEntity.Event_Type = "酒店商圈关联-保存";
                    commonDBEntity.Event_ID = hotelId.Trim();
                    commonDBEntity.Event_Content = "酒店商圈关联操作,HotelID:" + hotelId.Trim() + ",AreaID:" + strId[i].ToString();
                    commonDBEntity.Event_Result = iResult.ToString() == "1" ? "Success" : "Fail";
                    _commonEntity.CommonDBEntity.Add(commonDBEntity);
                     CommonBP.InsertEventHistory(_commonEntity);
                    _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
                }
            }
        }
        catch (Exception ex)
        {
            commonDBEntity.Event_Type = "酒店商圈关联-保存1";
            commonDBEntity.Event_ID = hotelId.Trim();
            commonDBEntity.Event_Content = "酒店商圈关联操作,HotelID:" + hotelId + ",AreaID:" + strId;
            commonDBEntity.Event_Result = iResult.ToString() == "1" ? "Success" : "Fail";
            _commonEntity.CommonDBEntity.Add(commonDBEntity);
            CommonBP.InsertEventHistory(_commonEntity);
        }

        ScriptManager.RegisterStartupScript(this.UpdatePanel2, this.GetType(), "updateScript", "PageClosed();", true);
    }