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

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

        _platformEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _platformEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _platformEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _platformEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _platformEntity.PlatformDBEntity = new List<PlatformDBEntity>();
        PlatformDBEntity platformDBEntity = new PlatformDBEntity();
        platformDBEntity.Name_CN = txtPlatformName.Value;
        platformDBEntity.PlatformID = txtPlatformID.Value;
        _platformEntity.PlatformDBEntity.Add(platformDBEntity);
        int iResult = PlatformBP.Insert(_platformEntity);

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

        commonDBEntity.Event_Type = "应用平台管理-添加";
        commonDBEntity.Event_ID = txtPlatformID.Value;
        string conTent = GetLocalResourceObject("EventInsertMessage").ToString();
        conTent = string.Format(conTent, txtPlatformID.Value, txtPlatformName.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 btnUpdatePlatform(string platformNo, string platformID, string nameCN, string onlineStatus)
    {
        messageContent.InnerHtml = "";

        _platformEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _platformEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _platformEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _platformEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _platformEntity.PlatformDBEntity = new List<PlatformDBEntity>();
        PlatformDBEntity platformDBEntity = new PlatformDBEntity();
        platformDBEntity.PlatformNo = platformNo;
        platformDBEntity.PlatformID = platformID;
        platformDBEntity.Name_CN = nameCN;
        platformDBEntity.OnlineStatus = onlineStatus;
        _platformEntity.PlatformDBEntity.Add(platformDBEntity);
        int iResult = PlatformBP.Update(_platformEntity);

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

        commonDBEntity.Event_Type = "应用平台管理-修改";
        commonDBEntity.Event_ID = platformID;

        string conTent = GetLocalResourceObject("EventUpdateMessage").ToString();
        conTent = string.Format(conTent, platformDBEntity.PlatformID, platformDBEntity.Name_CN, platformDBEntity.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 BindPlatformListGrid()
    {
        _platformEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _platformEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _platformEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _platformEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _platformEntity.PlatformDBEntity = new List<PlatformDBEntity>();
        PlatformDBEntity platformDBEntity = new PlatformDBEntity();

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

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

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

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

        _platformEntity.PlatformDBEntity.Add(platformDBEntity);

        DataSet dsResult = PlatformBP.Select(_platformEntity).QueryResult;

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

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