public void btnAddRegChannel()
    {
        messageContent.InnerHtml = "";

        if (String.IsNullOrEmpty(txtRegChannelName.Value.ToString().Trim()) || String.IsNullOrEmpty(txtRegChannelID.Value.ToString().Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error3").ToString();
            return;
        }

        _regChannelEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _regChannelEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _regChannelEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _regChannelEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _regChannelEntity.RegChannelDBEntity = new List<RegChannelDBEntity>();
        RegChannelDBEntity regChannelDBEntity = new RegChannelDBEntity();
        regChannelDBEntity.Name_CN = txtRegChannelName.Value;
        regChannelDBEntity.RegChannelID = txtRegChannelID.Value;
        _regChannelEntity.RegChannelDBEntity.Add(regChannelDBEntity);
        int iResult = RegChannelBP.Insert(_regChannelEntity);

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

        commonDBEntity.Event_Type = "注册渠道管理-添加";
        commonDBEntity.Event_ID = txtRegChannelID.Value;

        string conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        conTent = string.Format(conTent, txtRegChannelID.Value, txtRegChannelName.Value);
        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 bool btnUpdateRegChannel(string regChannelNo, string regChannelID, string nameCN, string onlineStatus)
    {
        messageContent.InnerHtml = "";

        _regChannelEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _regChannelEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _regChannelEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _regChannelEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _regChannelEntity.RegChannelDBEntity = new List<RegChannelDBEntity>();
        RegChannelDBEntity regChannelDBEntity = new RegChannelDBEntity();
        regChannelDBEntity.RegChannelNo = regChannelNo;
        regChannelDBEntity.RegChannelID = regChannelID;
        regChannelDBEntity.Name_CN = nameCN;
        regChannelDBEntity.OnlineStatus = onlineStatus;
        _regChannelEntity.RegChannelDBEntity.Add(regChannelDBEntity);
        int iResult = RegChannelBP.Update(_regChannelEntity);

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

        commonDBEntity.Event_Type = "注册渠道管理-修改";
        commonDBEntity.Event_ID = regChannelID;

        string conTent = GetLocalResourceObject("EventUpdateMessage").ToString();
        conTent = string.Format(conTent, regChannelDBEntity.RegChannelID, regChannelDBEntity.Name_CN, regChannelDBEntity.OnlineStatus);
        commonDBEntity.Event_Content = conTent;
        bool returnValue = true;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateSuccess").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("UpdateSuccess").ToString();
        }
        else if (iResult == 2)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError2").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("UpdateError2").ToString();
            returnValue = false;
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("UpdateError").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("UpdateError").ToString();
            returnValue = false;
        }

        _commonEntity.CommonDBEntity.Add(commonDBEntity);
        CommonBP.InsertEventHistory(_commonEntity);
        return returnValue;
    }
    //发放渠道
    private void BindRegChanelListGrid()
    {
        _regChannelEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _regChannelEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _regChannelEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _regChannelEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _regChannelEntity.RegChannelDBEntity = new List<RegChannelDBEntity>();
        RegChannelDBEntity regChannelDBEntity = new RegChannelDBEntity();

        regChannelDBEntity.Name_CN = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Name_CN"].ToString())) ? null : ViewState["Name_CN"].ToString();
        regChannelDBEntity.OnlineStatus = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OnlineStatus"].ToString())) ? null : ViewState["OnlineStatus"].ToString();
        regChannelDBEntity.StartDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["StartDTime"].ToString())) ? null : ViewState["StartDTime"].ToString();
        regChannelDBEntity.EndDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["EndDTime"].ToString())) ? null : ViewState["EndDTime"].ToString();

        //regChannelDBEntity.Name_CN = txtSelRegChannelName.Value;

        ////if (chkAll.Checked)
        ////{
        ////    regChannelDBEntity.OnlineStatus = null;
        ////}
        ////else if (chkOnL.Checked && chkOff.Checked)
        ////{
        ////    regChannelDBEntity.OnlineStatus = null;
        ////}
        ////else if (chkOff.Checked)
        ////{
        ////    regChannelDBEntity.OnlineStatus = "0";
        ////}
        ////else if (chkOnL.Checked)
        ////{
        ////    regChannelDBEntity.OnlineStatus = "1";
        ////}
        ////else
        ////{
        ////    regChannelDBEntity.OnlineStatus = null;
        ////}

        //if (rdbAll.Checked)
        //{
        //    regChannelDBEntity.OnlineStatus = null;
        //}
        //else if (rdbOnL.Checked)
        //{
        //    regChannelDBEntity.OnlineStatus = "1";
        //}
        //else if (rdbOff.Checked)
        //{
        //    regChannelDBEntity.OnlineStatus = "0";
        //}
        //else
        //{
        //    regChannelDBEntity.OnlineStatus = null;
        //}

        //if (chkUnTime.Checked)
        //{
        //    regChannelDBEntity.StartDTime = null;
        //    regChannelDBEntity.EndDTime = null;
        //}
        //else
        //{
        //    regChannelDBEntity.StartDTime = dpStart.Value;
        //    regChannelDBEntity.EndDTime = dpEnd.Value;
        //}

        _regChannelEntity.RegChannelDBEntity.Add(regChannelDBEntity);

        DataSet dsResult = RegChannelBP.Select(_regChannelEntity).QueryResult;

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

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