protected void btnPrevious_Click(object sender, EventArgs e)
    {
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        appcontentDBEntity.CityID = hidCITYID.Value;
        appcontentDBEntity.TypeID = hidTYPEID.Value;
        appcontentDBEntity.PlatForm = hidPLATID.Value;
        appcontentDBEntity.SerVer = hidVERID.Value;
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        DataSet dsResult = APPContentBP.Select(_appcontentEntity).QueryResult;
        string HotelID = hidHotelID.Value;
        for (int i = 0; i <= dsResult.Tables[0].Rows.Count - 1; i++)
        {
            if (hidHotelID.Value.Equals(dsResult.Tables[0].Rows[i]["HOTELID"].ToString()) && i != 0)
            {
                HotelID = dsResult.Tables[0].Rows[i - 1]["HOTELID"].ToString();
                break;
            }
        }

        hidHotelID.Value = HotelID;
        BindHotelMainListDetail();
    }
    protected void btnAdd2_Click(object sender, EventArgs e)
    {
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        if (String.IsNullOrEmpty(wctHotel.AutoResult) || String.IsNullOrEmpty(hidHotelID2.Value.Trim()))
        {
            messageContent2.InnerHtml = GetLocalResourceObject("HotelIDError").ToString();
            return;
        }

        string strHotelNM = wctHotel.AutoResult.ToString();
        string strHotelID = strHotelNM.Substring((strHotelNM.IndexOf('[') + 1), (strHotelNM.IndexOf(']') - 1));

        appcontentDBEntity.HGroupID = hidHotelGroupID.Value;
        appcontentDBEntity.HotelID = strHotelID;
        appcontentDBEntity.GType = "1";
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        int iResult = APPContentBP.InsertHotelGroupList(_appcontentEntity);

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

        commonDBEntity.Event_Type = "核心酒店每日检查-酒店添加";
        commonDBEntity.Event_ID = strHotelID;
        string conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        conTent = string.Format(conTent, hidHotelGroupID.Value, strHotelID, strHotelNM, "1");
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("InsertSuccess").ToString();
            messageContent2.InnerHtml = GetLocalResourceObject("InsertSuccess").ToString();
            BindHotelListGrid2();
            RefreshHotelCount("1", UserSession.Current.UserDspName);
        }
        else if (iResult == 2)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("InsertError").ToString();
            messageContent2.InnerHtml = GetLocalResourceObject("InsertError").ToString();
        }
        else if (iResult == 3)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("InsertErrorHotel").ToString();
            messageContent2.InnerHtml = GetLocalResourceObject("InsertErrorHotel").ToString();
        }

        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        if (String.IsNullOrEmpty(WebAutoComplete.AutoResult))
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("HotelIDError").ToString();
            PopReseachData();
            return;
        }

        string strHotelNM = WebAutoComplete.AutoResult.ToString();
        string strHotelID = strHotelNM.Substring((strHotelNM.IndexOf('[') + 1), (strHotelNM.IndexOf(']') - 1));
        string strTypeID = ddpAppIgnore.SelectedValue;
        string strTypeNM = ddpAppIgnore.SelectedItem.ToString();

        appcontentDBEntity.HotelID = strHotelID;
        appcontentDBEntity.TypeID = strTypeID;

        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        int iResult = APPContentBP.InsertHotelCompareGrid(_appcontentEntity);

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

        commonDBEntity.Event_Type = "酒店数据同步检查-配置免检项目-添加";
        commonDBEntity.Event_ID = strHotelID;
        string conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        conTent = string.Format(conTent, strHotelNM, strTypeID, strTypeNM);
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("InsertSuccess").ToString();
            detailMessageContent.InnerHtml = GetLocalResourceObject("InsertSuccess").ToString();
        }
        else if (iResult == 2)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("InsertError").ToString();
            detailMessageContent.InnerHtml = GetLocalResourceObject("InsertError").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);

        PopReseachData();
    }
    private void PopReseachData()
    {
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();
        appcontentDBEntity.UserCode = hidUserAccount.Value.Trim();
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);

        DataSet dsResult = APPContentBP.SalesPopGridSelect(_appcontentEntity).QueryResult;
        myGridView.DataSource = dsResult.Tables[0].DefaultView;
        myGridView.DataKeyNames = new string[] { "HOTELID" };//主键
        myGridView.DataBind();
        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "AddNewlist('" + WebAutoComplete.AutoResult + "');", true);
    }
    private void SalesDetailManager()
    {
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        appcontentDBEntity.UserCode = hidUserAccount.Value.Trim();
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        DataSet dsResult = APPContentBP.SalesMangeDetialSelect(_appcontentEntity).QueryResult;

        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
        {
            lbDspName.Text = dsResult.Tables[0].Rows[0]["USERNM"].ToString();
            lbAccount.Text = dsResult.Tables[0].Rows[0]["USERACCOUNT"].ToString();
            lbSaleManager.Text = dsResult.Tables[0].Rows[0]["SALESMANAGER"].ToString();
            lbTel.Text = dsResult.Tables[0].Rows[0]["TEL"].ToString();
            lbHotelSum.Text = dsResult.Tables[0].Rows[0]["HOTELSUM"].ToString();
            PopReseachData();
        }
        else
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("UserIDError").ToString();
        }
    }
    /// <summary>
    /// 计划关房(批量操作 关闭计划)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    public static string btnPlanCloseRoom(string hotelID, string hotelNM, string cityID, string remark, string status, bool isRenew, string StartDate, string EndDate, string dateSE, string Lmbar2RoomCode, string LmbarRoomCode)
    {
        try
        {
            #region
            APPContentEntity _appcontentEntity = new APPContentEntity();
            _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
            _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
            _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
            _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

            CommonEntity _commonEntity = new CommonEntity();
            _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
            _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
            _commonEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
            _commonEntity.LogMessages.Username = UserSession.Current.UserDspName;
            _commonEntity.LogMessages.Userid = UserSession.Current.UserAccount;
            CommonDBEntity commonDBEntity = new CommonDBEntity();

            _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
            APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();
            #endregion
            bool IsFlag = false;
            if (!string.IsNullOrEmpty(dateSE))
            {
                DataTable dtPlanLMBAR2 = GetBindLmbarPlanList(StartDate, EndDate, hotelID, "LMBAR2").Tables[0];//LMBAR2计划
                DataTable dtPlanLMBAR = GetBindLmbarPlanList(StartDate, EndDate, hotelID, "LMBAR").Tables[0];//LMBAR计划

                string[] datas = dateSE.Split(',');
                for (int i = 0; i < datas.Length; i++)
                {
                    if (!string.IsNullOrEmpty(datas[i].ToString()))
                    {
                        //if (DateTime.Parse(datas[i].ToString()).ToShortDateString() == System.DateTime.Now.ToShortDateString())
                        //{
                        //    IsFlag = true;
                        //}
                        string effDate = datas[i].ToString().Replace("/", "-");
                        #region
                        for (int l = 0; l < Lmbar2RoomCode.Split('|').Length; l++)
                        {
                            DataRow[] rowsLmbar2 = dtPlanLMBAR2.Select("EFFECTDATESTRING='" + DateTime.Parse(effDate).ToString("yyyy-MM-dd") + "' and ROOMTYPECODE='" + Lmbar2RoomCode.Split('|')[l].ToString() + "'");
                            for (int j = 0; j < rowsLmbar2.Length; j++)
                            {
                                if (!string.IsNullOrEmpty(rowsLmbar2[j]["RoomNum"].ToString()) && rowsLmbar2[j]["RoomNum"].ToString().ToLower() != "null")
                                {
                                    //城市ID
                                    appcontentDBEntity.CityID = cityID;
                                    //酒店ID
                                    appcontentDBEntity.HotelID = hotelID;
                                    //酒店名称
                                    appcontentDBEntity.HotelNM = hotelNM;
                                    //PlanDate
                                    appcontentDBEntity.PlanTime = DateTime.Parse(effDate).ToShortDateString();
                                    //价格代码
                                    appcontentDBEntity.PriceCode = rowsLmbar2[j]["RATECODE"].ToString();
                                    //价格
                                    appcontentDBEntity.TwoPrice = rowsLmbar2[j]["TWOPRICE"].ToString();
                                    //状态     开启 关闭
                                    appcontentDBEntity.PlanStatus = status == "" ? rowsLmbar2[j]["STATUS"].ToString() : status;
                                    appcontentDBEntity.RoomCount = rowsLmbar2[j]["ROOMNUM"].ToString();
                                    appcontentDBEntity.IsReserve = rowsLmbar2[j]["ISRESERVE"].ToString();
                                    //房型名称
                                    appcontentDBEntity.RoomName = rowsLmbar2[j]["ROOMTYPENAME"].ToString();
                                    //房型Code
                                    appcontentDBEntity.RoomCode = rowsLmbar2[j]["ROOMTYPECODE"].ToString();

                                    appcontentDBEntity.WeekList = "1,2,3,4,5,6,7";
                                    //备注
                                    appcontentDBEntity.Remark = remark;
                                    //操作人
                                    appcontentDBEntity.CreateUser = UserSession.Current.UserAccount;

                                    _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
                                    CommonBP.InsertConsultRoomHistory(_appcontentEntity);
                                    _appcontentEntity.APPContentDBEntity.Clear();
                                }
                            }
                        }
                        #endregion
                        #region
                        for (int l = 0; l < LmbarRoomCode.Split('|').Length; l++)
                        {
                            DataRow[] rowsLmbar = dtPlanLMBAR.Select("EFFECTDATESTRING='" + DateTime.Parse(effDate).ToString("yyyy-MM-dd") + "' and ROOMTYPECODE='" + LmbarRoomCode.Split('|')[l].ToString() + "'");
                            for (int j = 0; j < rowsLmbar.Length; j++)
                            {
                                if (!string.IsNullOrEmpty(rowsLmbar[j]["ROOMNUM"].ToString()) && rowsLmbar[j]["RoomNum"].ToString().ToLower() != "null")
                                {
                                    //城市ID
                                    appcontentDBEntity.CityID = cityID;
                                    //酒店ID
                                    appcontentDBEntity.HotelID = hotelID;
                                    //酒店名称
                                    appcontentDBEntity.HotelNM = hotelNM;
                                    //PlanDate
                                    appcontentDBEntity.PlanTime = DateTime.Parse(effDate).ToShortDateString();
                                    //价格代码
                                    appcontentDBEntity.PriceCode = rowsLmbar[j]["RATECODE"].ToString();
                                    //价格
                                    appcontentDBEntity.TwoPrice = rowsLmbar[j]["TWOPRICE"].ToString();
                                    //状态     开启 关闭
                                    appcontentDBEntity.PlanStatus = status == "" ? rowsLmbar[j]["STATUS"].ToString() : status;
                                    appcontentDBEntity.RoomCount = rowsLmbar[j]["ROOMNUM"].ToString();
                                    appcontentDBEntity.IsReserve = rowsLmbar[j]["ISRESERVE"].ToString();
                                    //房型名称
                                    appcontentDBEntity.RoomName = rowsLmbar[j]["ROOMTYPENAME"].ToString();
                                    //房型Code
                                    appcontentDBEntity.RoomCode = rowsLmbar[j]["ROOMTYPECODE"].ToString();

                                    appcontentDBEntity.WeekList = "1,2,3,4,5,6,7";
                                    //备注
                                    appcontentDBEntity.Remark = remark;
                                    //操作人
                                    appcontentDBEntity.CreateUser = UserSession.Current.UserAccount;
                                    _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
                                    CommonBP.InsertConsultRoomHistory(_appcontentEntity);
                                    _appcontentEntity.APPContentDBEntity.Clear();
                                }
                            }
                        }
                        #endregion
                        if (isRenew)
                        {
                            appcontentDBEntity.HotelID = hotelID;
                            appcontentDBEntity.StartDTime = effDate;
                            appcontentDBEntity.EndDTime = effDate;
                            appcontentDBEntity.Lmbar2RoomCode = Lmbar2RoomCode.Replace("|", ",");
                            appcontentDBEntity.LmbarRoomCode = LmbarRoomCode.Replace("|", ",");
                            appcontentDBEntity.TypeID = status == "true" ? "3" : "2";// "2";//type:1 满房、2 关房、3 开房
                            appcontentDBEntity.UpdateUser = UserSession.Current.UserAccount;
                            _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);

                            _appcontentEntity = HotelInfoBP.BatchUpdatePlan(_appcontentEntity);

                            if (_appcontentEntity.Result == 2)
                            {
                                return "{\"message\":\"Fail\",\"code\":-1}";
                            }
                            _appcontentEntity.APPContentDBEntity.Clear();
                        }
                    }
                }
            }
            return "{\"message\":\"success\",\"code\":200}";
        }
        catch (Exception ex)
        {
            return "{\"message\":\"fail\",\"code\":-1}";
        }
    }
    protected void btnDivRenewPlan_Click(object sender, EventArgs e)
    {
        string EffectDate = this.HiddenEffectDate.Value;

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

        CommonEntity _commonEntity = new CommonEntity();
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _commonEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _commonEntity.LogMessages.Userid = UserSession.Current.UserAccount;

        CommonDBEntity commonDBEntity = new CommonDBEntity();
        commonDBEntity.Event_Type = "酒店管理-房控计划单个维护";
        commonDBEntity.Event_ID = ViewState["hotelID"].ToString();
        commonDBEntity.IpAddress = UserSession.Current.UserIP;
        commonDBEntity.UserID = UserSession.Current.UserAccount;
        commonDBEntity.UserName = UserSession.Current.UserDspName;

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        appcontentDBEntity.HotelID = ViewState["hotelID"].ToString();

        appcontentDBEntity.PriceCode = this.HiddenPriceCode.Value;//价格代码

        appcontentDBEntity.RoomName = this.HiddenRoomType.Value;//房型名称
        appcontentDBEntity.RoomCode = this.HiddenRoomCode.Value;

        appcontentDBEntity.RoomStatus = this.dropDivStatusOpen.Checked == true ? "true" : "false";//this.dropDivStatus.SelectedValue;
        if (this.dropDivStatusOpen.Checked)
        {
            appcontentDBEntity.RoomCount = this.txtDivRoomCount.Text;
            appcontentDBEntity.IsReserve = this.ckDivReserve.Checked == true ? "0" : "1";
        }
        appcontentDBEntity.WeekList = "1,2,3,4,5,6,7";
        appcontentDBEntity.StartDTime = this.HiddenEffectDate.Value;
        appcontentDBEntity.EndDTime = this.HiddenEffectDate.Value;
        appcontentDBEntity.UpdateUser = UserSession.Current.UserDspName;

        commonDBEntity.Event_Content = "房控计划单个更新 - 酒店ID:" + ViewState["hotelID"].ToString() + " 价格代码:" + appcontentDBEntity.PriceCode + " 房型Code:" + appcontentDBEntity.RoomCode + " 计划开始生效时间:" + appcontentDBEntity.StartDTime + "  计划结束生效时间:" + appcontentDBEntity.EndDTime + " 计划状态:" + appcontentDBEntity.RoomStatus;
        commonDBEntity.Event_Result = "已提交";

        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);

        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        _appcontentEntity = HotelInfoBP.RenewPlanFullRoom(_appcontentEntity);

        BindData();
    }
    /// <summary>
    /// 更新计划 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnDivRenewPlan_Click(object sender, EventArgs e)
    {
        APPContentEntity _appcontentEntity = new APPContentEntity();
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        CommonEntity _commonEntity = new CommonEntity();
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _commonEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _commonEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();
        #region
        //城市ID
        string CityID = this.HidCityID.Value;
        appcontentDBEntity.CityID = CityID;
        //酒店ID
        string hotelID = this.HidPid.Value;
        appcontentDBEntity.HotelID = hotelID;
        //酒店名称
        string hotelName = this.HidPcode.Value;
        appcontentDBEntity.HotelNM = hotelName;
        //价格代码
        string priceCode = this.HiddenPriceCode.Value;
        appcontentDBEntity.PriceCode = priceCode;
        //价格
        string twoPrice = this.HiddenPrice.Value;
        appcontentDBEntity.TwoPrice = twoPrice;
        //状态     开启 关闭
        string status = this.dropDivStatusOpen.Checked == true ? "true" : "false";
        appcontentDBEntity.RoomStatus = status;
        appcontentDBEntity.PlanStatus = status;
        if (status == "true")
        {
            //房量
            if (this.txtDivRoomCount.Text.Trim() != "")
            {
                string roomNum = this.txtDivRoomCount.Text;
                appcontentDBEntity.RoomCount = roomNum;
            }
            //是否是保留房
            string isReserve = this.ckDivReserve.Checked == true ? "0" : "1";
            appcontentDBEntity.IsReserve = isReserve;
        }
        else
        {
            appcontentDBEntity.RoomCount = this.HiddenRoomNum.Value;
            appcontentDBEntity.IsReserve = this.HiddenIsReserve.Value;
        }
        //房型名称
        string RoomName = this.HiddenRoomName.Value;
        appcontentDBEntity.RoomName = RoomName;
        //房型Code
        string RoomCode = this.HiddenRoomCode.Value;
        appcontentDBEntity.RoomCode = RoomCode;

        bool IsFlag = false;

        //批量更新日期   开始  结束
        string divPlanStartDate = this.divPlanStartDate.Value;
        string divPlanEndDate = this.divPlanEndDate.Value;
        //if (DateTime.Parse(divPlanStartDate) >= System.DateTime.Now || DateTime.Parse(divPlanEndDate) <= System.DateTime.Now)
        if (DateTime.Parse(divPlanStartDate) == DateTime.Parse(System.DateTime.Now.ToShortDateString()))
        {
            IsFlag = true;
        }
        appcontentDBEntity.WeekList = "1,2,3,4,5,6,7";

        //备注
        string remark = this.txtRemark.Value;
        appcontentDBEntity.Remark = remark;
        //操作人
        string userName = UserSession.Current.UserAccount;
        appcontentDBEntity.CreateUser = userName;
        appcontentDBEntity.UpdateUser = userName;

        #endregion

        #region
        appcontentDBEntity.StartDTime = divPlanStartDate;
        appcontentDBEntity.EndDTime = divPlanEndDate;
        int DateDiff = calculateDateDiff(divPlanStartDate, divPlanEndDate);

        for (int j = 0; j <= DateDiff; j++)
        {
            appcontentDBEntity.PlanTime = DateTime.Parse(divPlanStartDate).AddDays(j).ToShortDateString();
            _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
            CommonBP.InsertConsultRoomHistory(_appcontentEntity);
            _appcontentEntity.APPContentDBEntity.Clear();
        }

        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);

        _appcontentEntity = HotelInfoBP.RenewPlanFullRoomByUpdatePlan(_appcontentEntity);

        int SelectedIndex = int.Parse(this.HidSelIndex.Value);
        //ScriptManager.RegisterStartupScript(this.UpdatePanel4, this.GetType(), "clickbtnSingle", "ClickEvent('" + this.HidPcode.Value + "','" + this.HidPid.Value + "','" + SelectedIndex + "','" + this.HidCityID.Value + "','false');", true);
        //ScriptManager.RegisterStartupScript(this.UpdatePanel4, this.GetType(), "clickbtnSingle", "ClickEvent('" + this.HidPcode.Value + "','" + this.HidPid.Value + "','" + SelectedIndex + "','" + this.HidCityID.Value + "','" + this.HidHotelEXLinkMan.Value + "','" + this.HidHotelEXLinkTel.Value + "','" + this.HidHotelEXLinkRemark.Value + "','false','true','false');", true);
        btnSingleHotel_Click(null, null);
        //ScriptManager.RegisterStartupScript(this.UpdatePanel4, this.GetType(), "scrollReset", "GetResultFromServer();", true);
        if (IsFlag)
        {
            if (DateTime.Now.Hour >= 18)
            {
                if (gridHotelList.Rows[SelectedIndex].BackColor != System.Drawing.ColorTranslator.FromHtml("#FF6666"))
                {
                    gridHotelList.Rows[SelectedIndex].Cells[6].Text = "#FF6666";
                    gridHotelList.Rows[SelectedIndex].Cells[7].Text = "#CD5C5C";
                    this.operandNum.InnerText = (int.Parse(this.operandNum.InnerText) + 1).ToString();
                    gridHotelList.Rows[SelectedIndex].BackColor = System.Drawing.ColorTranslator.FromHtml("#FF6666");
                    ((System.Web.UI.WebControls.WebControl)((Label)gridHotelList.Rows[int.Parse(this.HidSelIndex.Value)].FindControl("Label1"))).BackColor = System.Drawing.ColorTranslator.FromHtml("#CD5C5C");
                }
            }
            else
            {
                if (gridHotelList.Rows[SelectedIndex].BackColor != System.Drawing.ColorTranslator.FromHtml("#80c0a0"))
                {
                    gridHotelList.Rows[SelectedIndex].Cells[6].Text = "#80c0a0";
                    gridHotelList.Rows[SelectedIndex].Cells[7].Text = "#70A88C";
                    this.operandNum.InnerText = (int.Parse(this.operandNum.InnerText) + 1).ToString();
                    gridHotelList.Rows[SelectedIndex].BackColor = System.Drawing.ColorTranslator.FromHtml("#80c0a0");
                    ((System.Web.UI.WebControls.WebControl)((Label)gridHotelList.Rows[int.Parse(this.HidSelIndex.Value)].FindControl("Label1"))).BackColor = System.Drawing.ColorTranslator.FromHtml("#70A88C");
                }
            }
        }
        #endregion
        ScriptManager.RegisterStartupScript(this.UpdatePanel10, this.GetType(), "keyinvokeCloseDiv", "invokeCloseDiv();", true);
        ScriptManager.RegisterStartupScript(this.UpdatePanel10, this.GetType(), "keyinvokeCloseDiv1", "BtnCompleteStyle();", true);
        this.UpdatePanel5.Update();
    }
    protected void gridViewCSAPPContenList_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string strHotelID = gridViewCSAPPContenList.Rows[e.RowIndex].Cells[0].Text.ToString();
        string strHotelNM = gridViewCSAPPContenList.Rows[e.RowIndex].Cells[1].Text.ToString();

        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        appcontentDBEntity.HotelID = strHotelID;
        appcontentDBEntity.HGroupID = hidHotelGroupID.Value;
        appcontentDBEntity.GType = "0";
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        int iResult = APPContentBP.DeteleHotelGroupList(_appcontentEntity);

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

        commonDBEntity.Event_Type = "核心酒店每日检查-酒店删除";
        commonDBEntity.Event_ID = strHotelID;
        string conTent = GetLocalResourceObject("EventDeteleMessage").ToString();
        conTent = string.Format(conTent, hidHotelGroupID.Value, strHotelID, strHotelNM, "0");
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("DeteleSuccess").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("DeteleSuccess").ToString();
            BindHotelListGrid();
            RefreshHotelCount("0", "");
        }
        else if (iResult == 2)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("DeteleError").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("DeteleError").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
    }
    private bool ChkPlanDTimeOut(string PlanID)
    {
        bool bResult = true;
        APPContentEntity _appcontentEntity = new APPContentEntity();
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();
        appcontentDBEntity.PlanID = PlanID.Trim();
        appcontentDBEntity.UpdateUser = UserSession.Current.UserDspName;
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        DataSet dsResult = APPContentBP.ReviewSalesPlanDetail(_appcontentEntity).QueryResult;
        if (DateTime.Now > DateTime.Parse(dsResult.Tables[0].Rows[0]["PLANDTIME"].ToString().Trim()).AddMinutes(-15))
        {
            bResult = false;
        }
        return bResult;
    }
    private bool ChkLowPrice(string param)
    {
        APPContentEntity _appcontentEntity = new APPContentEntity();
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();
        string HotelID = hidHotelID.Value.ToString().Trim().Substring((hidHotelID.Value.ToString().Trim().IndexOf('[') + 1), (hidHotelID.Value.ToString().Trim().IndexOf(']') - 1));
        appcontentDBEntity.HotelID = HotelID;
        appcontentDBEntity.UpdateUser = UserSession.Current.UserDspName;
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);

        DataSet dsResult = APPContentBP.ChkHotelLowLimitPrice(_appcontentEntity).QueryResult;

        if (dsResult.Tables.Count == 0 || dsResult.Tables[0].Rows.Count == 0 || String.IsNullOrEmpty(dsResult.Tables[0].Rows[0][0].ToString().Trim()))
        {
            return true;
        }

        decimal ilimit = decimal.Parse(dsResult.Tables[0].Rows[0][0].ToString().Trim());

        if (ilimit < 1)
        {
            return true;
        }

        if (decimal.Parse(param) <= ilimit)
        {
            messageContent.InnerHtml = String.Format(GetLocalResourceObject("Error20").ToString(), ilimit);
            return false;
        }

        return true;
    }
    private string GetCityByHotelID(string hotelId)
    {
        APPContentEntity _appcontentEntity = new APPContentEntity();
        CommonEntity _commonEntity = new CommonEntity();

        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();
        appcontentDBEntity.HotelID = hotelId;
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        DataSet dsResult = APPContentBP.SelectPropByPic(_appcontentEntity).QueryResult;
        return dsResult.Tables[0].Rows[0]["CITYID"].ToString();
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        messageContent.InnerHtml = "";

        if (String.IsNullOrEmpty(dpKeepStart.Value.Trim()) || String.IsNullOrEmpty(dpKeepEnd.Value.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error2").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if (String.IsNullOrEmpty(hidWeekList.Value.Trim(',')))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error11").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if ("2".Equals(hidSaveType.Value.Trim()) && String.IsNullOrEmpty(hidPlanWeekList.Value.Trim(',')))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error16").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if ("2".Equals(hidSaveType.Value.Trim()) && (String.IsNullOrEmpty(dpKeepStart.Value.Trim()) || String.IsNullOrEmpty(dpKeepEnd.Value.Trim()) || String.IsNullOrEmpty(dpPlanTime.Value.Trim())))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error17").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if ("1".Equals(hidSaveType.Value.Trim()) && (String.IsNullOrEmpty(dpPlanDTime.Value.Trim())))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error18").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }
        if (!IsValidNumber(txtOnePrice.Text.Trim()) || !IsValidNumber(txtThreePrice.Text.Trim()) || !IsValidNumber(txtFourPrice.Text.Trim()) || !IsValidNumber(txtBedPrice.Text.Trim()) || !IsValidNumber(txtBreakPrice.Text.Trim()) || !IsValidNumber(txtNetPrice.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error13").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if (!IsValidTwoPrice(txtTwoPrice.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error15").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if (!ChkNumber(txtOffsetval.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error14").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if ("true".Equals(ddpRoomStatus.SelectedValue.Trim().ToLower()) && String.IsNullOrEmpty(txtRoomCount.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error4").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if (!ChkNumber(txtRoomCount.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error4").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if ("0".Equals(hidSaveType.Value.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("errorUpdate1").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            return;
        }
        else if ("1".Equals(hidSaveType.Value.Trim()) && !ChkPlanDTimeOut(hidPlanID.Value.ToString().Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("errorUpdate2").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            return;
        }

        if (!ChkPlanDTimeModifyThanNow(hidSaveType.Value.Trim(), hidPlanID.Value.ToString().Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error19").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            return;
        }

        if (!ChkLowPrice(txtTwoPrice.Text.Trim()))
        {
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if (String.IsNullOrEmpty(ddpSup.SelectedValue.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error21").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        string effHour = "";
        effHour = GetEffHourVal(ddpEffHour.SelectedValue.Trim());

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

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        appcontentDBEntity.PlanID = hidPlanID.Value.ToString().Trim();
        appcontentDBEntity.PlanStatus = ddpStatusList.SelectedValue.Trim();
        appcontentDBEntity.HotelID = hidHotelID.Value.Trim();

        appcontentDBEntity.PriceCode = hidPriceType.Value.Trim();
        //appcontentDBEntity.RoomList = hidCommonList.Value.ToString().Trim();
        appcontentDBEntity.RoomCode = hidHotelRoomList.Value.Trim();
        appcontentDBEntity.RoomName = lbHotelRoomList.Text.Trim().Substring(0, lbHotelRoomList.Text.Trim().IndexOf('['));
        appcontentDBEntity.StartDTime = dpKeepStart.Value.ToString().Trim();
        appcontentDBEntity.EndDTime = dpKeepEnd.Value.ToString().Trim();
        appcontentDBEntity.EffHour = effHour;
        appcontentDBEntity.WeekList = hidWeekList.Value.Trim(',');

        appcontentDBEntity.Note1 = ddpGuaid.SelectedValue.Trim();
        appcontentDBEntity.Note2 = ddpCxlid.SelectedValue.Trim();

        appcontentDBEntity.OnePrice = txtOnePrice.Text.Trim();
        appcontentDBEntity.TwoPrice = txtTwoPrice.Text.Trim();
        appcontentDBEntity.ThreePrice = txtThreePrice.Text.Trim();
        appcontentDBEntity.FourPrice = txtFourPrice.Text.Trim();
        appcontentDBEntity.BedPrice = txtBedPrice.Text.Trim();
        appcontentDBEntity.NetPrice = txtNetPrice.Text.Trim();
        appcontentDBEntity.BreakfastNum = ddpBreakfastNum.SelectedValue.Trim();
        appcontentDBEntity.BreakPrice = txtBreakPrice.Text.Trim();
        appcontentDBEntity.IsNetwork = ddpIsNetwork.SelectedValue.Trim();
        appcontentDBEntity.Offsetval = txtOffsetval.Text.Trim();
        appcontentDBEntity.Offsetunit = ddpOffsetunit.SelectedValue.Trim();
        appcontentDBEntity.RoomStatus = ddpRoomStatus.SelectedValue.Trim();
        appcontentDBEntity.RoomCount = txtRoomCount.Text.Trim();
        appcontentDBEntity.IsReserve = ddpIsReserve.SelectedValue.Trim();
        appcontentDBEntity.Supplier = ddpSup.SelectedValue.Trim();

        appcontentDBEntity.SaveType = hidSaveType.Value.Trim();
        appcontentDBEntity.PlanDTime = dpPlanDTime.Value.Trim();
        appcontentDBEntity.PlanTime = dpPlanTime.Value.Trim();
        appcontentDBEntity.PlanStart = dpKeepStart.Value.ToString().Trim(); //dpPlanStart.Value.Trim();
        appcontentDBEntity.PlanEnd = dpKeepEnd.Value.ToString().Trim(); //dpPlanEnd.Value.Trim();
        appcontentDBEntity.PlanWeek = hidWeekList.Value.Trim(','); //hidPlanWeekList.Value.Trim(',');

        appcontentDBEntity.UpdateUser = UserSession.Current.UserDspName;

        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);

        _appcontentEntity = APPContentBP.UpdateSalesPlanList(_appcontentEntity);
        int iResult = _appcontentEntity.Result;
        _commonEntity.LogMessages = _appcontentEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        commonDBEntity.Event_Type = "酒店销售计划-修改";
        commonDBEntity.Event_ID = hidPlanID.Value.ToString().Trim();
        string conTent = GetLocalResourceObject("EventInsertMessage").ToString();

        string msgPlanDTime = "";
        string PlanStart = "";
        string PlanWeekList = "";

        if ("1".Equals(hidSaveType.Value.Trim()))
        {
            msgPlanDTime = dpPlanDTime.Value;
        }
        else if ("2".Equals(hidSaveType.Value.Trim()))
        {
            msgPlanDTime = dpPlanTime.Value;
            PlanStart = dpKeepStart.Value + "-" + dpKeepEnd.Value;
            PlanWeekList = hidWeekList.Value.Trim(',');
        }

        //conTent = string.Format(conTent, hidPlanID.Value.ToString().Trim(), ddpStatusList.SelectedValue.Trim());
        conTent = string.Format(conTent, lbHotel.Text, lbHotelRoomList.Text, dpKeepStart.Value, dpKeepEnd.Value, ddpEffHour.SelectedValue.Trim(), hidPriceType.Value, txtRoomCount.Text.Trim(), ddpRoomStatus.SelectedValue.Trim(), hidWeekList.Value.Trim(','), txtOnePrice.Text.Trim(), txtTwoPrice.Text.Trim(), txtThreePrice.Text.Trim(), txtFourPrice.Text.Trim(), txtBedPrice.Text.Trim(), txtNetPrice.Text.Trim(), ddpBreakfastNum.SelectedValue.Trim(), txtBreakPrice.Text.Trim(), ddpIsNetwork.SelectedValue.Trim(), txtOffsetval.Text.Trim(), ddpOffsetunit.SelectedValue.Trim(), ddpIsReserve.SelectedValue.Trim(), hidSaveType.Value.Trim(), msgPlanDTime, PlanStart, PlanWeekList, hidPlanID.Value, ddpStatusList.SelectedItem.Text, ddpSup.SelectedValue);
        commonDBEntity.Event_Content = conTent;
        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("InsertSuccess").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("InsertSuccess").ToString();
        }
        else if (iResult == 2)
        {
            commonDBEntity.Event_Result = string.Format(GetLocalResourceObject("UpdateSuccess").ToString(), _appcontentEntity.APPContentDBEntity[0].PlanStart);
            messageContent.InnerHtml = string.Format(GetLocalResourceObject("UpdateSuccess").ToString(), _appcontentEntity.APPContentDBEntity[0].PlanStart);
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error8").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("Error8").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);

        DataSet dsHistory = APPContentBP.ReviewSalesPlanDetailHistory(_appcontentEntity).QueryResult;
        gridViewCSServiceList.DataSource = dsHistory.Tables[0].DefaultView;
        gridViewCSServiceList.DataKeyNames = new string[] { "SAVETYPENM" };//主键
        gridViewCSServiceList.DataBind();
        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        messageContent.InnerHtml = "";

        if (String.IsNullOrEmpty(hidHotelID.Value.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error1").ToString();
            //UpdatePanel6.Update();
            return;
        }

        if (String.IsNullOrEmpty(dpKeepStart.Value.Trim()) || String.IsNullOrEmpty(dpKeepEnd.Value.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error2").ToString();
            //UpdatePanel6.Update();
            return;
        }

        if (String.IsNullOrEmpty(hidWeekList.Value.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error11").ToString();
            //UpdatePanel6.Update();
            return;
        }

        if (String.IsNullOrEmpty(hidCommonList.Value.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error3").ToString();
            //UpdatePanel6.Update();
            return;
        }

        if ("true".Equals(ddpRoomStatus.SelectedValue.Trim().ToLower()) && String.IsNullOrEmpty(txtTwoPrice.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error12").ToString();
            //UpdatePanel6.Update();
            return;
        }

        if (!IsValidNumber(txtOnePrice.Text.Trim()) || !IsValidNumber(txtThreePrice.Text.Trim()) || !IsValidNumber(txtFourPrice.Text.Trim()) || !IsValidNumber(txtBedPrice.Text.Trim()) || !IsValidNumber(txtBreakPrice.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error13").ToString();
            //UpdatePanel6.Update();
            return;
        }

        if (!IsValidTwoPrice(txtTwoPrice.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error15").ToString();
            //UpdatePanel6.Update();
            return;
        }

        if (!ChkNumber(txtOffsetval.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error14").ToString();
            //UpdatePanel6.Update();
            return;
        }

        if ("true".Equals(ddpRoomStatus.SelectedValue.Trim().ToLower()) && String.IsNullOrEmpty(txtRoomCount.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error4").ToString();
            //UpdatePanel6.Update();
            return;
        }

        if (!ChkNumber(txtRoomCount.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error4").ToString();
            //UpdatePanel6.Update();
            return;
        }

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

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        appcontentDBEntity.HotelID = hidHotelID.Value.ToString().Trim();
        appcontentDBEntity.PriceCode = ddpPriceType.SelectedValue.Trim();
        appcontentDBEntity.RoomList = hidCommonList.Value.ToString().Trim();
        appcontentDBEntity.StartDTime = dpKeepStart.Value.ToString().Trim();
        appcontentDBEntity.EndDTime = dpKeepEnd.Value.ToString().Trim();
        appcontentDBEntity.WeekList = hidWeekList.Value.Trim(',');

        if ("lmbar".Equals(ddpPriceType.SelectedValue.Trim().ToLower()))
        {
            appcontentDBEntity.Note1 = lbNote1.Text.Trim().Substring(1, lbNote1.Text.Trim().IndexOf('】') -1);
            appcontentDBEntity.Note2 = lbNote11.Text.Trim().Substring(1, lbNote11.Text.Trim().IndexOf('】') -1);
        }
        else
        {
            appcontentDBEntity.Note1 = lbNote2.Text.Trim().Substring(1, lbNote2.Text.Trim().IndexOf('】') - 1);
            appcontentDBEntity.Note2 = lbNote22.Text.Trim().Substring(1, lbNote22.Text.Trim().IndexOf('】') - 1 );
        }

        appcontentDBEntity.OnePrice = txtOnePrice.Text.Trim();
        appcontentDBEntity.TwoPrice = txtTwoPrice.Text.Trim();
        appcontentDBEntity.ThreePrice = txtThreePrice.Text.Trim();
        appcontentDBEntity.FourPrice = txtFourPrice.Text.Trim();
        appcontentDBEntity.BedPrice = txtBedPrice.Text.Trim();
        appcontentDBEntity.BreakfastNum = ddpBreakfastNum.SelectedValue.Trim();
        appcontentDBEntity.BreakPrice = txtBreakPrice.Text.Trim();
        appcontentDBEntity.IsNetwork = ddpIsNetwork.SelectedValue.Trim();
        appcontentDBEntity.Offsetval = txtOffsetval.Text.Trim();
        appcontentDBEntity.Offsetunit = ddpOffsetunit.SelectedValue.Trim();
        appcontentDBEntity.RoomStatus = ddpRoomStatus.SelectedValue.Trim();
        appcontentDBEntity.RoomCount = txtRoomCount.Text.Trim();
        appcontentDBEntity.IsReserve = ddpIsReserve.SelectedValue.Trim();

        appcontentDBEntity.UpdateUser = UserSession.Current.UserDspName;
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);

        _appcontentEntity = APPContentBP.ApplyUnFullRoom(_appcontentEntity);
        int iResult = _appcontentEntity.Result;
        _commonEntity.LogMessages = _appcontentEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        commonDBEntity.Event_Type = "酒店价格计划维护-保存";
        commonDBEntity.Event_ID = hidHotelID.Value.ToString().Trim();
        string conTent = GetLocalResourceObject("EventInsertMessage").ToString();

        string[] strList = hidCommonList.Value.Split(',');
        string msgCommon = string.Empty;

        foreach (string strRoom in strList)
        {
            foreach (ListItem lt in chkHotelRoomList.Items)
            {
                if (!String.IsNullOrEmpty(strRoom) && lt.Value.Equals(strRoom))
                {
                    msgCommon = msgCommon + lt.Text + "[" + strRoom + "]" + ",";
                }
            }
        }

        msgCommon = (msgCommon.Length > 0) ? msgCommon.Substring(0, msgCommon.Length - 1) : msgCommon;
        conTent = string.Format(conTent, hidHotelID.Value.ToString().Trim(), msgCommon, dpKeepStart.Value, dpKeepEnd.Value, ddpPriceType.SelectedValue, txtRoomCount.Text.Trim(), ddpRoomStatus.SelectedValue.Trim(), hidWeekList.Value.Trim(), txtOnePrice.Text.Trim(), txtTwoPrice.Text.Trim(), txtThreePrice.Text.Trim(), txtFourPrice.Text.Trim(), txtBedPrice.Text.Trim(), ddpBreakfastNum.SelectedValue.Trim(), txtBreakPrice.Text.Trim(), ddpIsNetwork.SelectedValue.Trim(), txtOffsetval.Text.Trim(), ddpOffsetunit.SelectedValue.Trim(), ddpIsReserve.SelectedValue.Trim());
        commonDBEntity.Event_Content = conTent;
        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("InsertSuccess").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("InsertSuccess").ToString();
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error8").ToString(); ;
            messageContent.InnerHtml = GetLocalResourceObject("Error8").ToString(); ;
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
        //UpdatePanel6.Update();
    }
    //private int CountLmSystemLog()
    //{
    //    _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
    //    _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
    //    _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
    //    _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
    //    APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();
    //    appcontentDBEntity.HotelID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HotelID"].ToString())) ? null : ViewState["HotelID"].ToString();
    //    appcontentDBEntity.StartDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["StartDTime"].ToString())) ? null : ViewState["StartDTime"].ToString();
    //    appcontentDBEntity.EndDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["EndDTime"].ToString())) ? null : ViewState["EndDTime"].ToString();
    //    _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
    //    DataSet dsResult = APPContentBP.ReviewSalesPlanCount(_appcontentEntity).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 BindReviewHotelPlanListGrid()
    {
        //messageContent.InnerHtml = "";

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

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        appcontentDBEntity.HotelID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HotelID"].ToString())) ? null : ViewState["HotelID"].ToString();
        appcontentDBEntity.StartDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["StartDTime"].ToString())) ? null : ViewState["StartDTime"].ToString();
        appcontentDBEntity.EndDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["EndDTime"].ToString())) ? null : ViewState["EndDTime"].ToString();
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);

        _appcontentEntity.PageCurrent = AspNetPager1.CurrentPageIndex;
        _appcontentEntity.PageSize = gridViewCSReviewList.PageSize;
        _appcontentEntity.SortField = gridViewCSReviewList.Attributes["SortExpression"].ToString();
        _appcontentEntity.SortType = gridViewCSReviewList.Attributes["SortDirection"].ToString();

        _appcontentEntity = APPContentBP.ReviewSalesPlan(_appcontentEntity);
        DataSet dsResult = _appcontentEntity.QueryResult;

        gridViewCSReviewList.DataSource = dsResult.Tables[0].DefaultView;
        gridViewCSReviewList.DataKeyNames = new string[] { "PLANID" };//主键
        gridViewCSReviewList.DataBind();

        AspNetPager1.PageSize = gridViewCSReviewList.PageSize;
        AspNetPager1.RecordCount = _appcontentEntity.TotalCount;

        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
    }
    public static string RenewPlanBySingleHotel(string hotelID, string CityID, string HotelNM, string PriceCode, string TwoPrice, string Status, string RoomCount, string IsReserve, string RoomName, string RoomCode,
        string StartDTime, string EndDTime, string Remark)
    {
        APPContentEntity _appcontentEntity = new APPContentEntity();
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        CommonEntity _commonEntity = new CommonEntity();
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _commonEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _commonEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();
        #region
        //城市ID
        appcontentDBEntity.CityID = CityID;
        //酒店ID
        appcontentDBEntity.HotelID = hotelID;
        //酒店名称
        appcontentDBEntity.HotelNM = HotelNM;
        //价格代码
        appcontentDBEntity.PriceCode = PriceCode;
        //价格
        appcontentDBEntity.TwoPrice = TwoPrice;
        //状态     开启 关闭
        appcontentDBEntity.RoomStatus = Status;
        appcontentDBEntity.PlanStatus = Status;
        //房量
        appcontentDBEntity.RoomCount = RoomCount;
        //是否是保留房
        appcontentDBEntity.IsReserve = IsReserve;
        //房型名称
        appcontentDBEntity.RoomName = RoomName;
        //房型Code
        appcontentDBEntity.RoomCode = RoomCode;
        //批量更新日期   开始  结束
        appcontentDBEntity.StartDTime = StartDTime;
        appcontentDBEntity.EndDTime = EndDTime;
        //备注
        appcontentDBEntity.Remark = Remark;
        //操作人
        appcontentDBEntity.CreateUser = UserSession.Current.UserAccount;
        appcontentDBEntity.UpdateUser = UserSession.Current.UserAccount;

        appcontentDBEntity.WeekList = "1,2,3,4,5,6,7";

        #endregion

        #region

        int DateDiff = calculateDateDiff(appcontentDBEntity.StartDTime, appcontentDBEntity.EndDTime);

        for (int j = 0; j <= DateDiff; j++)
        {
            appcontentDBEntity.PlanTime = DateTime.Parse(appcontentDBEntity.StartDTime).AddDays(j).ToShortDateString();
            _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
            CommonBP.InsertConsultRoomHistory(_appcontentEntity);
            _appcontentEntity.APPContentDBEntity.Clear();
        }

        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);

        _appcontentEntity = HotelInfoBP.RenewPlanFullRoomByUpdatePlan(_appcontentEntity);
        #endregion

        return "{\"d\":{\"message\":\"" + _appcontentEntity.ErrorMSG + "\",\"code\":" + _appcontentEntity.Result + "}}";
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        detailMessageContent.InnerHtml = "";
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        if (String.IsNullOrEmpty(WebAutoComplete.AutoResult) || !WebAutoComplete.AutoResult.Trim().Equals(hidHotelID.Value.Trim()))
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("HotelIDError").ToString();
            PopReseachData();
            return;
        }

        if (String.IsNullOrEmpty(dpStart.Value) || String.IsNullOrEmpty(dpEnd.Value))
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("DTimeError").ToString();
            PopReseachData();
            return;
        }

        string strHotelNM = WebAutoComplete.AutoResult.ToString();
        string strHotelID = strHotelNM.Substring((strHotelNM.IndexOf('[') + 1), (strHotelNM.IndexOf(']') - 1));
        //string strTypeID = ddpAppIgnore.SelectedValue;
        //string strTypeNM = ddpAppIgnore.SelectedItem.ToString();

        appcontentDBEntity.HotelID = strHotelID;
        appcontentDBEntity.StartDTime = dpStart.Value;
        appcontentDBEntity.EndDTime = dpEnd.Value;
        appcontentDBEntity.UserCode = hidUserAccount.Value.Trim();

        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        APPContentEntity appcontentRest  = APPContentBP.InsertSalesMangeGrid(_appcontentEntity);

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

        commonDBEntity.Event_Type = "酒店销售管理-添加";
        commonDBEntity.Event_ID = strHotelID + "-" + hidUserAccount.Value.Trim();
        string conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        conTent = string.Format(conTent, strHotelNM, hidUserAccount.Value.Trim());
        commonDBEntity.Event_Content = conTent;

        if (appcontentRest.Result == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("InsertSuccess").ToString();
            detailMessageContent.InnerHtml = GetLocalResourceObject("InsertSuccess").ToString();
            WebAutoComplete.AutoResult = "";
            dpStart.Value = "";
            dpEnd.Value = "";
        }
        else if (appcontentRest.Result == 2)
        {
            commonDBEntity.Event_Result = string.Format(GetLocalResourceObject("InsertError").ToString(), appcontentRest.ErrorMSG);
            detailMessageContent.InnerHtml = string.Format(GetLocalResourceObject("InsertError").ToString(), appcontentRest.ErrorMSG);
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);

        PopReseachData();
        SalesDetailManager();
    }
    private void ReSetControlVal()
    {
        messageContent.InnerHtml = "";

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

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();
        appcontentDBEntity.PlanID = hidPlanID.Value.ToString().Trim();

        appcontentDBEntity.UpdateUser = UserSession.Current.UserDspName;
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);

        DataSet dsResult = APPContentBP.ReviewSalesPlanDetail(_appcontentEntity).QueryResult;

        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
        {
            //lbKeepStart.Text = dsResult.Tables[0].Rows[0]["StartDtime"].ToString().Trim();
            //lbKeepEnd.Text = dsResult.Tables[0].Rows[0]["EndDtime"].ToString().Trim();
            //lbchkWeekList.Text = SetWeekListNm(dsResult.Tables[0].Rows[0]["Week_List"].ToString().Trim());
            lbHotel.Text = SetHotelNM(dsResult.Tables[0].Rows[0]["HOTEL_ID"].ToString().Trim());
            hidHotelID.Value = dsResult.Tables[0].Rows[0]["HOTEL_ID"].ToString().Trim();
            lbRateCode.Text = dsResult.Tables[0].Rows[0]["RATE_CODE"].ToString().Trim();
            hidPriceType.Value = dsResult.Tables[0].Rows[0]["RATE_CODE"].ToString().Trim();
            lbHotelRoomList.Text = dsResult.Tables[0].Rows[0]["ROOM"].ToString().Trim();
            hidHotelRoomList.Value = dsResult.Tables[0].Rows[0]["ROOMCODE"].ToString().Trim();
            //lbRoomStatus.Text = dsResult.Tables[0].Rows[0]["STATUSDIS"].ToString().Trim();
            //lbRoomCount.Text = dsResult.Tables[0].Rows[0]["ROOM_NUM"].ToString().Trim();
            //lbIsReserve.Text = dsResult.Tables[0].Rows[0]["ISRESERVE"].ToString().Trim();
            //lbOnePrice.Text = dsResult.Tables[0].Rows[0]["ONE_PRICE"].ToString().Trim();
            //lbTwoPrice.Text = dsResult.Tables[0].Rows[0]["TWO_PRICE"].ToString().Trim();
            //lbThreePrice.Text = dsResult.Tables[0].Rows[0]["THREE_PRICE"].ToString().Trim();
            //lbFourPrice.Text = dsResult.Tables[0].Rows[0]["FOUR_PRICE"].ToString().Trim();
            //lbBedPrice.Text = dsResult.Tables[0].Rows[0]["ATTN_PRICE"].ToString().Trim();
            //lbBreakfastNum.Text = dsResult.Tables[0].Rows[0]["BREAKFAST_NUM"].ToString().Trim();
            //lbBreakPrice.Text = dsResult.Tables[0].Rows[0]["EACH_BREAKFAST_PRICE"].ToString().Trim();
            //lbIsNetwork.Text = dsResult.Tables[0].Rows[0]["ISNETWORK"].ToString().Trim();
            //lbOffsetval.Text = dsResult.Tables[0].Rows[0]["OFFSETVAL"].ToString().Trim();
            //lbOffsetunit.Text = dsResult.Tables[0].Rows[0]["OFFSETUNITDIS"].ToString().Trim();
            lbSaveType.Text = dsResult.Tables[0].Rows[0]["SAVETYPENM"].ToString().Trim();
            hidSaveType.Value = dsResult.Tables[0].Rows[0]["SAVETYPE"].ToString().Trim();
            ddpStatusList.SelectedValue = dsResult.Tables[0].Rows[0]["PLANSTATUS"].ToString().Trim();
            //lbPlanDTime.Text = dsResult.Tables[0].Rows[0]["PLANDTIME"].ToString().Trim();
            //lbPlanTime.Text = dsResult.Tables[0].Rows[0]["PLANTTIME"].ToString().Trim();
            //lbPlanStart.Text = dsResult.Tables[0].Rows[0]["PLANSTART"].ToString().Trim();
            //lbPlanEnd.Text = dsResult.Tables[0].Rows[0]["PLANEND"].ToString().Trim();
            //lbPlanWeek.Text = SetWeekListNm(dsResult.Tables[0].Rows[0]["PLANWEEK"].ToString().Trim());
            lbPlanStatus.Text = dsResult.Tables[0].Rows[0]["STATUSDIS"].ToString().Trim();

            ddpRoomStatus.SelectedValue = dsResult.Tables[0].Rows[0]["PDSTATUS"].ToString().Trim();
            txtRoomCount.Text = dsResult.Tables[0].Rows[0]["ROOM_NUM"].ToString().Trim();
            ddpIsReserve.SelectedValue = dsResult.Tables[0].Rows[0]["ISRESERVE"].ToString().Trim();
            txtOnePrice.Text = dsResult.Tables[0].Rows[0]["ONE_PRICE"].ToString().Trim();
            txtTwoPrice.Text = dsResult.Tables[0].Rows[0]["TWO_PRICE"].ToString().Trim();
            txtThreePrice.Text = dsResult.Tables[0].Rows[0]["THREE_PRICE"].ToString().Trim();
            txtFourPrice.Text = dsResult.Tables[0].Rows[0]["FOUR_PRICE"].ToString().Trim();
            txtBedPrice.Text = dsResult.Tables[0].Rows[0]["ATTN_PRICE"].ToString().Trim();
            txtNetPrice.Text = dsResult.Tables[0].Rows[0]["NET_PRICE"].ToString().Trim();
            ddpBreakfastNum.SelectedValue = dsResult.Tables[0].Rows[0]["BREAKFAST_NUM"].ToString().Trim();
            txtBreakPrice.Text = dsResult.Tables[0].Rows[0]["EACH_BREAKFAST_PRICE"].ToString().Trim();
            ddpIsNetwork.SelectedValue = dsResult.Tables[0].Rows[0]["ISNETWORK"].ToString().Trim();
            txtOffsetval.Text = dsResult.Tables[0].Rows[0]["OFFSETVAL"].ToString().Trim();
            ddpOffsetunit.SelectedValue = dsResult.Tables[0].Rows[0]["PDOFFSETUNIT"].ToString().Trim();

            ddpSup.SelectedIndex = ddpSup.Items.IndexOf(ddpSup.Items.FindByValue(dsResult.Tables[0].Rows[0]["SOURCE"].ToString().Trim()));

            dpPlanDTime.Value = dsResult.Tables[0].Rows[0]["PLANDTIME"].ToString().Trim();
            dpPlanTime.Value = dsResult.Tables[0].Rows[0]["PLANTTIME"].ToString().Trim();
            dpPlanStart.Value = dsResult.Tables[0].Rows[0]["PLANSTART"].ToString().Trim().Replace("/", "-");
            dpPlanEnd.Value = dsResult.Tables[0].Rows[0]["PLANEND"].ToString().Trim().Replace("/", "-");

            string strWeekList = dsResult.Tables[0].Rows[0]["PLANWEEK"].ToString().Trim();
            string[] weekList = strWeekList.Split(',');
            foreach (ListItem li in chkPlanWeek.Items)
            {
                if (weekList.Contains(li.Value))
                {
                    li.Selected = true;
                }
            }

            dpKeepStart.Value = dsResult.Tables[0].Rows[0]["StartDtime"].ToString().Trim().Replace("/", "-");
            dpKeepEnd.Value = dsResult.Tables[0].Rows[0]["EndDtime"].ToString().Trim().Replace("/", "-");

            GetEffHourStyleVale(dsResult.Tables[0].Rows[0]["EFFECT_HOUR"].ToString().Trim());
            //ddpEffHour.SelectedValue = dsResult.Tables[0].Rows[0]["EFFECT_HOUR"].ToString().Trim();

            string strhWeekList = dsResult.Tables[0].Rows[0]["Week_List"].ToString().Trim();
            string[] hWeekList = strhWeekList.Split(',');
            foreach (ListItem hli in chkWeekList.Items)
            {
                if (hWeekList.Contains(hli.Value))
                {
                    hli.Selected = true;
                }
            }

            //if ("lmbar".Equals(lbRateCode.Text.ToLower()))
            //{
            //    dvlm2.Style.Add("display", "none");
            //    dvlm.Style.Add("display", "");
            //}
            //else
            //{
            //    dvlm2.Style.Add("display", "");
            //    dvlm.Style.Add("display", "none");
            //}

            //lbGuaid.Text = GetSysConfigurationVale("guaid", dsResult.Tables[0].Rows[0]["GUAID"].ToString().Trim());
            //lbCxlid.Text = GetSysConfigurationVale("cxlid", dsResult.Tables[0].Rows[0]["CXLID"].ToString().Trim());

            ddpGuaid.SelectedValue = dsResult.Tables[0].Rows[0]["GUAID"].ToString().Trim();
            ddpCxlid.SelectedValue = dsResult.Tables[0].Rows[0]["CXLID"].ToString().Trim();

            if ("0".Equals(dsResult.Tables[0].Rows[0]["SAVETYPE"].ToString().Trim()))
            {
                dvDTime.Style.Add("display", "none");
                dvEachFor.Style.Add("display", "none");
                dvSaveStyle.Style.Add("display", "none");
            }
            else if ("1".Equals(dsResult.Tables[0].Rows[0]["SAVETYPE"].ToString().Trim()))
            {
                dvDTime.Style.Add("display", "");
                dvEachFor.Style.Add("display", "none");
            }
            else if ("2".Equals(dsResult.Tables[0].Rows[0]["SAVETYPE"].ToString().Trim()))
            {
                dvDTime.Style.Add("display", "none");
                dvEachFor.Style.Add("display", "");
            }

            if ("2".Equals(dsResult.Tables[0].Rows[0]["PLANSTATUS"].ToString().Trim()))
            {
                dvPlanStatus.Style.Add("display", "");
                ddpStatusList.Visible = false;
                btnSave.Visible = false;
            }
            else
            {
                dvPlanStatus.Style.Add("display", "none");
                ddpStatusList.Visible = true;
            }

            if ("0".Equals(hidSaveType.Value))
            {
                dvSaveStyle.Style.Add("display", "none");
            }
            else if ("1".Equals(hidSaveType.Value))
            {
                if (DateTime.Now > DateTime.Parse(dsResult.Tables[0].Rows[0]["PLANDTIME"].ToString().Trim()).AddMinutes(-15))
                {
                    dvSaveStyle.Style.Add("display", "none");
                }
                else
                {
                    dvSaveStyle.Style.Add("display", "");
                }
            }
            else if ("2".Equals(hidSaveType.Value))
            {
                dvSaveStyle.Style.Add("display", "");
            }
            else
            {
                dvSaveStyle.Style.Add("display", "none");
            }
        }
        else
        {
            messageContent.InnerHtml = GetLocalResourceObject("WarningMessage").ToString();
            btnSave.Visible = false;
        }

        DataSet dsHistory = APPContentBP.ReviewSalesPlanDetailHistory(_appcontentEntity).QueryResult;
        gridViewCSServiceList.DataSource = dsHistory.Tables[0].DefaultView;
        gridViewCSServiceList.DataKeyNames = new string[] { "SAVETYPENM" };//主键
        gridViewCSServiceList.DataBind();
        //this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "ClearClickEvent()", true);
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        messageContent.InnerHtml = "";

        if (String.IsNullOrEmpty(hidHotelID.Value.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error1").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if (!wctHotel.AutoResult.Equals(hidHotelID.Value))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error19").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            return;
        }

        if (String.IsNullOrEmpty(dpKeepStart.Value.Trim()) || String.IsNullOrEmpty(dpKeepEnd.Value.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error2").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if (String.IsNullOrEmpty(hidWeekList.Value.Trim(',')))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error11").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if ("2".Equals(ddpSaveType.SelectedValue.Trim()) && String.IsNullOrEmpty(hidPlanWeekList.Value.Trim(',')))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error16").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if ("2".Equals(ddpSaveType.SelectedValue.Trim()) && (String.IsNullOrEmpty(dpKeepStart.Value.Trim()) || String.IsNullOrEmpty(dpKeepEnd.Value.Trim()) || String.IsNullOrEmpty(dpPlanTime.Value.Trim())))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error17").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if ("1".Equals(ddpSaveType.SelectedValue.Trim()) && (String.IsNullOrEmpty(dpPlanDTime.Value.Trim())))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error18").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        //if (String.IsNullOrEmpty(hidCommonList.Value.Trim()))
        //{
        //    messageContent.InnerHtml = GetLocalResourceObject("Error3").ToString();
        //    //UpdatePanel6.Update();
        //    return;
        //}

        if (String.IsNullOrEmpty(ddpHotelRoomList.SelectedValue.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error3").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if (String.IsNullOrEmpty(ddpSup.SelectedValue.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error21").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if ("true".Equals(ddpRoomStatus.SelectedValue.Trim().ToLower()) && String.IsNullOrEmpty(txtTwoPrice.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error12").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if (!IsValidNumber(txtOnePrice.Text.Trim()) || !IsValidNumber(txtThreePrice.Text.Trim()) || !IsValidNumber(txtFourPrice.Text.Trim()) || !IsValidNumber(txtBedPrice.Text.Trim()) || !IsValidNumber(txtBreakPrice.Text.Trim()) || !IsValidNumber(txtNetPrice.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error13").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if (!IsValidTwoPrice(txtTwoPrice.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error15").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if (!ChkNumber(txtOffsetval.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error14").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if ("true".Equals(ddpRoomStatus.SelectedValue.Trim().ToLower()) && String.IsNullOrEmpty(txtRoomCount.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error4").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if (!ChkNumber(txtRoomCount.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error4").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        if (!String.IsNullOrEmpty(txtTwoPrice.Text.Trim()) && !ChkLowPrice(txtTwoPrice.Text.Trim()))
        {
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

        string effHour = "";
        effHour = GetEffHourVal(ddpEffHour.SelectedValue.Trim());
        if ("99".Equals(ddpEffHour.SelectedValue.Trim()) && String.IsNullOrEmpty(effHour))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error22").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel6.Update();
            return;
        }

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

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        appcontentDBEntity.HotelID = hidHotelID.Value.ToString().Trim();
        appcontentDBEntity.PriceCode = ddpPriceType.SelectedValue.Trim();
        //appcontentDBEntity.RoomList = hidCommonList.Value.ToString().Trim();
        appcontentDBEntity.RoomCode = ddpHotelRoomList.SelectedValue.Trim();
        appcontentDBEntity.RoomName = (ddpHotelRoomList.SelectedItem.Text.Trim().Contains("]")) ? ddpHotelRoomList.SelectedItem.Text.Trim().Substring(ddpHotelRoomList.SelectedItem.Text.Trim().IndexOf(']') + 1) : ddpHotelRoomList.SelectedItem.Text.Trim();
        appcontentDBEntity.StartDTime = dpKeepStart.Value.ToString().Trim();
        appcontentDBEntity.EndDTime = dpKeepEnd.Value.ToString().Trim();
        appcontentDBEntity.EffHour = effHour;
        appcontentDBEntity.WeekList = hidWeekList.Value.Trim(',');

        //if ("lmbar".Equals(ddpPriceType.SelectedValue.Trim().ToLower()))
        //{
        //    appcontentDBEntity.Note1 = lbNote1.Text.Trim().Substring(1, lbNote1.Text.Trim().IndexOf('】') -1);
        //    appcontentDBEntity.Note2 = lbNote11.Text.Trim().Substring(1, lbNote11.Text.Trim().IndexOf('】') -1);
        //}
        //else
        //{
        //    appcontentDBEntity.Note1 = lbNote2.Text.Trim().Substring(1, lbNote2.Text.Trim().IndexOf('】') - 1);
        //    appcontentDBEntity.Note2 = lbNote22.Text.Trim().Substring(1, lbNote22.Text.Trim().IndexOf('】') - 1 );
        //}

        appcontentDBEntity.Note1 = ddpGuaid.SelectedValue.Trim();
        appcontentDBEntity.Note2 = ddpCxlid.SelectedValue.Trim();

        appcontentDBEntity.OnePrice = txtOnePrice.Text.Trim();
        appcontentDBEntity.TwoPrice = txtTwoPrice.Text.Trim();
        appcontentDBEntity.ThreePrice = txtThreePrice.Text.Trim();
        appcontentDBEntity.FourPrice = txtFourPrice.Text.Trim();
        appcontentDBEntity.BedPrice = txtBedPrice.Text.Trim();
        appcontentDBEntity.NetPrice = txtNetPrice.Text.Trim();
        appcontentDBEntity.BreakfastNum = ddpBreakfastNum.SelectedValue.Trim();
        appcontentDBEntity.BreakPrice = txtBreakPrice.Text.Trim();
        appcontentDBEntity.IsNetwork = ddpIsNetwork.SelectedValue.Trim();
        appcontentDBEntity.Offsetval = txtOffsetval.Text.Trim();
        appcontentDBEntity.Offsetunit = ddpOffsetunit.SelectedValue.Trim();
        appcontentDBEntity.RoomStatus = ddpRoomStatus.SelectedValue.Trim();
        appcontentDBEntity.RoomCount = txtRoomCount.Text.Trim();
        appcontentDBEntity.IsReserve = ddpIsReserve.SelectedValue.Trim();

        appcontentDBEntity.SaveType = ddpSaveType.SelectedValue.Trim();
        appcontentDBEntity.PlanDTime = dpPlanDTime.Value.Trim();
        appcontentDBEntity.PlanTime = dpPlanTime.Value.Trim();
        appcontentDBEntity.PlanStart = dpKeepStart.Value.ToString().Trim(); //dpPlanStart.Value.Trim();
        appcontentDBEntity.PlanEnd = dpKeepEnd.Value.ToString().Trim(); //dpPlanEnd.Value.Trim();
        appcontentDBEntity.PlanWeek = hidWeekList.Value.Trim(','); //hidPlanWeekList.Value.Trim(',');

        appcontentDBEntity.Supplier = ddpSup.SelectedValue.Trim();

        appcontentDBEntity.UpdateUser = UserSession.Current.UserDspName;
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);

        _appcontentEntity = APPContentBP.CreateSalesPlan(_appcontentEntity);
        int iResult = _appcontentEntity.Result;
        string strPlanID = _appcontentEntity.APPContentDBEntity[0].PlanID;
        _commonEntity.LogMessages = _appcontentEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        commonDBEntity.Event_Type = "酒店销售计划-保存";
        commonDBEntity.Event_ID = strPlanID;
        string conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        string msgCommon = string.Empty;
        msgCommon = ddpHotelRoomList.SelectedItem.Text;// +"[" + ddpHotelRoomList.SelectedValue + "]";
        string msgPlanDTime = "";
        string PlanStart = "";
        string PlanWeekList = "";

        if ("1".Equals(ddpSaveType.SelectedValue.Trim()))
        {
            msgPlanDTime = dpPlanDTime.Value;
        }
        else if ("2".Equals(ddpSaveType.SelectedValue.Trim()))
        {
            msgPlanDTime = dpPlanTime.Value;
            PlanStart = dpKeepStart.Value.ToString().Trim() + "-" + dpKeepEnd.Value.ToString().Trim();
            PlanWeekList = hidWeekList.Value.Trim(',');
        }

        conTent = string.Format(conTent, hidHotelID.Value.ToString().Trim(), msgCommon, dpKeepStart.Value, dpKeepEnd.Value, ddpEffHour.SelectedValue.Trim(), ddpPriceType.SelectedValue, txtRoomCount.Text.Trim(), ddpRoomStatus.SelectedValue.Trim(), hidWeekList.Value.Trim(','), txtOnePrice.Text.Trim(), txtTwoPrice.Text.Trim(), txtThreePrice.Text.Trim(), txtFourPrice.Text.Trim(), txtBedPrice.Text.Trim(), txtNetPrice.Text.Trim(), ddpBreakfastNum.SelectedValue.Trim(), txtBreakPrice.Text.Trim(), ddpIsNetwork.SelectedValue.Trim(), txtOffsetval.Text.Trim(), ddpOffsetunit.SelectedValue.Trim(), ddpIsReserve.SelectedValue.Trim(), ddpSaveType.SelectedValue.Trim(), msgPlanDTime, PlanStart, PlanWeekList, strPlanID, ddpSup.SelectedValue);
        commonDBEntity.Event_Content = conTent;
        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("InsertSuccess").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("InsertSuccess").ToString();
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error8").ToString() + _appcontentEntity.ErrorMSG;
            messageContent.InnerHtml = GetLocalResourceObject("Error8").ToString() + _appcontentEntity.ErrorMSG;
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
        //UpdatePanel6.Update();
    }
        public static APPContentEntity AutoSelect(APPContentEntity appcontentEntity)
        {
            appcontentEntity.LogMessages.MsgType = MessageType.INFO;
            appcontentEntity.LogMessages.Content = _nameSpaceClass + "Select";
            LoggerHelper.LogWriter(appcontentEntity.LogMessages);
            DataSet dsRestult = new DataSet();
            dsRestult.Tables.Add(new DataTable());
            dsRestult.Tables[0].Columns.Add("CITYID");
            dsRestult.Tables[0].Columns.Add("CITYNM");
            dsRestult.Tables[0].Columns.Add("HOTELID");
            dsRestult.Tables[0].Columns.Add("HOTELNM");
            dsRestult.Tables[0].Columns.Add("ERRMSG");
            dsRestult.Tables[0].Columns.Add("TYPEID");

            string strVer = (appcontentEntity.APPContentDBEntity.Count > 0) ? appcontentEntity.APPContentDBEntity[0].SerVer : "";
            try
            {
                DataSet dsCity = new DataSet();
                if (String.IsNullOrEmpty(appcontentEntity.APPContentDBEntity[0].CityID))
                {
                    if ("1".Equals(strVer))
                    {
                        dsCity = APPContentSA.CommonSelect(appcontentEntity).QueryResult;
                    }
                    else
                    {
                        dsCity = APPContentV2SA.CommonSelect(appcontentEntity).QueryResult;
                    }
                }
                else
                {
                    dsCity.Tables.Add(new DataTable());
                    dsCity.Tables[0].Columns.Add("cityid");
                    dsCity.Tables[0].Columns.Add("cityNM");
                    DataRow drRow = dsCity.Tables[0].NewRow();
                    drRow["cityid"] = appcontentEntity.APPContentDBEntity[0].CityID;
                    drRow["cityNM"] = appcontentEntity.APPContentDBEntity[0].CityNM;
                    dsCity.Tables[0].Rows.Add(drRow);
                }

                APPContentEntity _appcontentEntity = new APPContentEntity();
                _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
                _appcontentEntity.LogMessages.Userid = appcontentEntity.LogMessages.Userid;
                _appcontentEntity.LogMessages.Username = appcontentEntity.LogMessages.Username;

                _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
                APPContentDBEntity _appcontentDBEntity = new APPContentDBEntity();
                _appcontentEntity.APPContentDBEntity.Add(_appcontentDBEntity);

                _appcontentEntity.APPContentDBEntity[0].PlatForm = "IOS";
                _appcontentEntity.APPContentDBEntity[0].TypeID = "1";

                DataSet dsHotel = new DataSet();
                DataSet dsHotelMain = new DataSet();
                ArrayList ayHotelImage = new ArrayList();
                DataSet dsHotelRoom = new DataSet();
                DataSet dsHotelFtType = new DataSet();
                ArrayList alIgnore = new ArrayList();

                APPContentEntity dsHotelDetail = new APPContentEntity();

                foreach (DataRow drCity in dsCity.Tables[0].Rows)
                {
                    _appcontentEntity.APPContentDBEntity[0].CityID = drCity["cityid"].ToString();

                    if ("1".Equals(strVer))
                    {
                        dsHotel = APPContentSA.HotelListSelect(_appcontentEntity).QueryResult;
                    }
                    else
                    {
                        dsHotel = APPContentV2SA.HotelListSelect(_appcontentEntity).QueryResult;
                    }

                    foreach (DataRow drHotel in dsHotel.Tables[0].Rows)
                    {
                        _appcontentEntity.APPContentDBEntity[0].HotelID = drHotel[0].ToString();

                        if ("1".Equals(strVer))
                        {
                            dsHotelDetail = APPContentSA.HotelDetailListSelect(_appcontentEntity);
                        }
                        else
                        {
                            dsHotelDetail = APPContentV2SA.HotelDetailListSelectV2(_appcontentEntity);
                        }

                        dsHotelMain = dsHotelDetail.APPContentDBEntity[0].HotelMain;
                        ayHotelImage = dsHotelDetail.APPContentDBEntity[0].HotelImage;
                        dsHotelRoom = dsHotelDetail.APPContentDBEntity[0].HotelRoom;
                        dsHotelFtType = dsHotelDetail.APPContentDBEntity[0].HotelFtType;

                        if (dsHotelMain.Tables.Count > 0 && dsHotelMain.Tables[0].Rows.Count > 0)
                        {
                            alIgnore = APPContentDA.GetHotelIgnore(drHotel[0].ToString());

                            if (!alIgnore.Contains("HOTELNM") && String.IsNullOrEmpty(dsHotelMain.Tables[0].Rows[0]["HOTELNM"].ToString().Trim()))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = "缺少酒店名称";
                                drErNm["TYPEID"] = "HOTELNM";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }

                            if (!alIgnore.Contains("ADDRESS") && String.IsNullOrEmpty(dsHotelMain.Tables[0].Rows[0]["ADDRESS"].ToString().Trim()))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = "缺少酒店地址";
                                drErNm["TYPEID"] = "ADDRESS";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }

                            if ((!alIgnore.Contains("LGLTTUDE")) && ((String.IsNullOrEmpty(dsHotelMain.Tables[0].Rows[0]["LONGITUDE"].ToString().Trim()) || String.IsNullOrEmpty(dsHotelMain.Tables[0].Rows[0]["LATITUDE"].ToString().Trim())) || (!ChkTudeValue(dsHotelMain.Tables[0].Rows[0]["LONGITUDE"].ToString().Trim()) || !ChkTudeValue(dsHotelMain.Tables[0].Rows[0]["LATITUDE"].ToString().Trim()))))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = "缺少酒店经纬度";
                                drErNm["TYPEID"] = "LGLTTUDE";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }

                            if (!alIgnore.Contains("HOTELDES") && String.IsNullOrEmpty(dsHotelMain.Tables[0].Rows[0]["HOTELDES"].ToString().Trim()))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = "缺少酒店概况";
                                drErNm["TYPEID"] = "HOTELDES";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }

                            if (!alIgnore.Contains("HOTELAPPR") && (String.IsNullOrEmpty(dsHotelMain.Tables[0].Rows[0]["HOTELAPPR"].ToString().Trim()) || (!ChkApprValue(dsHotelMain.Tables[0].Rows[0]["HOTELAPPR"].ToString().Trim()))))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = "请检查酒店小贴士";
                                drErNm["TYPEID"] = "HOTELAPPR";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }

                            if (!alIgnore.Contains("HOTELSERVICE") && String.IsNullOrEmpty(dsHotelMain.Tables[0].Rows[0]["HOTELSERVICE"].ToString().Trim()))
                           {
                               DataRow drErNm = dsRestult.Tables[0].NewRow();
                               drErNm["CITYID"] = drCity["cityid"].ToString();
                               drErNm["CITYNM"] = drCity["cityNM"].ToString();
                               drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                               drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                               drErNm["ERRMSG"] = "缺少酒店服务信息";
                               drErNm["TYPEID"] = "HOTELSERVICE";
                               dsRestult.Tables[0].Rows.Add(drErNm);
                            }

                            if (!alIgnore.Contains("BUSSES") && String.IsNullOrEmpty(dsHotelMain.Tables[0].Rows[0]["BUSSES"].ToString().Trim()))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = "缺少商务设施信息";
                                drErNm["TYPEID"] = "BUSSES";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }

                            if (!alIgnore.Contains("TRADEAREA") && (String.IsNullOrEmpty(drHotel["TRADEAREA"].ToString().Trim()) || "其它".Equals(drHotel["TRADEAREA"].ToString().Trim())))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = "缺少商圈信息";
                                drErNm["TYPEID"] = "TRADEAREA";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }

                            if (!alIgnore.Contains("SALES") && (!APPContentDA.GetHotelSales(drHotel["HOTELID"].ToString())))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = "缺少酒店销售人员信息";
                                drErNm["TYPEID"] = "SALES";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }
                            //if (String.IsNullOrEmpty(dsHotelMain.Tables[0].Rows[0]["CUSTOMTEL"].ToString().Trim()))
                            //{
                            //    lbCustomTel.Text = "";
                            //    messageContent = messageContent + GetLocalResourceObject("ErrorMsgHotelSerTel").ToString() + "<br/>";
                            //}
                        }
                        else
                        {
                            DataRow drErNm = dsRestult.Tables[0].NewRow();
                            drErNm["CITYID"] = drCity["cityid"].ToString();
                            drErNm["CITYNM"] = drCity["cityNM"].ToString();
                            drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                            drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                            drErNm["ERRMSG"] = "缺少酒店基础信息";
                            drErNm["TYPEID"] = "";
                            dsRestult.Tables[0].Rows.Add(drErNm);
                        }

                        DataSet dsLink = APPContentDA.HotelLinkSelect(_appcontentEntity);
                        if (dsLink.Tables.Count > 0 && dsLink.Tables[0].Rows.Count > 0)
                        {
                            if (!alIgnore.Contains("LINKTEL") && String.IsNullOrEmpty(dsLink.Tables[0].Rows[0]["LINKTEL"].ToString().Trim()))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = "缺少酒店预订电话";
                                drErNm["TYPEID"] = "LINKTEL";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }

                            if (!alIgnore.Contains("LINKFAX") && String.IsNullOrEmpty(dsLink.Tables[0].Rows[0]["LINKFAX"].ToString().Trim()))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = "缺少酒店预订传真";
                                drErNm["TYPEID"] = "LINKFAX";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }
                        }
                        else
                        {
                            DataRow drErNm = dsRestult.Tables[0].NewRow();
                            drErNm["CITYID"] = drCity["cityid"].ToString();
                            drErNm["CITYNM"] = drCity["cityNM"].ToString();
                            drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                            drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                            drErNm["ERRMSG"] = "缺少订单传递方式";
                            drErNm["TYPEID"] = "";
                            dsRestult.Tables[0].Rows.Add(drErNm);
                        }

                        if (!alIgnore.Contains("HTIMAGE") && (ayHotelImage.Count == 0 || !ChkHotelImagePath(ayHotelImage)))
                        {
                            DataRow drErNm = dsRestult.Tables[0].NewRow();
                            drErNm["CITYID"] = drCity["cityid"].ToString();
                            drErNm["CITYNM"] = drCity["cityNM"].ToString();
                            drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                            drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                            drErNm["ERRMSG"] = "请检查酒店图片信息";
                            drErNm["TYPEID"] = "HTIMAGE";
                            dsRestult.Tables[0].Rows.Add(drErNm);
                        }

                        if (dsHotelRoom.Tables.Count > 0 && dsHotelRoom.Tables[0].Rows.Count > 0)
                        {
                            string strROOMNM = "";
                            string strROOMCODE = "";
                            string strBEDNM = "";
                            string strNETPRICE = "";
                            string strVPPRICE = "";
                            for (int i = 0; i < dsHotelRoom.Tables[0].Rows.Count; i++)
                            {
                                if (!alIgnore.Contains("ROOMNM") && String.IsNullOrEmpty(dsHotelRoom.Tables[0].Rows[i]["ROOMNM"].ToString()) && String.IsNullOrEmpty(strROOMNM))
                                {
                                    strROOMNM = "缺少房型名称";
                                }

                                if (!alIgnore.Contains("ROOMCODE") && String.IsNullOrEmpty(dsHotelRoom.Tables[0].Rows[i]["ROOMCODE"].ToString()) && String.IsNullOrEmpty(strROOMCODE))
                                {
                                    strROOMCODE = "缺少房型代码";
                                }

                                if (!alIgnore.Contains("BEDNM") && String.IsNullOrEmpty(dsHotelRoom.Tables[0].Rows[i]["BEDNM"].ToString()) && String.IsNullOrEmpty(strBEDNM))
                                {
                                    strBEDNM = "缺少床型名称";
                                }

                                if (!alIgnore.Contains("NETPRICE") && String.IsNullOrEmpty(dsHotelRoom.Tables[0].Rows[i]["NETPRICE"].ToString()) && String.IsNullOrEmpty(strNETPRICE))
                                {
                                    strNETPRICE = "缺少网络价";
                                }

                                if (!alIgnore.Contains("VPPRICE") && String.IsNullOrEmpty(strVPPRICE) && (String.IsNullOrEmpty(dsHotelRoom.Tables[0].Rows[i]["VPPRICE"].ToString()) || (!String.IsNullOrEmpty(dsHotelRoom.Tables[0].Rows[i]["VPPRICE"].ToString()) && decimal.Parse(dsHotelRoom.Tables[0].Rows[i]["VPPRICE"].ToString()) < 10)))
                                {
                                    strVPPRICE = "价格低于10元";
                                }
                            }

                            if (!String.IsNullOrEmpty(strROOMNM))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = strROOMNM;
                                drErNm["TYPEID"] = "ROOMNM";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }

                            if (!String.IsNullOrEmpty(strROOMCODE))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = strROOMCODE;
                                drErNm["TYPEID"] = "ROOMCODE";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }

                            if (!String.IsNullOrEmpty(strBEDNM))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = strBEDNM;
                                drErNm["TYPEID"] = "BEDNM";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }

                            if (!String.IsNullOrEmpty(strNETPRICE))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = strNETPRICE;
                                drErNm["TYPEID"] = "NETPRICE";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }

                            if (!String.IsNullOrEmpty(strVPPRICE))
                            {
                                DataRow drErNm = dsRestult.Tables[0].NewRow();
                                drErNm["CITYID"] = drCity["cityid"].ToString();
                                drErNm["CITYNM"] = drCity["cityNM"].ToString();
                                drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                                drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                                drErNm["ERRMSG"] = strVPPRICE;
                                drErNm["TYPEID"] = "VPPRICE";
                                dsRestult.Tables[0].Rows.Add(drErNm);
                            }
                        }
                        else
                        {
                            DataRow drErNm = dsRestult.Tables[0].NewRow();
                            drErNm["CITYID"] = drCity["cityid"].ToString();
                            drErNm["CITYNM"] = drCity["cityNM"].ToString();
                            drErNm["HOTELID"] = drHotel["HOTELID"].ToString();
                            drErNm["HOTELNM"] = drHotel["HOTELNM"].ToString();
                            drErNm["ERRMSG"] = "缺少酒店房型信息";
                            drErNm["TYPEID"] = "";
                            dsRestult.Tables[0].Rows.Add(drErNm);
                        }
                    }
                }
                appcontentEntity.QueryResult = dsRestult;
                return appcontentEntity;
            }
            catch (Exception ex)
            {
                appcontentEntity.LogMessages.MsgType = MessageType.ERROR;
                appcontentEntity.LogMessages.Content = _nameSpaceClass + "Select  Error: " + ex.Message;
                throw ex;
            }
        }
    public static string GetHistoryRemarkByJson(string CityID, string HotelID, string PriceCode, string RoomCode, string PlanDTime)
    {
        APPContentEntity _appcontentEntity = new APPContentEntity();
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        appcontentDBEntity.CityID = CityID;
        appcontentDBEntity.HotelID = HotelID;
        appcontentDBEntity.PriceCode = PriceCode;
        appcontentDBEntity.RoomCode = RoomCode;
        appcontentDBEntity.PlanDTime = DateTime.Parse(PlanDTime).ToShortDateString();

        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        string json = "";
        if (!CityID.Equals("undefined"))
        {
            DataSet dsResult = HotelInfoBP.GetConsultRoomHistoryList(_appcontentEntity).QueryResult;
            try
            {
                if (dsResult.Tables[0] != null && dsResult.Tables[0].Rows.Count > 0)
                {
                    json = ToJson(dsResult.Tables[0]);
                }
                else
                {
                    json = "{\"d\":\"[]\"}";
                }
            }
            catch (Exception ex)
            {
                json = "{\"d\":\"[]\"}";
            }
        }
        return json;
    }
    private void BindHotelGroupDetail2()
    {
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();
        appcontentDBEntity.HGroupID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HGROUPID"].ToString())) ? null : ViewState["HGROUPID"].ToString();
        appcontentDBEntity.GType = "1";
        appcontentDBEntity.Cuser = UserSession.Current.UserDspName;
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        DataSet dsResult = APPContentBP.GetCoreHotelGroupDetail(_appcontentEntity).QueryResult;

        if (dsResult.Tables.Count == 0 || dsResult.Tables[0].Rows.Count == 0)
        {
            messageContent2.InnerHtml = GetLocalResourceObject("WarningMessage").ToString();
            return;
        }

        //hidHotelGroupID
        lbHotelGroup2.Text = dsResult.Tables[0].Rows[0]["HGroupNM"].ToString();
        lbHotelCount2.Text = dsResult.Tables[0].Rows[0]["DCOUNT"].ToString();
        lbHotelCrePer2.Text = dsResult.Tables[0].Rows[0]["CREATEINFO"].ToString();
        BindHotelListGrid2();
    }
    /// <summary>
    /// 计划关房(批量操作 关闭计划)
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    public void btnPlanCloseRoom(string remark, string status, bool isRenew)
    {
        DataTable dtPlanLMBAR2 = new DataTable();
        DataTable dtPlanLMBAR = new DataTable();
        string hotelId = this.HidPid.Value;//酒店ID
        string dateSE = this.HidMarkFullRoom.Value;//起止日期

        #region
        APPContentEntity _appcontentEntity = new APPContentEntity();
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        CommonEntity _commonEntity = new CommonEntity();
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _commonEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _commonEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        bool IsFlag = false;
        if (!string.IsNullOrEmpty(dateSE))
        {

            DataTable dtPlan = GetBindLmbarPlanList(this.planStartDate.Value, this.planEndDate.Value, this.HidPid.Value).Tables[0];//总计划
            dtPlanLMBAR2 = dtPlan.Clone();
            dtPlanLMBAR = dtPlan.Clone();
            DataRow[] drPlanLMBAR2 = dtPlan.Select("RATECODE='LMBAR2'"); //LMBAR2计划
            for (int i = 0; i < drPlanLMBAR2.Length; i++)
            {
                dtPlanLMBAR2.ImportRow(drPlanLMBAR2[i]);
            }
            DataRow[] drPlanLMBAR = dtPlan.Select("RATECODE='LMBAR'"); //LMBAR计划
            for (int i = 0; i < drPlanLMBAR.Length; i++)
            {
                dtPlanLMBAR.ImportRow(drPlanLMBAR[i]);
            }

            string[] datas = dateSE.Split(',');
            for (int i = 0; i < datas.Length; i++)
            {
                if (!string.IsNullOrEmpty(datas[i].ToString()))
                {
                    if (DateTime.Parse(datas[i].ToString()).ToShortDateString() == System.DateTime.Now.ToShortDateString())
                    {
                        IsFlag = true;
                    }

                    string effDate = datas[i].ToString().Replace("/", "-");
                    #region
                    for (int l = 0; l < this.HidLastHotelRoomListLMBAR2.Value.Split(',').Length; l++)
                    {
                        DataRow[] rowsLmbar2 = dtPlanLMBAR2.Select("EFFECTDATESTRING='" + DateTime.Parse(effDate).ToString("yyyy-MM-dd") + "' and ROOMTYPECODE='" + this.HidLastHotelRoomListLMBAR2.Value.Split(',')[l].ToString() + "'");
                        for (int j = 0; j < rowsLmbar2.Length; j++)
                        {
                            if (!string.IsNullOrEmpty(rowsLmbar2[j]["RoomNum"].ToString()) && rowsLmbar2[j]["RoomNum"].ToString().ToLower() != "null")
                            {
                                //城市ID
                                appcontentDBEntity.CityID = this.HidCityID.Value;
                                //酒店ID
                                appcontentDBEntity.HotelID = hotelId;
                                //酒店名称
                                appcontentDBEntity.HotelNM = this.HidPcode.Value;
                                //PlanDate
                                appcontentDBEntity.PlanTime = DateTime.Parse(effDate).ToShortDateString();
                                //价格代码
                                appcontentDBEntity.PriceCode = rowsLmbar2[j]["RATECODE"].ToString();
                                //价格
                                appcontentDBEntity.TwoPrice = rowsLmbar2[j]["TWOPRICE"].ToString();
                                //状态     开启 关闭
                                //appcontentDBEntity.PlanStatus = rowsLmbar2[j]["STATUS"].ToString();
                                appcontentDBEntity.PlanStatus = status == "" ? rowsLmbar2[j]["STATUS"].ToString() : status;
                                appcontentDBEntity.RoomCount = rowsLmbar2[j]["ROOMNUM"].ToString();
                                appcontentDBEntity.IsReserve = rowsLmbar2[j]["ISRESERVE"].ToString();
                                //房型名称
                                appcontentDBEntity.RoomName = rowsLmbar2[j]["ROOMTYPENAME"].ToString();
                                //房型Code
                                appcontentDBEntity.RoomCode = rowsLmbar2[j]["ROOMTYPECODE"].ToString();

                                appcontentDBEntity.WeekList = "1,2,3,4,5,6,7";
                                //备注
                                appcontentDBEntity.Remark = remark;
                                //操作人
                                appcontentDBEntity.CreateUser = UserSession.Current.UserAccount;

                                _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
                                CommonBP.InsertConsultRoomHistory(_appcontentEntity);
                                _appcontentEntity.APPContentDBEntity.Clear();
                            }
                        }
                    }
                    #endregion
                    #region
                    for (int l = 0; l < this.HidLastHotelRoomListLMBAR.Value.Split(',').Length; l++)
                    {
                        DataRow[] rowsLmbar = dtPlanLMBAR.Select("EFFECTDATESTRING='" + DateTime.Parse(effDate).ToString("yyyy-MM-dd") + "' and ROOMTYPECODE='" + this.HidLastHotelRoomListLMBAR.Value.Split(',')[l].ToString() + "'");
                        for (int j = 0; j < rowsLmbar.Length; j++)
                        {
                            if (!string.IsNullOrEmpty(rowsLmbar[j]["ROOMNUM"].ToString()) && rowsLmbar[j]["RoomNum"].ToString().ToLower() != "null")
                            {
                                //城市ID
                                appcontentDBEntity.CityID = this.HidCityID.Value;
                                //酒店ID
                                appcontentDBEntity.HotelID = hotelId;
                                //酒店名称
                                appcontentDBEntity.HotelNM = this.HidPcode.Value;
                                //PlanDate
                                appcontentDBEntity.PlanTime = DateTime.Parse(effDate).ToShortDateString();
                                //价格代码
                                appcontentDBEntity.PriceCode = rowsLmbar[j]["RATECODE"].ToString();
                                //价格
                                appcontentDBEntity.TwoPrice = rowsLmbar[j]["TWOPRICE"].ToString();
                                //状态     开启 关闭
                                //appcontentDBEntity.PlanStatus = rowsLmbar[j]["STATUS"].ToString();
                                appcontentDBEntity.PlanStatus = status == "" ? rowsLmbar[j]["STATUS"].ToString() : status;
                                appcontentDBEntity.RoomCount = rowsLmbar[j]["ROOMNUM"].ToString();
                                appcontentDBEntity.IsReserve = rowsLmbar[j]["ISRESERVE"].ToString();
                                //房型名称
                                appcontentDBEntity.RoomName = rowsLmbar[j]["ROOMTYPENAME"].ToString();
                                //房型Code
                                appcontentDBEntity.RoomCode = rowsLmbar[j]["ROOMTYPECODE"].ToString();

                                appcontentDBEntity.WeekList = "1,2,3,4,5,6,7";
                                //备注
                                appcontentDBEntity.Remark = remark;
                                //操作人
                                appcontentDBEntity.CreateUser = UserSession.Current.UserAccount;
                                _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
                                CommonBP.InsertConsultRoomHistory(_appcontentEntity);
                                _appcontentEntity.APPContentDBEntity.Clear();
                            }
                        }
                    }
                    #endregion
                    if (isRenew)
                    {
                        appcontentDBEntity.HotelID = hotelId;
                        appcontentDBEntity.StartDTime = effDate;
                        appcontentDBEntity.EndDTime = effDate;
                        appcontentDBEntity.Lmbar2RoomCode = this.HidLastHotelRoomListLMBAR2.Value;
                        appcontentDBEntity.LmbarRoomCode = this.HidLastHotelRoomListLMBAR.Value;
                        appcontentDBEntity.TypeID = status == "true" ? "3" : "2";// "2";//type:1 满房、2 关房、3 开房
                        appcontentDBEntity.UpdateUser = UserSession.Current.UserAccount;
                        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);

                        _appcontentEntity = HotelInfoBP.BatchUpdatePlan(_appcontentEntity);

                        _appcontentEntity.APPContentDBEntity.Clear();
                    }
                }
            }
        }
        #endregion

        int SelectedIndex = int.Parse(this.HidSelIndex.Value);
        //ScriptManager.RegisterStartupScript(this.UpdatePanel4, this.GetType(), "keyclosebtn", "BtnCompleteStyle();", true);

        //ScriptManager.RegisterStartupScript(this.UpdatePanel4, this.GetType(), "clickbtnSingle", "ClickEvent('" + this.HidPcode.Value + "','" + this.HidPid.Value + "','" + SelectedIndex + "','" + this.HidCityID.Value + "','" + this.HidHotelEXLinkMan.Value + "','" + this.HidHotelEXLinkTel.Value + "','" + this.HidHotelEXLinkRemark.Value + "','false','true','false');", true);

        //ScriptManager.RegisterStartupScript(this.UpdatePanel4, this.GetType(), "scrollReset", "GetResultFromServer();", true);
        //ScriptManager.RegisterStartupScript(this.UpdatePanel11, this.GetType(), "keyclosebtn", "BtnCompleteStyle();", true);
        //btnSelect_Click(null, null);
        btnSingleHotel_Click(null, null);

        if (IsFlag)
        {
            if (DateTime.Now.Hour >= 18)
            {
                if (gridHotelList.Rows[SelectedIndex].BackColor != System.Drawing.ColorTranslator.FromHtml("#FF6666"))
                {
                    gridHotelList.Rows[SelectedIndex].Cells[6].Text = "#FF6666";
                    gridHotelList.Rows[SelectedIndex].Cells[7].Text = "#CD5C5C";
                    this.operandNum.InnerText = (int.Parse(this.operandNum.InnerText) + 1).ToString();
                    gridHotelList.Rows[SelectedIndex].BackColor = System.Drawing.ColorTranslator.FromHtml("#FF6666");
                    ((System.Web.UI.WebControls.WebControl)((Label)gridHotelList.Rows[int.Parse(this.HidSelIndex.Value)].FindControl("Label1"))).BackColor = System.Drawing.ColorTranslator.FromHtml("#CD5C5C");
                }
            }
            else
            {
                if (gridHotelList.Rows[SelectedIndex].BackColor != System.Drawing.ColorTranslator.FromHtml("#80c0a0"))
                {
                    gridHotelList.Rows[SelectedIndex].Cells[6].Text = "#80c0a0";
                    gridHotelList.Rows[SelectedIndex].Cells[7].Text = "#70A88C";
                    this.operandNum.InnerText = (int.Parse(this.operandNum.InnerText) + 1).ToString();
                    gridHotelList.Rows[SelectedIndex].BackColor = System.Drawing.ColorTranslator.FromHtml("#80c0a0");
                    ((System.Web.UI.WebControls.WebControl)((Label)gridHotelList.Rows[int.Parse(this.HidSelIndex.Value)].FindControl("Label1"))).BackColor = System.Drawing.ColorTranslator.FromHtml("#70A88C");
                }
            }
        }
    }
    private void RefreshHotelCount(string GType, string Cuser)
    {
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();
        appcontentDBEntity.HGroupID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HGROUPID"].ToString())) ? null : ViewState["HGROUPID"].ToString();
        appcontentDBEntity.GType = GType;
        appcontentDBEntity.Cuser = Cuser;
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        DataSet dsResult = APPContentBP.GetCoreHotelGroupDetail(_appcontentEntity).QueryResult;
        string strVal = "";
        if (dsResult.Tables.Count == 0 || dsResult.Tables[0].Rows.Count == 0)
        {
            strVal = "0";
        }
        else
        {
            strVal = dsResult.Tables[0].Rows[0]["DCOUNT"].ToString();
        }

        if ("0".Equals(GType))
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "setScript", "SetCountVal('" + strVal + "')", true);
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.UpdatePanel5, this.GetType(), "setScript", "SetCountVal('" + strVal + "')", true);
        }
    }
    private void BindCityListGrid()
    {
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        appcontentDBEntity.CityID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["CITYID"].ToString())) ? null : ViewState["CITYID"].ToString();
        appcontentDBEntity.TypeID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["TYPE"].ToString())) ? null : ViewState["TYPE"].ToString();
        appcontentDBEntity.PlatForm = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["PLATFORM"].ToString())) ? null : ViewState["PLATFORM"].ToString();
        appcontentDBEntity.SerVer = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["SERVER"].ToString())) ? null : ViewState["SERVER"].ToString();
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);

        DataSet dsResult = APPContentBP.Select(_appcontentEntity).QueryResult;
        gridViewCSAPPContenList.DataSource = dsResult.Tables[0].DefaultView;
        gridViewCSAPPContenList.DataKeyNames = new string[] { "HOTELID" };//主键
        gridViewCSAPPContenList.DataBind();
        string strContent = String.Format(GetLocalResourceObject("SelectCount").ToString(), dsResult.Tables[0].Rows.Count.ToString());
        messageContent.InnerHtml = strContent;

        for (int i = 0; i < gridViewCSAPPContenList.Rows.Count; i++)
        {
            //首先判断是否是数据行
            if (gridViewCSAPPContenList.Rows[i].RowType == DataControlRowType.DataRow)
            {
                for (int j = 0; j < gridViewCSAPPContenList.Rows[i].Cells.Count - 1; j++)
                {
                    switch (j)
                    {
                        case 1:

                            break;
                        case 2:
                            Image iHotelPic = (Image)gridViewCSAPPContenList.Rows[i].Cells[j].FindControl("imgHotelPic");
                            if (String.IsNullOrEmpty(iHotelPic.ImageUrl))
                            {
                                gridViewCSAPPContenList.Rows[i].Cells[j].Attributes.Add("bgcolor", "#FF6666");
                            }
                            break;
                        case 5:
                            if (String.IsNullOrEmpty(gridViewCSAPPContenList.Rows[i].Cells[j].Text) || decimal.Parse(gridViewCSAPPContenList.Rows[i].Cells[j].Text) < 10)
                            {
                                gridViewCSAPPContenList.Rows[i].Cells[j].Attributes.Add("bgcolor", "#FF6666");
                            }
                            break;
                        default:
                            if (String.IsNullOrEmpty(gridViewCSAPPContenList.Rows[i].Cells[j].Text) || String.IsNullOrEmpty(gridViewCSAPPContenList.Rows[i].Cells[j].Text.Replace("&nbsp;", "").Trim()))
                            {
                                gridViewCSAPPContenList.Rows[i].Cells[j].Attributes.Add("bgcolor", "#FF6666");
                            }
                            break;
                    }
                }
            }
        }
    }
    /// <summary>
    /// 计划更新
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnRenewPlan_Click(object sender, EventArgs e)
    {
        //根据时间段   酒店ID  取出原有计划
        string priceCode = this.rdLmbar.Checked == true ? "LMBAR" : "LMBAR2";
        DataSet planResult = GetBindLmbarPlanList(longPlanStartDate.Value, longPlanEndDate.Value, ViewState["hotelID"].ToString(), priceCode);
        if (planResult.Tables.Count > 0 && planResult.Tables[0].Rows.Count > 0)
        {
            APPContentEntity _appcontentEntity = new APPContentEntity();
            _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
            _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
            _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
            _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

            CommonEntity _commonEntity = new CommonEntity();
            _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
            _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
            _commonEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
            _commonEntity.LogMessages.Username = UserSession.Current.UserDspName;
            _commonEntity.LogMessages.Userid = UserSession.Current.UserAccount;

            _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
            APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

            appcontentDBEntity.HotelID = ViewState["hotelID"].ToString();

            appcontentDBEntity.PriceCode = priceCode;

            string strHRoomListName = "";
            if (priceCode == "LMBAR2")
            {
                foreach (ListItem lt in chkHotelRoomListLMBAR2.Items)
                {
                    if (lt.Selected)
                    {
                        strHRoomListName = strHRoomListName + lt.Text + ",";
                    }
                }
            }
            else
            {
                foreach (ListItem lt in chkHotelRoomListLMBAR.Items)
                {
                    if (lt.Selected)
                    {
                        strHRoomListName = strHRoomListName + lt.Text + ",";
                    }
                }
            }
            strHRoomListName = strHRoomListName.Trim(',');
            if (strHRoomListName == "")
            {
                //Page.RegisterStartupScript(" ", " <script>   alert( '请选择房型! '); return false;</script> ");
                ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "keyalertroom", "alert('请选择房型!')", true);
                return;
            }

            appcontentDBEntity.RoomName = strHRoomListName;

            string strHRoomListCode = "";
            if (priceCode == "LMBAR2")
            {
                foreach (ListItem lt in chkHotelRoomListLMBAR2.Items)
                {
                    if (lt.Selected)
                    {
                        strHRoomListCode = strHRoomListCode + lt.Value + ",";
                    }
                }

            }
            else
            {
                foreach (ListItem lt in chkHotelRoomListLMBAR.Items)
                {
                    if (lt.Selected)
                    {
                        strHRoomListCode = strHRoomListCode + lt.Value + ",";
                    }
                }
            }
            strHRoomListCode = strHRoomListCode.Trim(',');
            appcontentDBEntity.RoomCode = strHRoomListCode;

            appcontentDBEntity.RoomStatus = this.dropStatusOpen.Checked == true ? "true" : "false"; //this.dropStatus.SelectedValue;

            //房量和是否是保留房   应根据状态的开启和关闭  取不同的值
            if (this.dropStatusOpen.Checked)
            {
                if (this.txtRoomCount.Text.Trim() != "")
                {
                    appcontentDBEntity.RoomCount = this.txtRoomCount.Text;
                }
                //appcontentDBEntity.RoomCount = this.txtRoomCount.Text;
                appcontentDBEntity.IsReserve = this.ckReserve.Checked == true ? "0" : "1";
            }

            appcontentDBEntity.WeekList = "1,2,3,4,5,6,7";
            //得到 中断的时间段
            List<string> list = new List<string>();
            list.Add(planResult.Tables[0].Rows[0]["EFFECTDATESTRING"].ToString());
            for (int i = 0; i < planResult.Tables[0].Rows.Count; i++)
            {
                if (i != planResult.Tables[0].Rows.Count - 1)
                {
                    string effToDate = planResult.Tables[0].Rows[i + 1]["EFFECTDATESTRING"].ToString();
                    string effYesDate = planResult.Tables[0].Rows[i]["EFFECTDATESTRING"].ToString();
                    TimeSpan effectDate = DateTime.Parse(effToDate) - DateTime.Parse(effYesDate);
                    if (effectDate.Days > 1)
                    {
                        list.Add(effYesDate);
                        list.Add(effToDate);
                    }
                }
                else
                {
                    list.Add(planResult.Tables[0].Rows[i]["EFFECTDATESTRING"].ToString());
                }
            }

            appcontentDBEntity.UpdateUser = UserSession.Current.UserDspName;
            CommonDBEntity commonDBEntity = new CommonDBEntity();
            for (int j = 0; j < list.Count; j++)
            {
                appcontentDBEntity.StartDTime = list[j].ToString();
                appcontentDBEntity.EndDTime = list[j + 1].ToString();
                j = j + 1;
                _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);

                commonDBEntity = new CommonDBEntity();
                commonDBEntity.Event_Type = "酒店管理-房控计划批量维护";
                commonDBEntity.Event_ID = ViewState["hotelID"].ToString();
                commonDBEntity.IpAddress = UserSession.Current.UserIP;
                commonDBEntity.UserID = UserSession.Current.UserAccount;
                commonDBEntity.UserName = UserSession.Current.UserDspName;
                commonDBEntity.Event_Content = "房控计划批量更新 - 酒店ID:" + ViewState["hotelID"].ToString() + " 价格代码:" + priceCode + " 房型Code:" + appcontentDBEntity.RoomCode + " 计划开始生效时间:" + appcontentDBEntity.StartDTime + "  计划结束生效时间:" + appcontentDBEntity.EndDTime + " 计划状态:" + appcontentDBEntity.RoomStatus;
                commonDBEntity.Event_Result = "已提交";

                _commonEntity.CommonDBEntity.Add(commonDBEntity);
                //CommonBP.InsertEventHistory(_commonEntity);
                _commonEntity.CommonDBEntity.Clear();

                // _appcontentEntity = HotelInfoBP.RenewPlanFullRoom(_appcontentEntity);
            }
            #region
            //appcontentDBEntity.StartDTime = "";//开始日期
            //appcontentDBEntity.EndDTime = "";//结束日期
            //appcontentDBEntity.MoneyType = "";//"币种: CNY(人民币) USD(美元) HKD(港币)"
            //appcontentDBEntity.HotelID = "";//"酒店ID"
            //appcontentDBEntity.HotelNM = "";//"酒店名称"
            //appcontentDBEntity.RoomName = "";//房型名称
            //appcontentDBEntity.RoomCode = "";//房型代码
            //appcontentDBEntity.RoomStatus = "";//true:打开 false:关闭
            //appcontentDBEntity.RoomCount = "";//房间数量
            //appcontentDBEntity.UpdateDTime = "";//更新时间
            //appcontentDBEntity.UpdateUser = "";//操作人
            //appcontentDBEntity.OnePrice = "";//单人价
            //appcontentDBEntity.TwoPrice = "";//双人价
            //appcontentDBEntity.ThreePrice = "";//三人价
            //appcontentDBEntity.FourPrice = "";//四人价
            //appcontentDBEntity.BedPrice = "";//加床价
            //appcontentDBEntity.BreakfastNum = "";//早餐数量
            //appcontentDBEntity.BreakPrice = "";//每份早餐价格
            //appcontentDBEntity.IsNetwork = "";//ctrue(有宽带)false(无宽带)
            //appcontentDBEntity.PriceCode="";//” LMBAR:预付;LMBAR2:现付”
            //appcontentDBEntity.Offsetval = "";//浮动值
            //appcontentDBEntity.Offsetunit = "";//浮动标志,0:固定值,1:百分比
            //appcontentDBEntity.IsReserve = "";//是否保留房:0:保留房;1:非保留房
            //appcontentDBEntity.WeekList="";//"1,2,3,4,5,6,7(分别对应:星期日,一,二,三,四,五,六)值与值之间有逗号分隔"
            #endregion
        }
        BindData();

        //if (this.dropStatusOpen.Checked)
        //{
        //    ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport", "document.getElementById('managerTxtRoomCount').style.display = 'block';document.getElementById('manegerCkReserve').style.display = 'block';", true);
        //}
        //else
        //{
        //    ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport", "document.getElementById('managerTxtRoomCount').style.display = 'none';document.getElementById('manegerCkReserve').style.display = 'none';", true);
        //}

        this.longPlanStartDate.Value = DateTime.Now.ToShortDateString().Replace("/", "-");
        this.longPlanEndDate.Value = DateTime.Now.AddDays(7).ToShortDateString().Replace("/", "-");
        this.rdLmbar2.Checked = true;
        this.rdLmbar.Checked = false;
        this.chkHotelRoomListLMBAR2DIV.Attributes["style"] = "display:''";
        this.chkHotelRoomListLMBARDIV.Attributes.Add("style", "display:none");

        this.dropStatusOpen.Checked = true;
        this.dropStatusClose.Checked = false;
        this.managerTxtRoomCount.Attributes["style"] = "display:''";
        this.manegerCkReserve.Attributes["style"] = "display:''";
    }
    private void BindHotelListGrid2()
    {
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        appcontentDBEntity.HGroupID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HGROUPID"].ToString())) ? null : ViewState["HGROUPID"].ToString();
        appcontentDBEntity.DTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["DTime2"].ToString())) ? null : ViewState["DTime2"].ToString();
        appcontentDBEntity.GType = "1";
        appcontentDBEntity.Cuser = UserSession.Current.UserDspName;
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        DataSet dsResult = APPContentBP.BindHotelListGrid(_appcontentEntity).QueryResult;
        dsResult.Tables[0].DefaultView.Sort = " ONLINES ASC";
        gridViewCSAPPContenList2.DataSource = dsResult.Tables[0].DefaultView;
        gridViewCSAPPContenList2.DataKeyNames = new string[] { "HOTELID" };//主键
        gridViewCSAPPContenList2.DataBind();

        for (int i = 0; i < gridViewCSAPPContenList2.Rows.Count; i++)
        {
            //首先判断是否是数据行
            if (gridViewCSAPPContenList2.Rows[i].RowType == DataControlRowType.DataRow)
            {
                for (int j = 0; j < gridViewCSAPPContenList2.Rows[i].Cells.Count - 1; j++)
                {
                    switch (j)
                    {
                        case 2:
                            if ("否".Equals(gridViewCSAPPContenList2.Rows[i].Cells[j].Text))
                            {
                                gridViewCSAPPContenList2.Rows[i].Cells[j].Attributes.Add("bgcolor", "#FF6666");
                            }
                            break;
                    }
                }
            }
        }
    }
    //protected void gridViewCSAPPContenList_PageIndexChanging(object sender, GridViewPageEventArgs e)
    //{
    //    this.gridViewCSAPPContenList.PageIndex = e.NewPageIndex;
    //    BindDataListGrid();
    //}
    protected void myGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string strHotelID = myGridView.Rows[e.RowIndex].Cells[0].Text.ToString();
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        appcontentDBEntity.HotelID = strHotelID;
        appcontentDBEntity.UserCode = hidUserAccount.Value.Trim();

        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        int iResult = APPContentBP.DeleteSalesManagerGrid(_appcontentEntity);

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

        commonDBEntity.Event_Type = "酒店销售管理-删除";
        commonDBEntity.Event_ID = strHotelID + "-" + hidUserAccount.Value.Trim();
        string conTent = GetLocalResourceObject("EventDeleteMessage").ToString();
        conTent = string.Format(conTent, strHotelID, hidUserAccount.Value.Trim());
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("DeleteSuccess").ToString();
            detailMessageContent.InnerHtml = GetLocalResourceObject("DeleteSuccess").ToString();
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("DeleteError").ToString();
            detailMessageContent.InnerHtml = GetLocalResourceObject("DeleteError").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);

        PopReseachData();
    }
    private DataSet GetConsultRoomHistoryList()
    {
        APPContentEntity _appcontentEntity = new APPContentEntity();
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();
        appcontentDBEntity.CreateUser = UserSession.Current.UserDspName;
        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        DataSet dsResult = HotelInfoBP.GetHasChangedConsultRoomList(_appcontentEntity).QueryResult;
        return dsResult;
    }
    private void BindDataListGrid()
    {
        _appcontentEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _appcontentEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _appcontentEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _appcontentEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _appcontentEntity.APPContentDBEntity = new List<APPContentDBEntity>();
        APPContentDBEntity appcontentDBEntity = new APPContentDBEntity();

        appcontentDBEntity.UserCode = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["SalesUser"].ToString())) ? null : ViewState["SalesUser"].ToString();
        //appcontentDBEntity.HotelNM = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HotelNm"].ToString())) ? null : ViewState["HotelNm"].ToString();

        _appcontentEntity.PageCurrent = AspNetPager1.CurrentPageIndex;
        _appcontentEntity.PageSize = gridViewCSAPPContenList.PageSize;

        _appcontentEntity.APPContentDBEntity.Add(appcontentDBEntity);
        _appcontentEntity = APPContentBP.SalesMangeListSelect(_appcontentEntity);

        DataSet dsResult = _appcontentEntity.QueryResult;
        gridViewCSAPPContenList.DataSource = dsResult.Tables[0].DefaultView;
        gridViewCSAPPContenList.DataKeyNames = new string[] { "USERACCOUNT" };//主键
        gridViewCSAPPContenList.DataBind();

        AspNetPager1.PageSize = gridViewCSAPPContenList.PageSize;
        AspNetPager1.RecordCount = _appcontentEntity.TotalCount;
    }