public void btnAddData()
    {
        MessageContent.InnerHtml = "";

        if (String.IsNullOrEmpty(txtServiceName.Value.ToString().Trim()))
        {
            MessageContent.InnerHtml = GetLocalResourceObject("Error3").ToString();
            return;
        }

        if (String.IsNullOrEmpty(ddpFtTypeList.SelectedValue))
        {
            MessageContent.InnerHtml = GetLocalResourceObject("Error4").ToString();
            return;
        }

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

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();
        HotelFacilitiesDBEntity hotelFacilitiesDBEntity = new HotelFacilitiesDBEntity();
        hotelFacilitiesDBEntity.Name_CN = txtServiceName.Value;
        hotelFacilitiesDBEntity.Type = ddpFtTypeList.SelectedValue;
        hotelFacilitiesDBEntity.FTSeq = lbFtSeq.Text;
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelFacilitiesDBEntity);
        int iResult = HotelFacilitiesBP.Insert(_hotelfacilitiesEntity);

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

        commonDBEntity.Event_Type = "酒店服务设施管理-添加";
        commonDBEntity.Event_ID = txtServiceName.Value;
        string conTent = "";
        conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        conTent = string.Format(conTent, txtServiceName.Value, ddpFtTypeList.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 = GetLocalResourceObject("Error1").ToString();
            MessageContent.InnerHtml = GetLocalResourceObject("Error1").ToString();
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error2").ToString();
            MessageContent.InnerHtml = GetLocalResourceObject("Error2").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
    }
    public void BindListGrid()
    {
        _hotelfacilitiesEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _hotelfacilitiesEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _hotelfacilitiesEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _hotelfacilitiesEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();
        HotelFacilitiesDBEntity hotelFacilitiesDBEntity = new HotelFacilitiesDBEntity();
        hotelFacilitiesDBEntity.Type = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["SELFTTYPE"].ToString())) ? null : ViewState["SELFTTYPE"].ToString();
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelFacilitiesDBEntity);

        DataSet dsResult = HotelFacilitiesBP.ServiceTypeSelect(_hotelfacilitiesEntity).QueryResult;

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

        if (!String.IsNullOrEmpty(refushFlag.Value))
        {
            MessageContent.InnerHtml = GetLocalResourceObject("UpdateSuccess").ToString();
            refushFlag.Value = "";
        }

        lbFtSeq.Text = GetFtTypeMaxSeq();
        btnModifySeq.Visible = true;
        dvUpdateSeq.Style.Add("display", "none");
    }
    public void BindHotelList()
    {
        MessageContent.InnerHtml = "";
        _hotelfacilitiesEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _hotelfacilitiesEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _hotelfacilitiesEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _hotelfacilitiesEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();
        HotelFacilitiesDBEntity hotelFacilitiesDBEntity = new HotelFacilitiesDBEntity();
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelFacilitiesDBEntity);
        hotelFacilitiesDBEntity.HotelID = hidHotelID.Value;
        DataSet dsResult = HotelFacilitiesBP.BindHotelList(_hotelfacilitiesEntity).QueryResult;

        if (dsResult.Tables.Count == 0 || dsResult.Tables[0].Rows.Count == 0)
        {
            return;
        }

        ArrayList chkList = new ArrayList();

        foreach (DataRow drRow in dsResult.Tables[0].Rows)
        {
            chkList.Add(drRow["FACILITIESCODE"].ToString());
        }

        for (int i = 0; i < dvChkList.Controls.Count; i++)
        {
            if (dvChkList.Controls[i].Controls.Count > 0)
            {
                CheckBoxList chbList = (CheckBoxList)dvChkList.Controls[i].Controls[0];
                foreach (ListItem li in chbList.Items)
                {
                    if (chkList.Contains(li.Value))
                    {
                        li.Selected = true;
                    }
                }
            }
        }
        UpdatePanel3.Update();
         //foreach (ListItem li in chkServiceList.Items)
         //{
         //    if (chkList.Contains(li.Value))
         //    {
         //       li.Selected = true;
         //    }
         //}

         //foreach (ListItem li in chkFacilitiesList.Items)
         //{
         //    if (chkList.Contains(li.Value))
         //    {
         //        li.Selected = true;
         //    }
         //}

        //UpdatePanel1.Update();
    }
    public void BindFtListGrid()
    {
        //messageContent.InnerHtml = "";
        _hotelfacilitiesEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _hotelfacilitiesEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _hotelfacilitiesEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _hotelfacilitiesEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();
        HotelFacilitiesDBEntity hotelfacilitiesDBEntity = new HotelFacilitiesDBEntity();
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelfacilitiesDBEntity);

        DataSet dsResult = HotelFacilitiesBP.FtTypeSelect(_hotelfacilitiesEntity).QueryResult;

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

        //DropDownList ddl;
        //for (int i = 0; i <= gridViewCSPaymentList.Rows.Count - 1; i++)
        //{
        //    DataRowView drvtemp = dsResult.Tables[0].DefaultView[i];
        //    ddl = (DropDownList)gridViewCSPaymentList.Rows[i].FindControl("ddlOnline");
        //    ddl.SelectedValue = drvtemp["ONLINESTATUS"].ToString();
        //}

        if (!String.IsNullOrEmpty(refushFlag.Value))
        {
            messageContent.InnerHtml = GetLocalResourceObject("UpdateSuccess").ToString();
            refushFlag.Value = "";
        }

        lbFtSeq.Text = GetFtTypeMaxSeq();

        if (gridViewCSList.Rows.Count > 0)
        {
            btnModifySeq.Visible = true;
            dvUpdateSeq.Style.Add("display", "none");
            //gridViewCSList.Columns[3].Visible = true;
            //gridViewCSList.Columns[4].Visible = false;

            for (int i = 0; i < gridViewCSList.Rows.Count; i++)
            {
                //首先判断是否是数据行
                if (gridViewCSList.Rows[i].RowType == DataControlRowType.DataRow)
                {
                    TextBox tbBox = (TextBox)gridViewCSList.Rows[i].FindControl("txtSeqList");
                    tbBox.Enabled = false;
                }
            }
        }
    }
    public void BindFacilitiesList()
    {
        MessageContent.InnerHtml = "";
        _hotelfacilitiesEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _hotelfacilitiesEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _hotelfacilitiesEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _hotelfacilitiesEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();
        HotelFacilitiesDBEntity hotelFacilitiesDBEntity = new HotelFacilitiesDBEntity();
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelFacilitiesDBEntity);

        DataSet dsResult = HotelFacilitiesBP.FacilitiesTypeSelect(_hotelfacilitiesEntity).QueryResult;
        //chkFacilitiesList.DataTextField = "FACILITIESNM";
        //chkFacilitiesList.DataValueField = "FACILITIESCODE";
        //chkFacilitiesList.DataSource = dsResult;
        //chkFacilitiesList.DataBind();
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        detailMessageContent.InnerHtml = "";

        if (String.IsNullOrEmpty(txtName.Value.ToString().Trim()))
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("UpdateError4").ToString();
            return;
        }

        if (txtName.Value.ToString().Trim().Length > 12)
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("UpdateError3").ToString();
            return;
        }

        if (String.IsNullOrEmpty(ddpFtTypeList.SelectedValue))
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("UpdateError5").ToString();
            return;
        }

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();

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

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();
        HotelFacilitiesDBEntity hotelFacilitiesDBEntity = new HotelFacilitiesDBEntity();
        hotelFacilitiesDBEntity.ID = hiddenId.Value;
        hotelFacilitiesDBEntity.Name_CN = txtName.Value;
        hotelFacilitiesDBEntity.OnlineStatus = ddpStatusList.SelectedValue;
        hotelFacilitiesDBEntity.Type = ddpFtTypeList.SelectedValue;
        hotelFacilitiesDBEntity.FTSeq = lbFtSeq.Text;
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelFacilitiesDBEntity);

        int iResult = HotelFacilitiesBP.Update(_hotelfacilitiesEntity);
        _commonEntity.LogMessages = _hotelfacilitiesEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        string conTent = "";
        conTent = GetLocalResourceObject("EventInsertMessage").ToString();

        conTent = string.Format(conTent, txtName.Value, ddpStatusList.SelectedValue);
        commonDBEntity.Event_Type = "酒店设置服务详细-更新";
        commonDBEntity.Event_ID = txtName.Value;
        commonDBEntity.Event_Content = conTent;
        if (iResult == 1)
        {
            Response.Write("<script>window.returnValue=true;window.opener = null;window.close();</script>");
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateSuccess").ToString();
        }
        else if (iResult == 2)
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("UpdateError2").ToString();
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError2").ToString();
        }
        else
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("UpdateError1").ToString();
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError1").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
    }
    private string GetMaxSeqForUpdate()
    {
        _hotelfacilitiesEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _hotelfacilitiesEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _hotelfacilitiesEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _hotelfacilitiesEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();
        HotelFacilitiesDBEntity hotelfacilitiesDBEntity = new HotelFacilitiesDBEntity();

        hotelfacilitiesDBEntity.ID = hiddenId.Value;
        hotelfacilitiesDBEntity.Type = ddpFtTypeList.SelectedValue;

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelfacilitiesDBEntity);

        DataSet dsResult = HotelFacilitiesBP.GetFtHotelMaxForUpdate(_hotelfacilitiesEntity).QueryResult;

        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
        {
            return dsResult.Tables[0].Rows[0][0].ToString();
        }

        return GetFtTypeMaxSeq();
    }
    private void BindContentDetail(string strID)
    {
        detailMessageContent.InnerHtml = "";
        _hotelfacilitiesEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _hotelfacilitiesEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _hotelfacilitiesEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _hotelfacilitiesEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();
        HotelFacilitiesDBEntity hotelFacilitiesDBEntity = new HotelFacilitiesDBEntity();
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelFacilitiesDBEntity);

        hotelFacilitiesDBEntity.ID = strID;

        DataSet dsResult = dsResult = HotelFacilitiesBP.SelectTypeDetail(_hotelfacilitiesEntity).QueryResult;

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

        lbId.Text = dsResult.Tables[0].Rows[0]["id"].ToString();
        txtName.Value = dsResult.Tables[0].Rows[0]["name_zh"].ToString();
        ddpStatusList.SelectedValue = dsResult.Tables[0].Rows[0]["status"].ToString();
        ddpFtTypeList.SelectedValue = dsResult.Tables[0].Rows[0]["TYPE"].ToString();
        lbFtSeq.Text = dsResult.Tables[0].Rows[0]["SEQ"].ToString();
    }
    private string GetFtTypeMaxSeq()
    {
        _hotelfacilitiesEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _hotelfacilitiesEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _hotelfacilitiesEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _hotelfacilitiesEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();
        HotelFacilitiesDBEntity hotelfacilitiesDBEntity = new HotelFacilitiesDBEntity();

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelfacilitiesDBEntity);

        DataSet dsResult = HotelFacilitiesBP.GetFtTypeMaxSeq(_hotelfacilitiesEntity).QueryResult;

        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
        {
            return dsResult.Tables[0].Rows[0][0].ToString();
        }
        else
        {
            return "1";
        }
    }
    protected void btnUpdateSeq_Click(object sender, EventArgs e)
    {
        Hashtable htList = new Hashtable();

        for (int i = 0; i < gridViewCSList.Rows.Count; i++)
        {
            //首先判断是否是数据行
            if (gridViewCSList.Rows[i].RowType == DataControlRowType.DataRow)
            {
                string FtID = gridViewCSList.Rows[i].Cells[0].Text.ToString();
                TextBox tbBox = (TextBox)gridViewCSList.Rows[i].FindControl("txtSeqList");

                if (!checkNum(tbBox.Text.Trim()))
                {
                    messageContent.InnerHtml = GetLocalResourceObject("UpdateError1").ToString();
                    return;
                }

                htList.Add(FtID, tbBox.Text);
            }
        }

        Hashtable hNew = new Hashtable();
        foreach (System.Collections.DictionaryEntry key in htList)
        {
            if (!hNew.ContainsValue(key.Value)) hNew.Add(key.Key, key.Value);
        }

        if (hNew.Values.Count != htList.Values.Count)
        {
            messageContent.InnerHtml = GetLocalResourceObject("UpdateError2").ToString();
            return;
        }

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();

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

        HotelFacilitiesDBEntity hotelFacilitiesDBEntity = new HotelFacilitiesDBEntity();
        hotelFacilitiesDBEntity.FTSeqList = htList;
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelFacilitiesDBEntity);

        int iResult = HotelFacilitiesBP.FtTypeSeqListUpdate(_hotelfacilitiesEntity);
        _commonEntity.LogMessages = _hotelfacilitiesEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        commonDBEntity.Event_Type = "服务设施类别管理-排序修改";
        commonDBEntity.Event_ID = "";
        string conTent = "";
        conTent = GetLocalResourceObject("EventUpdateMessageSeq").ToString();
        //conTent = string.Format(conTent, txtFtCode.Value, txtFtName.Value, lbFtSeq.Text, ddpStatusList.SelectedValue);
        commonDBEntity.Event_Type = "";
        commonDBEntity.Event_ID = "";
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            messageContent.InnerHtml = GetLocalResourceObject("UpdateSuccessSeq").ToString();
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateSuccessSeq").ToString();
            BindFtListGrid();
        }
        else
        {
            messageContent.InnerHtml = GetLocalResourceObject("UpdateError").ToString();
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError").ToString();
        }

        foreach (System.Collections.DictionaryEntry key in htList)
        {
            conTent = string.Format(conTent, key.Key, key.Value);
            _commonEntity.CommonDBEntity.Add(commonDBEntity);
            CommonBP.InsertEventHistory(_commonEntity);
        }
    }
    private void BindAllFTList()
    {
        MessageContent.InnerHtml = "";
        _hotelfacilitiesEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _hotelfacilitiesEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _hotelfacilitiesEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _hotelfacilitiesEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();
        HotelFacilitiesDBEntity hotelFacilitiesDBEntity = new HotelFacilitiesDBEntity();
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelFacilitiesDBEntity);

        DataSet dsResult = HotelFacilitiesBP.ServiceAllFTSelect(_hotelfacilitiesEntity).QueryResult;

        string strTypeSeq = "";
        DataSet dsDDP = GetDataItem();
        Panel pl = new Panel();
        CheckBoxList chk1 = new CheckBoxList();

        for (int i = 0; i < dsResult.Tables[0].Rows.Count; i++)
        {
            if (!strTypeSeq.Equals(dsResult.Tables[0].Rows[i]["TYPESEQ"].ToString()))
            {
                if (!String.IsNullOrEmpty(strTypeSeq))
                {
                    chk1.DataTextField = "FACILITIESNM";
                    chk1.DataValueField = "FACILITIESCODE";
                    chk1.DataSource = dsDDP;
                    chk1.DataBind();
                    pl.Controls.Add(chk1);
                    dvChkList.Controls.Add(pl);
                }

                pl = new Panel();
                pl.GroupingText = dsResult.Tables[0].Rows[i]["TYPENAME"].ToString();
                pl.CssClass = "";
                pl.Style.Add("width", "100%");

                chk1 = new CheckBoxList();
                chk1.RepeatDirection = RepeatDirection.Vertical;
                chk1.RepeatColumns = 8;
                chk1.RepeatLayout = RepeatLayout.Table;
                chk1.CellSpacing = 10;

                dsDDP.Tables[0].Rows.Clear();
                strTypeSeq = dsResult.Tables[0].Rows[i]["TYPESEQ"].ToString();
            }

            DataRow dr = dsDDP.Tables[0].NewRow();
            dr["FACILITIESNM"] = dsResult.Tables[0].Rows[i]["FACILITIESNM"].ToString();
            dr["FACILITIESCODE"] = dsResult.Tables[0].Rows[i]["FACILITIESCODE"].ToString();
            dsDDP.Tables[0].Rows.Add(dr);
        }

        chk1.DataTextField = "FACILITIESNM";
        chk1.DataValueField = "FACILITIESCODE";
        chk1.DataSource = dsDDP;
        chk1.DataBind();
        pl.Controls.Add(chk1);
        dvChkList.Controls.Add(pl);
    }
    public void btnAddData()
    {
        MessageContent.InnerHtml = "";

        if (String.IsNullOrEmpty(hidHotelID.Value))
        {
            MessageContent.InnerHtml = GetLocalResourceObject("Error3").ToString();
            UpdatePanel4.Update();
            return;
        }

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

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();
        HotelFacilitiesDBEntity hotelFacilitiesDBEntity = new HotelFacilitiesDBEntity();

        ArrayList chkList = new ArrayList();

        string[] FTlist = hidFTList.Value.Split(',');

        foreach (string li in FTlist)
        {
            if (!String.IsNullOrEmpty(li))
            {
                chkList.Add(li + " ");
            }
        }

        //foreach (ListItem li in chkServiceList.Items)
        //{
        //    if (li.Selected)
        //    {
        //        chkList.Add(li.Value + " ");
        //    }
        //}

        //foreach (ListItem li in chkFacilitiesList.Items)
        //{
        //    if (li.Selected)
        //    {
        //        chkList.Add(li.Value + " ");
        //    }
        //}
        hotelFacilitiesDBEntity.AryFalLisT = chkList;
        hotelFacilitiesDBEntity.HotelID = hidHotelID.Value;

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelFacilitiesDBEntity);
        int iResult = HotelFacilitiesBP.HotelInsert(_hotelfacilitiesEntity);

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

        commonDBEntity.Event_Type = "酒店服务设施设置-添加";
        commonDBEntity.Event_ID = hidHotelID.Value;
        string conTent = GetLocalResourceObject("EventInsertMessage").ToString();

        string[] strDataFields = (string[])chkList.ToArray(typeof(string));
        string arlist = string.Concat(strDataFields);

        conTent = string.Format(conTent, hidHotelID.Value, lbHotelNM.Text, arlist);
        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 = GetLocalResourceObject("Error1").ToString();
            MessageContent.InnerHtml = GetLocalResourceObject("Error1").ToString();
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error2").ToString();
            MessageContent.InnerHtml = GetLocalResourceObject("Error2").ToString();
        }
        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);

        UpdatePanel4.Update();
    }
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        //((DropDownList)gridViewCSPaymentList.Rows[2].Cells[0].FindControl("ddlOnline")).SelectedValue

        detailMessageContent.InnerHtml = "";

        if (String.IsNullOrEmpty(txtFtName.Value.ToString().Trim()))
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("UpdateError1").ToString();
            return;
        }

        if (String.IsNullOrEmpty(txtFtCode.Value.ToString().Trim()))
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("UpdateError11").ToString();
            return;
        }

        //if (txtPaymentName.Value.ToString().Trim().Length > 12)
        //{
        //    detailMessageContent.InnerHtml = GetLocalResourceObject("UpdateError3").ToString();
        //    return;
        //}

        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();

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

        HotelFacilitiesDBEntity hotelFacilitiesDBEntity = new HotelFacilitiesDBEntity();
        hotelFacilitiesDBEntity.FTID = hidFtID.Value;
        hotelFacilitiesDBEntity.FTCode = txtFtCode.Value;
        hotelFacilitiesDBEntity.FTName = txtFtName.Value;
        hotelFacilitiesDBEntity.Status = ddpStatusList.SelectedValue;
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelFacilitiesDBEntity);

        int iResult = HotelFacilitiesBP.FtTypeUpdate(_hotelfacilitiesEntity);
        _commonEntity.LogMessages = _hotelfacilitiesEntity.LogMessages;
        _commonEntity.CommonDBEntity = new List<CommonDBEntity>();
        CommonDBEntity commonDBEntity = new CommonDBEntity();

        commonDBEntity.Event_Type = "服务设施类别管理-修改";
        commonDBEntity.Event_ID = hidFtID.Value;

        //detailMessageContent.InnerHtml = "支付方式更新成功!";
        string conTent = "";
        conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        conTent = string.Format(conTent, txtFtCode.Value, txtFtName.Value, lbFtSeq.Text, ddpStatusList.SelectedValue);
        commonDBEntity.Event_Type = "";
        commonDBEntity.Event_ID = "";
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            Response.Write("<script>window.returnValue=true;window.opener = null;window.close();</script>");
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateSuccess").ToString();
        }
        else if (iResult == 2)
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("UpdateError2").ToString();
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError2").ToString();
        }
        else
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("UpdateError").ToString();
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError").ToString();
        }

        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
    }
    ////发放渠道
    private void BindFtDetailListGrid(string FtID)
    {
        _hotelfacilitiesEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _hotelfacilitiesEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _hotelfacilitiesEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _hotelfacilitiesEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity = new List<HotelFacilitiesDBEntity>();
        HotelFacilitiesDBEntity hotelFacilitiesDBEntity = new HotelFacilitiesDBEntity();

        hotelFacilitiesDBEntity.FTID = FtID;
        _hotelfacilitiesEntity.HotelFacilitiesDBEntity.Add(hotelFacilitiesDBEntity);

        DataSet dsMainResult = HotelFacilitiesBP.FtDetailSelect(_hotelfacilitiesEntity).QueryResult;
        if (dsMainResult.Tables.Count > 0 && dsMainResult.Tables[0].Rows.Count > 0)
        {
            txtFtCode.Value = dsMainResult.Tables[0].Rows[0]["FtCode"].ToString();
            txtFtName.Value = dsMainResult.Tables[0].Rows[0]["FtName"].ToString();
            lbFtSeq.Text = dsMainResult.Tables[0].Rows[0]["FtSeq"].ToString();
            ddpStatusList.SelectedValue = dsMainResult.Tables[0].Rows[0]["FtStatus"].ToString();
        }
    }