protected void btnSearch_Click(object sender, EventArgs e)
    {
        string getResult = string.Empty;
        //string strMobile = this.lbLoginMobile.Text;
        //getResult = getSignByPhoneForCC(strMobile);

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

        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity userGroupDBEntity = new UserDBEntity();
        userGroupDBEntity.LoginMobile = this.lbLoginMobile.Text.Trim();

        _userEntity.UserDBEntity.Add(userGroupDBEntity);
        _userEntity = UserSearchBP.getSignByPhoneForCC(_userEntity);
        getResult = _userEntity.UserDBEntity[0].SignKey;
        if (getResult == "")
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("ErrorMessage").ToString();
        }
        else
        {
            this.lbSignKey.Text = getResult;
        }
    }
    private void BindUserMainListDetail()
    {
        _userEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _userEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _userEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _userEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity userGroupDBEntity = new UserDBEntity();

        userGroupDBEntity.UserID = hidUserID.Value;

        _userEntity.UserDBEntity.Add(userGroupDBEntity);

        DataSet dsMainResult = UserSearchBP.UserMainListSelect(_userEntity).QueryResult;

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

        lbUserID.Text = dsMainResult.Tables[0].Rows[0]["ID"].ToString();
        lbLoginMobile.Text = dsMainResult.Tables[0].Rows[0]["LOGINMOBILE"].ToString();

        ViewState["phonenumber"] = dsMainResult.Tables[0].Rows[0]["LOGINMOBILE"].ToString();//手机号码

        lbSignKey.Text = dsMainResult.Tables[0].Rows[0]["SIGN_KEY"].ToString();
        lbSignDate.Text = dsMainResult.Tables[0].Rows[0]["SIGNDATE"].ToString();

        lbCreateDT.Text = dsMainResult.Tables[0].Rows[0]["CREATEDT"].ToString();

        lbAllCount.Text = dsMainResult.Tables[0].Rows[0]["ALLCOUNT"].ToString();
        lbCompleCount.Text = dsMainResult.Tables[0].Rows[0]["COMPLECOUNT"].ToString();

        lbRegchanel.Text = dsMainResult.Tables[0].Rows[0]["REGCHANELNM"].ToString();
        lbDvtoken.Text = dsMainResult.Tables[0].Rows[0]["DVTOKEN"].ToString();
        lbPlatform.Text = dsMainResult.Tables[0].Rows[0]["PLATFORMNM"].ToString();
        lbVrsion.Text = dsMainResult.Tables[0].Rows[0]["VRSION"].ToString();

        lbUserCash.Text = dsMainResult.Tables[0].Rows[0]["USERCASH"].ToString();
    }
    private void BindUserMainListDetail()
    {
        _userEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _userEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _userEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _userEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity userGroupDBEntity = new UserDBEntity();

        userGroupDBEntity.UserID = hidUserID.Value;

        _userEntity.UserDBEntity.Add(userGroupDBEntity);

        DataSet dsMainResult = UserSearchBP.UserCashMainListSelect(_userEntity).QueryResult;

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

        lbUserID.Text = dsMainResult.Tables[0].Rows[0]["ID"].ToString();
        lbLoginMobile.Text = dsMainResult.Tables[0].Rows[0]["LOGINMOBILE"].ToString();
        lbAllCount.Text = dsMainResult.Tables[0].Rows[0]["ALLCOUNT"].ToString();
        lbCompleCount.Text = dsMainResult.Tables[0].Rows[0]["COMPLECOUNT"].ToString();

        lbRegchanel.Text = dsMainResult.Tables[0].Rows[0]["REGCHANELNM"].ToString();
        lbPlatform.Text = dsMainResult.Tables[0].Rows[0]["PLATFORMNM"].ToString();

        lbSignIn.Text = dsMainResult.Tables[0].Rows[0]["CREATETIME"].ToString();
        lbUseCash.Text = dsMainResult.Tables[0].Rows[0]["USECASH"].ToString();
        lbCashApl.Text = dsMainResult.Tables[0].Rows[0]["CASHAPL"].ToString();
        lbCashVer.Text = dsMainResult.Tables[0].Rows[0]["CASHVER"].ToString();
    }
    private void BindViewCSUserListDetail()
    {
        _userEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _userEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _userEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _userEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity userGroupDBEntity = new UserDBEntity();

        userGroupDBEntity.UserID = lbLoginMobile.Text.Trim();

        _userEntity.UserDBEntity.Add(userGroupDBEntity);

        DataSet dsDetailResult = UserSearchBP.UserCashDetailListSelect(_userEntity).QueryResult;

        gridViewCSUserListDetail.DataSource = dsDetailResult.Tables[0].DefaultView;
        gridViewCSUserListDetail.DataKeyNames = new string[] { "PKEY", "SELTYPE" };//主键
        gridViewCSUserListDetail.DataBind();
    }
    private DataSet GetYujiDataSource()
    {
        messageContent.InnerHtml = "";
        string HotelID = "";
        string CityID = "";
        string TagID = "";
        string SalesID = "";

        if ("0".Equals(ddpConrultType.SelectedValue.Trim()))
        {
            CityID = hidAddAutoVal.Value.Trim().Substring((hidAddAutoVal.Value.Trim().IndexOf('[') + 1), (hidAddAutoVal.Value.Trim().IndexOf(']') - 1));
        }
        else if ("1".Equals(ddpConrultType.SelectedValue.Trim()))
        {
            TagID = hidAddAutoVal.Value.Trim().Substring((hidAddAutoVal.Value.Trim().IndexOf('[') + 1), (hidAddAutoVal.Value.Trim().IndexOf(']') - 1));
        }
        else if ("2".Equals(ddpConrultType.SelectedValue.Trim()))
        {
            HotelID = hidAddAutoVal.Value.Trim().Substring((hidAddAutoVal.Value.Trim().IndexOf('[') + 1), (hidAddAutoVal.Value.Trim().IndexOf(']') - 1));
        }
        else if ("3".Equals(ddpConrultType.SelectedValue.Trim()))
        {
            SalesID = hidAddAutoVal.Value.Trim().Substring((hidAddAutoVal.Value.Trim().IndexOf('[') + 1), (hidAddAutoVal.Value.Trim().IndexOf(']') - 1));
        }

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

        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity usergroupEntity = new UserDBEntity();
        usergroupEntity.UserID = hidUserID.Value.Trim().Substring((hidUserID.Value.Trim().IndexOf('[') + 1), (hidUserID.Value.Trim().IndexOf(']') - 1));
        usergroupEntity.HotelID = HotelID;
        usergroupEntity.CityID = CityID;
        usergroupEntity.TagID = TagID;
        usergroupEntity.SalesID = SalesID;
        usergroupEntity.RType = ddpConrultType.SelectedValue.Trim();
        _userEntity.UserDBEntity.Add(usergroupEntity);
        return UserSearchBP.PreConsultRoomUserSelect(_userEntity).QueryResult;
    }
    private void BindmyHistoryGridDetail()
    {
        _userEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _userEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _userEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _userEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity userGroupDBEntity = new UserDBEntity();

        userGroupDBEntity.UserID = lbLoginMobile.Text.Trim();
        userGroupDBEntity.Pkey = hidPkey.Value.Trim();
        userGroupDBEntity.SelectType = hidSelectType.Value.Trim();
        _userEntity.UserDBEntity.Add(userGroupDBEntity);

        DataSet dsDetailResult = UserSearchBP.UserCashPopListSelect(_userEntity).QueryResult;

        myGridView.DataSource = dsDetailResult.Tables["MASTER"].DefaultView;
        myGridView.DataKeyNames = new string[] { "PKEY" };//主键
        myGridView.DataBind();

        myHistoryGridView.DataSource = dsDetailResult.Tables["DETAIL"].DefaultView;
        myHistoryGridView.DataKeyNames = new string[] { "CHDTIME" };//主键
        myHistoryGridView.DataBind();

        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "AddNewlist();", true);
    }
    protected void btnRefush_Click(object sender, EventArgs e)
    {
        messageContent.InnerHtml = "";
        _userEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _userEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _userEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _userEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity usergroupEntity = new UserDBEntity();

        usergroupEntity.UserNo = hidSelecID.Value.Trim();
        _userEntity.UserDBEntity.Add(usergroupEntity);
        DataSet dsResult = UserSearchBP.ReviewConsultRoomUserDetail(_userEntity).QueryResult;

        roomDetailGridView.DataSource = dsResult.Tables[0].DefaultView;
        roomDetailGridView.DataKeyNames = new string[] { "HEXID" };//主键
        roomDetailGridView.DataBind();
        string strTemp = "";
        for (int i = 0; i < roomDetailGridView.Rows.Count; i++)
        {
            //首先判断是否是数据行
            if (roomDetailGridView.Rows[i].RowType == DataControlRowType.DataRow)
            {
                strTemp = roomDetailGridView.DataKeys[i].Values[0].ToString().Trim();
                if (String.IsNullOrEmpty(strTemp))
                {
                    continue;
                }
                roomDetailGridView.Rows[i].Cells[0].Attributes.Add("bgcolor", "#FF6666");
            }
        }
    }
    private void BindReviewUserListGrid()
    {
        //messageContent.InnerHtml = "";

        //if (!checkNum(txtUserCountFrom.Value.Trim()) || !checkNum(txtUserCountTo.Value.Trim()))
        //{
        //    messageContent.InnerHtml = GetLocalResourceObject("ErrorNum").ToString();
        //    return;
        //}

        //if ((!String.IsNullOrEmpty(txtUserCountFrom.Value.ToString().Trim()) && !String.IsNullOrEmpty(txtUserCountTo.Value.ToString().Trim())) && (int.Parse(txtUserCountFrom.Value.ToString().Trim()) > int.Parse(txtUserCountTo.Value.ToString().Trim())))
        //{
        //    messageContent.InnerHtml = GetLocalResourceObject("Error1").ToString();
        //    return;
        //}

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

        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity usergroupEntity = new UserDBEntity();

        usergroupEntity.UserID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["UserID"].ToString())) ? null : ViewState["UserID"].ToString();
        usergroupEntity.RegistStart = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["RegistStart"].ToString())) ? null : ViewState["RegistStart"].ToString();
        usergroupEntity.RegistEnd = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["RegistEnd"].ToString())) ? null : ViewState["RegistEnd"].ToString();
        usergroupEntity.RegChannelID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["RegChannelID"].ToString())) ? null : ViewState["RegChannelID"].ToString();
        usergroupEntity.PlatformID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["PlatformID"].ToString())) ? null : ViewState["PlatformID"].ToString();

        usergroupEntity.OrderFrom = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderFrom"].ToString())) ? null : ViewState["OrderFrom"].ToString();
        usergroupEntity.OrderTo = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderTo"].ToString())) ? null : ViewState["OrderTo"].ToString();
        usergroupEntity.OrderSucFrom = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderSucFrom"].ToString())) ? null : ViewState["OrderSucFrom"].ToString();
        usergroupEntity.OrderSucTo = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderSucTo"].ToString())) ? null : ViewState["OrderSucTo"].ToString();

        //usergroupEntity.OrderCount = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderCount"].ToString())) ? null : ViewState["OrderCount"].ToString();
        //usergroupEntity.OrderSuccCount = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderSucCount"].ToString())) ? null : ViewState["OrderSucCount"].ToString();

        usergroupEntity.LoginStart = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["LoginStart"].ToString())) ? null : ViewState["LoginStart"].ToString();
        usergroupEntity.LoginEnd = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["LoginEnd"].ToString())) ? null : ViewState["LoginEnd"].ToString();

        usergroupEntity.LoginSizeStart = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["LoginSizeStart"].ToString())) ? null : ViewState["LoginSizeStart"].ToString();
        usergroupEntity.LoginSizeEnd = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["LoginSizeEnd"].ToString())) ? null : ViewState["LoginSizeEnd"].ToString();

        usergroupEntity.TicketType = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Type"].ToString())) ? null : ViewState["Type"].ToString();
        usergroupEntity.TicketData = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Data"].ToString())) ? null : ViewState["Data"].ToString();

        usergroupEntity.PackageName = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["packagename"].ToString())) ? null : ViewState["packagename"].ToString();
        usergroupEntity.AmountFrom = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["amountfrom"].ToString())) ? null : ViewState["amountfrom"].ToString();
        usergroupEntity.AmountTo = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["amountto"].ToString())) ? null : ViewState["amountto"].ToString();
        usergroupEntity.PickfromDate = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["pickfromdate"].ToString())) ? null : ViewState["pickfromdate"].ToString();
        usergroupEntity.PicktoDate = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["picktodate"].ToString())) ? null : ViewState["picktodate"].ToString();
        usergroupEntity.TicketTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["tickettime"].ToString())) ? null : ViewState["tickettime"].ToString();

        if (gridViewCSReviewUserList  != null && gridViewCSReviewUserList.Columns.Count > 0 && String.IsNullOrEmpty(usergroupEntity.TicketType) && String.IsNullOrEmpty(usergroupEntity.OrderFrom) && String.IsNullOrEmpty(usergroupEntity.OrderTo) && String.IsNullOrEmpty(usergroupEntity.OrderSucFrom) && String.IsNullOrEmpty(usergroupEntity.OrderSucTo))
        {
            gridViewCSReviewUserList.Columns[7].Visible = false;
            gridViewCSReviewUserList.Columns[8].Visible = false;
        }
        else
        {
            gridViewCSReviewUserList.Columns[7].Visible = true;
            gridViewCSReviewUserList.Columns[8].Visible = true;
        }

        _userEntity.PageCurrent = AspNetPager1.CurrentPageIndex;
        _userEntity.PageSize = gridViewCSReviewUserList.PageSize;
        //usergroupEntity.SelectType = hidSelectType.Value;
        _userEntity.UserDBEntity.Add(usergroupEntity);
        DataSet dsResult = UserSearchBP.ReviewSelect(_userEntity).QueryResult;
        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < dsResult.Tables[0].Rows.Count; i++)
            {
                if (dsResult.Tables[0].Rows[i]["LOGINMOBILE"].ToString().Trim() == "" && dsResult.Tables[0].Rows[i]["THIRD_PARTY_VENDOR"].ToString().Trim() == "")
                {
                    dsResult.Tables[0].Rows[i]["LOGINMOBILE"] = "游客";
                }
                else if (dsResult.Tables[0].Rows[i]["LOGINMOBILE"].ToString().Trim() == "" && dsResult.Tables[0].Rows[i]["THIRD_PARTY_VENDOR"].ToString().Trim() == "QUNAR")
                {
                    dsResult.Tables[0].Rows[i]["LOGINMOBILE"] = "QUNAR";
                }
            }
        }
        gridViewCSReviewUserList.DataSource = dsResult.Tables[0].DefaultView;
        gridViewCSReviewUserList.DataKeyNames = new string[] { "ID" };//主键
        gridViewCSReviewUserList.DataBind();

        AspNetPager1.PageSize = gridViewCSReviewUserList.PageSize;
        AspNetPager1.RecordCount = CountLmSystemLog();
        //this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);

        ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "setScript", "SetAClickEvent()", true);
        //lbCount.Text = dsResult.Tables[0].Rows.Count.ToString();
    }
    protected void btnDel_Click(object sender, EventArgs e)
    {
        string strID = hidConID.Value.ToString();
        _userEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _userEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _userEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _userEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity usergroupEntity = new UserDBEntity();
        usergroupEntity.UserNo = strID;
        _userEntity.UserDBEntity.Add(usergroupEntity);

        int iResult = UserGroupBP.DeleteConsultRoomUser(_userEntity);

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

        commonDBEntity.Event_Type = "巡房条件-删除";
        commonDBEntity.Event_ID = hidUserID.Value.ToString().Trim();
        string conTent = GetLocalResourceObject("EventDeleteMessage").ToString();
        conTent = string.Format(conTent, usergroupEntity.UserNo);
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("DelSuccess").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("DelSuccess").ToString();
            //BindReviewUserListGrid();

            if (hidConID.Value.Equals(hidSelecID.Value))
            {
                roomDetailGridView.DataSource = null;
                roomDetailGridView.DataBind();
            }
            ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "updateScript", "BtnDelCompleteStyle();", true);
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error5").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("Error5").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        messageContent.InnerHtml = "";
        string HotelID = "";
        string CityID = "";
        string TagID = "";
        string SalesID = "";

        if (String.IsNullOrEmpty(hidAddAutoVal.Value.Trim()))
        {
            if ("0".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error7").ToString();
            }
            else if ("1".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error8").ToString();
            }
            else if ("2".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error9").ToString();
            }
            else if ("3".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error91").ToString();
            }
            ScriptManager.RegisterStartupScript(this.UpdatePanel6, this.GetType(), "updateScript", "BtnCompleteStyle();", true);
            return;
        }

        if (!hidAddAutoVal.Value.Trim().Contains("[") || !hidAddAutoVal.Value.Trim().Contains("]"))
        {
            if ("0".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error10").ToString();
            }
            else if ("1".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error11").ToString();
            }
            else if ("2".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error12").ToString();
            }
            else if ("2".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error101").ToString();
            }
            ScriptManager.RegisterStartupScript(this.UpdatePanel6, this.GetType(), "updateScript", "BtnCompleteStyle();", true);
            return;
        }

        if ("0".Equals(ddpConrultType.SelectedValue.Trim()))
        {
            CityID = hidAddAutoVal.Value.Trim().Substring((hidAddAutoVal.Value.Trim().IndexOf('[') + 1), (hidAddAutoVal.Value.Trim().IndexOf(']') - 1));
        }
        else if ("1".Equals(ddpConrultType.SelectedValue.Trim()))
        {
            TagID = hidAddAutoVal.Value.Trim().Substring((hidAddAutoVal.Value.Trim().IndexOf('[') + 1), (hidAddAutoVal.Value.Trim().IndexOf(']') - 1));
        }
        else if ("2".Equals(ddpConrultType.SelectedValue.Trim()))
        {
            HotelID = hidAddAutoVal.Value.Trim().Substring((hidAddAutoVal.Value.Trim().IndexOf('[') + 1), (hidAddAutoVal.Value.Trim().IndexOf(']') - 1));
        }
        else if ("3".Equals(ddpConrultType.SelectedValue.Trim()))
        {
            SalesID = hidAddAutoVal.Value.Trim().Substring((hidAddAutoVal.Value.Trim().IndexOf('[') + 1), (hidAddAutoVal.Value.Trim().IndexOf(']') - 1));
        }

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

        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity usergroupEntity = new UserDBEntity();
        //usergroupEntity.UserID = hidUserID.Value.Trim().Substring((hidUserID.Value.Trim().IndexOf('[') + 1), (hidUserID.Value.Trim().IndexOf(']') - 1));
        usergroupEntity.HotelID = HotelID;
        usergroupEntity.CityID = CityID;
        usergroupEntity.TagID = TagID;
        usergroupEntity.SalesID = SalesID;
        usergroupEntity.RType = ddpConrultType.SelectedValue.Trim();
        _userEntity.UserDBEntity.Add(usergroupEntity);

        DataSet dsResult = UserSearchBP.PreConsultRoomUserSelect(_userEntity).QueryResult;

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

        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
        {
            lbAddTotal.Text = dsResult.Tables[0].Rows.Count.ToString();
        }
        else
        {
            lbAddTotal.Text = "0";
        }

        dvBtnSty.Style.Add("display", "");
        dvBtnOK.Style.Add("display", "none");

        ScriptManager.RegisterStartupScript(this.UpdatePanel6, this.GetType(), "updateScript", "BtnOKCompleteStyle();", true);
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        messageContent.InnerHtml = "";

        string HotelID = "";
        string CityID = "";
        string TagID = "";
        string SalesID = "";

        if (String.IsNullOrEmpty(hidUserID.Value.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error14").ToString();
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "BtnCompleteStyle();", true);
            return;
        }

        if (String.IsNullOrEmpty(hidAddAutoVal.Value.Trim()))
        {
            if ("0".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error7").ToString();
            }
            else if ("1".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error8").ToString();
            }
            else if ("2".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error9").ToString();
            }
            else if ("3".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error91").ToString();
            }
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "BtnCompleteStyle();", true);
            return;
        }

        if (!hidAddAutoVal.Value.Trim().Contains("[") || !hidAddAutoVal.Value.Trim().Contains("]"))
        {
            if ("0".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error10").ToString();
            }
            else if ("1".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error11").ToString();
            }
            else if ("2".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error12").ToString();
            }
            else if ("2".Equals(ddpConrultType.SelectedValue.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error101").ToString();
            }
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "BtnCompleteStyle();", true);
            return;
        }

        if ("0".Equals(ddpConrultType.SelectedValue.Trim()))
        {
            CityID = hidAddAutoVal.Value.Trim().Substring((hidAddAutoVal.Value.Trim().IndexOf('[') + 1), (hidAddAutoVal.Value.Trim().IndexOf(']') - 1));
        }
        else if ("1".Equals(ddpConrultType.SelectedValue.Trim()))
        {
            //CityID = hidAddAutoVal2.Value.Trim().Substring((hidAddAutoVal2.Value.Trim().IndexOf('[') + 1), (hidAddAutoVal2.Value.Trim().IndexOf(']') - 1));
            TagID = hidAddAutoVal.Value.Trim().Substring((hidAddAutoVal.Value.Trim().IndexOf('[') + 1), (hidAddAutoVal.Value.Trim().IndexOf(']') - 1));
        }
        else if ("2".Equals(ddpConrultType.SelectedValue.Trim()))
        {
            HotelID = hidAddAutoVal.Value.Trim().Substring((hidAddAutoVal.Value.Trim().IndexOf('[') + 1), (hidAddAutoVal.Value.Trim().IndexOf(']') - 1));
        }
        else if ("3".Equals(ddpConrultType.SelectedValue.Trim()))
        {
            SalesID = hidAddAutoVal.Value.Trim().Substring((hidAddAutoVal.Value.Trim().IndexOf('[') + 1), (hidAddAutoVal.Value.Trim().IndexOf(']') - 1));
        }

        if ("2".Equals(ddpConrultType.SelectedValue.Trim()) && hidALDelHT.Value.Contains(HotelID))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error13").ToString();
            ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "BtnCompleteStyle();", true);
            return;
        }

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

        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity usergroupEntity = new UserDBEntity();
        usergroupEntity.UserID = hidUserID.Value.Trim().Substring((hidUserID.Value.Trim().IndexOf('[') + 1), (hidUserID.Value.Trim().IndexOf(']') - 1));
        usergroupEntity.HotelID = HotelID;
        usergroupEntity.CityID = CityID;
        usergroupEntity.TagID = TagID;
        usergroupEntity.SalesID = SalesID;
        usergroupEntity.RType = ddpConrultType.SelectedValue.Trim();
        usergroupEntity.ALDelHT = hidALDelHT.Value.ToString();
        _userEntity.UserDBEntity.Add(usergroupEntity);

        int iResult = UserGroupBP.InsertConsultRoomUser(_userEntity);

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

        commonDBEntity.Event_Type = "巡房条件-保存";
        commonDBEntity.Event_ID = hidUserID.Value.ToString().Trim();
        string conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        string conval = "";
        if ("0".Equals(usergroupEntity.RType))
        {
            conval = usergroupEntity.CityID;
        }
        else if ("1".Equals(usergroupEntity.RType))
        {
            conval = usergroupEntity.CityID + "-" + usergroupEntity.TagID;
        }
        else if ("2".Equals(usergroupEntity.RType))
        {
            conval = usergroupEntity.HotelID;
        }
        else if ("3".Equals(usergroupEntity.RType))
        {
            conval = usergroupEntity.SalesID;
        }
        conTent = string.Format(conTent, usergroupEntity.UserID, usergroupEntity.RType, conval);
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("InsertSuccess").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("InsertSuccess").ToString();

            dvBtnSty.Style.Add("display", "none");
            dvBtnOK.Style.Add("display", "");
            lbAddTotal.Text = "0";
            hidALDelHT.Value = "";
            hidAddDelHTID.Value = "";
            hidALDelTP.Value = "";
            addHotelView.DataSource = null;
            addHotelView.DataBind();
            //BindReviewUserListGrid();
            ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "updateScript", "BtnADDCompleteStyle();", true);
        }
        else if (iResult == 2)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error2").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("Error2").ToString();
        }
        else if (iResult == 3)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error3").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("Error3").ToString();
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error4").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("Error4").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
    }
    //导出Excel文件
    protected void btnExport_Click(object sender, EventArgs e)
    {
        _userEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _userEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _userEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _userEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity usergroupEntity = new UserDBEntity();

        usergroupEntity.UserID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["UserID"].ToString())) ? null : ViewState["UserID"].ToString();
        usergroupEntity.RegistStart = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["RegistStart"].ToString())) ? null : ViewState["RegistStart"].ToString();
        usergroupEntity.RegistEnd = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["RegistEnd"].ToString())) ? null : ViewState["RegistEnd"].ToString();
        usergroupEntity.RegChannelID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["RegChannelID"].ToString())) ? null : ViewState["RegChannelID"].ToString();
        usergroupEntity.PlatformID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["PlatformID"].ToString())) ? null : ViewState["PlatformID"].ToString();

        usergroupEntity.OrderFrom = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderFrom"].ToString())) ? null : ViewState["OrderFrom"].ToString();
        usergroupEntity.OrderTo = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderTo"].ToString())) ? null : ViewState["OrderTo"].ToString();
        usergroupEntity.OrderSucFrom = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderSucFrom"].ToString())) ? null : ViewState["OrderSucFrom"].ToString();
        usergroupEntity.OrderSucTo = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderSucTo"].ToString())) ? null : ViewState["OrderSucTo"].ToString();

        //usergroupEntity.OrderCount = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderCount"].ToString())) ? null : ViewState["OrderCount"].ToString();
        //usergroupEntity.OrderSuccCount = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderSucCount"].ToString())) ? null : ViewState["OrderSucCount"].ToString();

        usergroupEntity.LoginStart = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["LoginStart"].ToString())) ? null : ViewState["LoginStart"].ToString();
        usergroupEntity.LoginEnd = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["LoginEnd"].ToString())) ? null : ViewState["LoginEnd"].ToString();

        usergroupEntity.LoginSizeStart = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["LoginSizeStart"].ToString())) ? null : ViewState["LoginSizeStart"].ToString();
        usergroupEntity.LoginSizeEnd = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["LoginSizeEnd"].ToString())) ? null : ViewState["LoginSizeEnd"].ToString();

        usergroupEntity.TicketType = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Type"].ToString())) ? null : ViewState["Type"].ToString();
        usergroupEntity.TicketData = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Data"].ToString())) ? null : ViewState["Data"].ToString();
        usergroupEntity.PackageName = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["packagename"].ToString())) ? null : ViewState["packagename"].ToString();
        usergroupEntity.AmountFrom = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["amountfrom"].ToString())) ? null : ViewState["amountfrom"].ToString();
        usergroupEntity.AmountTo = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["amountto"].ToString())) ? null : ViewState["amountto"].ToString();
        usergroupEntity.PickfromDate = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["pickfromdate"].ToString())) ? null : ViewState["pickfromdate"].ToString();
        usergroupEntity.PicktoDate = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["picktodate"].ToString())) ? null : ViewState["picktodate"].ToString();
        usergroupEntity.TicketTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["tickettime"].ToString())) ? null : ViewState["tickettime"].ToString();

        //usergroupEntity.SelectType = hidSelectType.Value;
        _userEntity.UserDBEntity.Add(usergroupEntity);
        DataSet dsResult = UserSearchBP.ExportReviewSelect(_userEntity).QueryResult;

        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
        {
            for (int i = 0; i < dsResult.Tables[0].Rows.Count; i++)
            {
                if (dsResult.Tables[0].Rows[i]["LOGINMOBILE"].ToString().Trim() == "" && dsResult.Tables[0].Rows[i]["THIRD_PARTY_VENDOR"].ToString().Trim() == "")
                {
                    dsResult.Tables[0].Rows[i]["LOGINMOBILE"] = "游客";
                }
                else if (dsResult.Tables[0].Rows[i]["LOGINMOBILE"].ToString().Trim() == "" && dsResult.Tables[0].Rows[i]["THIRD_PARTY_VENDOR"].ToString().Trim() == "QUNAR")
                {
                    dsResult.Tables[0].Rows[i]["LOGINMOBILE"] = "QUNAR";
                }
            }
        }

        CommonFunction.ExportExcelForLM(dsResult);
        //background.Style.Add("display", "none");
        //progressBar.Style.Add("display", "none");
    }
    private int CountLmSystemLog()
    {
        _userEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _userEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _userEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _userEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity usergroupEntity = new UserDBEntity();

        usergroupEntity.UserID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["UserID"].ToString())) ? null : ViewState["UserID"].ToString();
        usergroupEntity.RegistStart = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["RegistStart"].ToString())) ? null : ViewState["RegistStart"].ToString();
        usergroupEntity.RegistEnd = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["RegistEnd"].ToString())) ? null : ViewState["RegistEnd"].ToString();
        usergroupEntity.RegChannelID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["RegChannelID"].ToString())) ? null : ViewState["RegChannelID"].ToString();
        usergroupEntity.PlatformID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["PlatformID"].ToString())) ? null : ViewState["PlatformID"].ToString();

        usergroupEntity.OrderFrom = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderFrom"].ToString())) ? null : ViewState["OrderFrom"].ToString();
        usergroupEntity.OrderTo = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderTo"].ToString())) ? null : ViewState["OrderTo"].ToString();
        usergroupEntity.OrderSucFrom = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderSucFrom"].ToString())) ? null : ViewState["OrderSucFrom"].ToString();
        usergroupEntity.OrderSucTo = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderSucTo"].ToString())) ? null : ViewState["OrderSucTo"].ToString();

        //usergroupEntity.OrderCount = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderCount"].ToString())) ? null : ViewState["OrderCount"].ToString();
        //usergroupEntity.OrderSuccCount = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderSucCount"].ToString())) ? null : ViewState["OrderSucCount"].ToString();

        usergroupEntity.LoginStart = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["LoginStart"].ToString())) ? null : ViewState["LoginStart"].ToString();
        usergroupEntity.LoginEnd = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["LoginEnd"].ToString())) ? null : ViewState["LoginEnd"].ToString();

        usergroupEntity.LoginSizeStart = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["LoginSizeStart"].ToString())) ? null : ViewState["LoginSizeStart"].ToString();
        usergroupEntity.LoginSizeEnd = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["LoginSizeEnd"].ToString())) ? null : ViewState["LoginSizeEnd"].ToString();

        usergroupEntity.TicketType = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Type"].ToString())) ? null : ViewState["Type"].ToString();
        usergroupEntity.TicketData = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Data"].ToString())) ? null : ViewState["Data"].ToString();
        usergroupEntity.PackageName = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["packagename"].ToString())) ? null : ViewState["packagename"].ToString();
        usergroupEntity.AmountFrom = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["amountfrom"].ToString())) ? null : ViewState["amountfrom"].ToString();
        usergroupEntity.AmountTo = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["amountto"].ToString())) ? null : ViewState["amountto"].ToString();
        usergroupEntity.PickfromDate = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["pickfromdate"].ToString())) ? null : ViewState["pickfromdate"].ToString();
        usergroupEntity.PicktoDate = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["picktodate"].ToString())) ? null : ViewState["picktodate"].ToString();
        usergroupEntity.TicketTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["tickettime"].ToString())) ? null : ViewState["tickettime"].ToString();

        _userEntity.UserDBEntity.Add(usergroupEntity);
        DataSet dsResult = UserSearchBP.ReviewSelectCount(_userEntity).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 BindViewCSUserListDetail()
    {
        _userEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _userEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _userEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _userEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity userGroupDBEntity = new UserDBEntity();

        userGroupDBEntity.UserID = hidUserID.Value;

        _userEntity.UserDBEntity.Add(userGroupDBEntity);

        DataSet dsDetailResult = UserSearchBP.UserDetailListSelect(_userEntity).QueryResult;

        // 获取GridView排序数据列及排序方向
        string sortExpression = gridViewCSUserListDetail.Attributes["SortExpression"];
        string sortDirection = gridViewCSUserListDetail.Attributes["SortDirection"];
        // 根据GridView排序数据列及排序方向设置显示的默认数据视图
        if ((!string.IsNullOrEmpty(sortExpression)) && (!string.IsNullOrEmpty(sortDirection)))
        {
            dsDetailResult.Tables[0].DefaultView.Sort = string.Format("{0} {1}", sortExpression, sortDirection);
        }

        gridViewCSUserListDetail.DataSource = dsDetailResult.Tables[0].DefaultView;
        gridViewCSUserListDetail.DataKeyNames = new string[] { "LMID" };//主键
        gridViewCSUserListDetail.DataBind();
    }
    private void BindReviewUserListGrid()
    {
        _userEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _userEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _userEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _userEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity usergroupEntity = new UserDBEntity();
        usergroupEntity.UserID = hidUserID.Value.Trim().Substring((hidUserID.Value.Trim().IndexOf('[') + 1), (hidUserID.Value.Trim().IndexOf(']') - 1));
        _userEntity.UserDBEntity.Add(usergroupEntity);
        DataSet dsResult = UserSearchBP.ReviewConsultRoomUserSelect(_userEntity).QueryResult;

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

        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
        {
            lbUserHotelNum.Text = dsResult.Tables[0].Compute("sum(HTSUM)", "true").ToString();
        }
        else
        {
            lbUserHotelNum.Text = "0";
        }
    }
    private string GetUserIDFromMobile(string strMobile)
    {
        string strResult = "";

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

        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity userGroupDBEntity = new UserDBEntity();

        userGroupDBEntity.LoginMobile = strMobile;
        _userEntity.UserDBEntity.Add(userGroupDBEntity);

        DataSet dsDetailResult = UserSearchBP.GetUserIDFromMobile(_userEntity).QueryResult;
        if (dsDetailResult.Tables.Count > 0 && dsDetailResult.Tables[0].Rows.Count > 0)
        {
            strResult = dsDetailResult.Tables[0].Rows[0][0].ToString();
        }

        return strResult;
    }
    //protected void gridViewCSReviewUserList_RowDeleting(object sender, GridViewDeleteEventArgs e)
    //{
    //    string strID = gridViewCSReviewUserList.DataKeys[e.RowIndex].Value.ToString();
    //    _userEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
    //    _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
    //    _userEntity.LogMessages.Userid = UserSession.Current.UserAccount;
    //    _userEntity.LogMessages.Username = UserSession.Current.UserDspName;
    //    _userEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
    //    _userEntity.UserDBEntity = new List<UserDBEntity>();
    //    UserDBEntity usergroupEntity = new UserDBEntity();
    //    usergroupEntity.UserNo = strID;
    //    _userEntity.UserDBEntity.Add(usergroupEntity);
    //    int iResult = UserGroupBP.DeleteConsultRoomUser(_userEntity);
    //    _commonEntity.LogMessages = _userEntity.LogMessages;
    //    _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
    //    CommonDBEntity commonDBEntity = new CommonDBEntity();
    //    commonDBEntity.Event_Type = "巡房条件-删除";
    //    commonDBEntity.Event_ID = hidUserID.Value.ToString().Trim();
    //    string conTent = GetLocalResourceObject("EventDeleteMessage").ToString();
    //    conTent = string.Format(conTent, usergroupEntity.UserNo);
    //    commonDBEntity.Event_Content = conTent;
    //    if (iResult == 1)
    //    {
    //        commonDBEntity.Event_Result = GetLocalResourceObject("DelSuccess").ToString();
    //        messageContent.InnerHtml = GetLocalResourceObject("DelSuccess").ToString();
    //        BindReviewUserListGrid();
    //        //ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "BtnDelCompleteStyle();", true);
    //    }
    //    else
    //    {
    //        commonDBEntity.Event_Result = GetLocalResourceObject("Error5").ToString();
    //        messageContent.InnerHtml = GetLocalResourceObject("Error5").ToString();
    //    }
    //    _commonEntity.CommonDBEntity.Add(commonDBEntity);
    //    CommonBP.InsertEventHistory(_commonEntity);
    //}
    /// <summary>
    /// 分配所有  城市 下面  所有酒店  到 该用户名下
    /// 获取 该用户已绑定信息   获取所有城市    绑定到该用户名下
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnAllotAllCitys_Click(object sender, EventArgs e)
    {
        #region  判断是否 有用户
        if (String.IsNullOrEmpty(hidSelecUserID.Value.Trim()))
        {
            messageContent.InnerHtml = "订单审核任务分配绑定城市失败,请选择用户!";
            ScriptManager.RegisterStartupScript(this.UpdatePanel2, this.GetType(), "updateScript", "BtnCompleteStyle();", true);
            return;
        }

        if (!hidSelecUserID.Value.Trim().Contains("[") || !hidSelecUserID.Value.Trim().Contains("]"))
        {
            messageContent.InnerHtml = "订单审核任务分配绑定城市失败,请选择用户!";
            ScriptManager.RegisterStartupScript(this.UpdatePanel2, this.GetType(), "updateScript", "BtnCompleteStyle();", true);
            return;
        }
        #endregion

        hidUserID.Value = hidSelecUserID.Value;

        #region   获取该用户 已绑定的 城市 酒店 商圈 信息
        _userEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _userEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _userEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _userEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _userEntity.UserDBEntity = new List<UserDBEntity>();
        UserDBEntity usergroupEntity = new UserDBEntity();
        usergroupEntity.UserID = hidUserID.Value.Trim().Substring((hidUserID.Value.Trim().IndexOf('[') + 1), (hidUserID.Value.Trim().IndexOf(']') - 1));
        _userEntity.UserDBEntity.Add(usergroupEntity);
        DataSet dsResult = UserSearchBP.ReviewConsultPOrderUserSelect(_userEntity).QueryResult;//用户绑定信息
        #endregion

        #region 获取所有城市
        CityEntity _cityEntity = new CityEntity();
        _cityEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _cityEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _cityEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _cityEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _cityEntity.CityDBEntity = new List<CityDBEntity>();
        CityDBEntity cityDBEntity = new CityDBEntity();
        _cityEntity.CityDBEntity.Add(cityDBEntity);

        DataSet dsCityResult = CityBP.Select(_cityEntity).QueryResult;
        #endregion

        for (int i = 0; i < dsCityResult.Tables[0].Rows.Count; i++)
        {
            DataRow[] rows = dsResult.Tables[0].Select("CONSULTVAL='" + dsCityResult.Tables[0].Rows[i]["CONSULTVAL"].ToString() + "'");
            if (rows.Length == 0)//当前城市没有绑定   将该城市 绑定到该用户下面
            {
                string CityID = dsCityResult.Tables[0].Rows[i]["cityID"].ToString();

                #region  保存城市  记录日志
                _userEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
                _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
                _userEntity.LogMessages.Userid = UserSession.Current.UserAccount;
                _userEntity.LogMessages.Username = UserSession.Current.UserDspName;
                _userEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

                _userEntity.UserDBEntity = new List<UserDBEntity>();
                usergroupEntity = new UserDBEntity();
                usergroupEntity.UserID = hidUserID.Value.Trim().Substring((hidUserID.Value.Trim().IndexOf('[') + 1), (hidUserID.Value.Trim().IndexOf(']') - 1));
                usergroupEntity.CityID = CityID;
                usergroupEntity.RType = "0";//城市
                _userEntity.UserDBEntity.Add(usergroupEntity);

                int iResult = UserGroupBP.InsertConsultPOrderUser(_userEntity);

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

                commonDBEntity.Event_Type = "订单审核任务分配-All-批量城市-保存";
                commonDBEntity.Event_ID = hidUserID.Value.ToString().Trim();
                string conTent = GetLocalResourceObject("EventInsertMessage").ToString();
                string conval = usergroupEntity.CityID;

                conTent = string.Format(conTent, usergroupEntity.UserID, usergroupEntity.RType, conval);
                commonDBEntity.Event_Content = conTent;

                if (iResult == 1)
                {
                    commonDBEntity.Event_Result = GetLocalResourceObject("InsertSuccess").ToString();
                }
                else if (iResult == 2)
                {
                    commonDBEntity.Event_Result = GetLocalResourceObject("Error2").ToString();
                }
                else if (iResult == 3)
                {
                    commonDBEntity.Event_Result = GetLocalResourceObject("Error3").ToString();
                }
                else
                {
                    commonDBEntity.Event_Result = GetLocalResourceObject("Error4").ToString();
                }
                _commonEntity.CommonDBEntity.Add(commonDBEntity);
                CommonBP.InsertEventHistory(_commonEntity);
                #endregion
            }
        }
        ScriptManager.RegisterStartupScript(this.UpdatePanel2, this.GetType(), "updateScriptAll", "BtnCompleteStyle();", true);
    }