//发放渠道
    public void BindInvoiceListGrid(string Type)
    {
        _invoiceEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _invoiceEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _invoiceEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _invoiceEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _invoiceEntity.InvoiceDBEntity = new List<InvoiceDBEntity>();
        InvoiceDBEntity invoiceDBEntity = new InvoiceDBEntity();

        //invoiceDBEntity.CityID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["CityID"].ToString())) ? null : ViewState["CityID"].ToString();

        invoiceDBEntity.USERID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["USERID"].ToString())) ? null : ViewState["USERID"].ToString();
        invoiceDBEntity.CNFNUM = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["CNFNUM"].ToString())) ? null : ViewState["CNFNUM"].ToString();
        invoiceDBEntity.SENDCODE = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["SENDCODE"].ToString())) ? null : ViewState["SENDCODE"].ToString();
        invoiceDBEntity.Status = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["INVSTATUS"].ToString())) ? null : ViewState["INVSTATUS"].ToString();
        invoiceDBEntity.APPLYCHANEL = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["APPLYCHANEL"].ToString())) ? null : ViewState["APPLYCHANEL"].ToString();

        invoiceDBEntity.APPLYBEGINDATE = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["APPLYBEGINDATE"].ToString())) ? null : ViewState["APPLYBEGINDATE"].ToString();
        invoiceDBEntity.APPLYENDDATE = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["APPLYENDDATE"].ToString())) ? null : ViewState["APPLYENDDATE"].ToString();
        invoiceDBEntity.SENDBEGINDATE = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["SENDBEGINDATE"].ToString())) ? null : ViewState["SENDBEGINDATE"].ToString();
        invoiceDBEntity.SENDENDDATE = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["SENDENDDATE"].ToString())) ? null : ViewState["SENDENDDATE"].ToString();
        invoiceDBEntity.SelectType = Type;
        _invoiceEntity.InvoiceDBEntity.Add(invoiceDBEntity);

        DataSet dsResult = InvoiceBP.InvoiceListSelect(_invoiceEntity).QueryResult;

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

        if (!String.IsNullOrEmpty(refushFlag.Value))
        {
            messageContent.InnerHtml = GetLocalResourceObject("UpdateSuccess").ToString();
            refushFlag.Value = "";
        }
    }
    //发放渠道
    public void BindInvoiceDetail()
    {
        _invoiceEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _invoiceEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _invoiceEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _invoiceEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _invoiceEntity.InvoiceDBEntity = new List<InvoiceDBEntity>();
        InvoiceDBEntity invoiceDBEntity = new InvoiceDBEntity();

        invoiceDBEntity.InvoiceID = hidInvoiceID.Value;
        _invoiceEntity.InvoiceDBEntity.Add(invoiceDBEntity);

        DataSet dsMainResult = InvoiceBP.InvoiceDetailSelect(_invoiceEntity).QueryResult;

        if (dsMainResult.Tables.Count > 0 && dsMainResult.Tables[0].Rows.Count > 0)
        {
            lbCNFNUM.Text = dsMainResult.Tables[0].Rows[0]["CNFNUM"].ToString();
            lbStatus.Text = dsMainResult.Tables[0].Rows[0]["ONLINEDIS"].ToString();
            lbUSERID.Text = dsMainResult.Tables[0].Rows[0]["USERID"].ToString();
            lbCONTRACTTEL.Text = dsMainResult.Tables[0].Rows[0]["CONTRACTTEL"].ToString();
            lbAPPLYCHANEL.Text = dsMainResult.Tables[0].Rows[0]["APPLYCHANELNM"].ToString();
            lbAPPLYTIME.Text = dsMainResult.Tables[0].Rows[0]["APPLYTIME"].ToString();
            lbRECEIVERNAME.Text = dsMainResult.Tables[0].Rows[0]["RECEIVERNAME"].ToString();
            lbINVOICEHEAD.Text = dsMainResult.Tables[0].Rows[0]["INVOICEHEAD"].ToString();
            lbINVOICEADDR.Text = dsMainResult.Tables[0].Rows[0]["INVOICEADDR"].ToString();
            lbSENDTIME.Text = dsMainResult.Tables[0].Rows[0]["SENDTIME"].ToString();
            lbZIPCODE.Text = dsMainResult.Tables[0].Rows[0]["ZIPCODE"].ToString();
            lbINVOICEAMOUNT.Text = dsMainResult.Tables[0].Rows[0]["INVOICEAMOUNT"].ToString();
            lbSENDNAME.Text = dsMainResult.Tables[0].Rows[0]["SENDNAME"].ToString();
            lbSENDCODE.Text = dsMainResult.Tables[0].Rows[0]["SENDCODE"].ToString();
            lbINVOICENUM.Text = dsMainResult.Tables[0].Rows[0]["INVOICENUM"].ToString();
            lbOPERATOR.Text = dsMainResult.Tables[0].Rows[0]["OPERATOR"].ToString();
            hidOnlineStatus.Value = dsMainResult.Tables[0].Rows[0]["ONLINESTATUS"].ToString();
            lbINVOICEBODY.Text = dsMainResult.Tables[0].Rows[0]["INVOICEBODY"].ToString();
            txtOPERATORMEMO.Text = dsMainResult.Tables[0].Rows[0]["OPERATORMEMO"].ToString();

            if ("1".Equals(hidOnlineStatus.Value))
            {
                txtINVOICENUM.Visible = true;
                btnBack.Visible = false;
            }
            else if ("2".Equals(hidOnlineStatus.Value))
            {
                txtSENDCODE.Visible = true;
                txtSENDNAME.Visible = true;
            }
            else if ("3".Equals(hidOnlineStatus.Value))
            {
                btnBack.Visible = true;
                btnUpdate.Visible = false;
            }
            else
            {
                btnBack.Visible = false;
                btnUpdate.Visible = false;
            }
        }
        else
        {
            detailMessageContent.InnerHtml = GetLocalResourceObject("WarningMessage").ToString();
        }
    }
    protected void btnExport_Click(object sender, EventArgs e)
    {
        messageContent.InnerHtml = "";
        _invoiceEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _invoiceEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _invoiceEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _invoiceEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _invoiceEntity.InvoiceDBEntity = new List<InvoiceDBEntity>();
        InvoiceDBEntity invoiceDBEntity = new InvoiceDBEntity();

        //invoiceDBEntity.CityID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["CityID"].ToString())) ? null : ViewState["CityID"].ToString();

        invoiceDBEntity.USERID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["USERID"].ToString())) ? null : ViewState["USERID"].ToString();
        invoiceDBEntity.CNFNUM = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["CNFNUM"].ToString())) ? null : ViewState["CNFNUM"].ToString();
        invoiceDBEntity.SENDCODE = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["SENDCODE"].ToString())) ? null : ViewState["SENDCODE"].ToString();
        invoiceDBEntity.Status = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["INVSTATUS"].ToString())) ? null : ViewState["INVSTATUS"].ToString();
        invoiceDBEntity.APPLYCHANEL = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["APPLYCHANEL"].ToString())) ? null : ViewState["APPLYCHANEL"].ToString();

        invoiceDBEntity.APPLYBEGINDATE = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["APPLYBEGINDATE"].ToString())) ? null : ViewState["APPLYBEGINDATE"].ToString();
        invoiceDBEntity.APPLYENDDATE = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["APPLYENDDATE"].ToString())) ? null : ViewState["APPLYENDDATE"].ToString();
        invoiceDBEntity.SENDBEGINDATE = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["SENDBEGINDATE"].ToString())) ? null : ViewState["SENDBEGINDATE"].ToString();
        invoiceDBEntity.SENDENDDATE = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["SENDENDDATE"].ToString())) ? null : ViewState["SENDENDDATE"].ToString();
        invoiceDBEntity.SelectType = hidType.Value;
        _invoiceEntity.InvoiceDBEntity.Add(invoiceDBEntity);

        DataSet dsResult = InvoiceBP.InvoiceListExcelSelect(_invoiceEntity).QueryResult;

        if (dsResult.Tables.Count == 0 && dsResult.Tables[0].Rows.Count == 0)
        {
            return;
        }
        CommonFunction.ExportExcelForLM(dsResult);
    }
    private void SaveAction(string ActionType)
    {
        _invoiceEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _invoiceEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _invoiceEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _invoiceEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _invoiceEntity.InvoiceDBEntity = new List<InvoiceDBEntity>();
        InvoiceDBEntity invoiceDBEntity = new InvoiceDBEntity();
        invoiceDBEntity.InvoiceID = hidInvoiceID.Value;
        invoiceDBEntity.INVOICENUM = txtINVOICENUM.Value.Trim();
        invoiceDBEntity.SENDCODE = txtSENDCODE.Value.Trim();
        invoiceDBEntity.SENDNAME = txtSENDNAME.Value.Trim();
        invoiceDBEntity.OnlineStatus = hidOnlineStatus.Value;
        invoiceDBEntity.Remark = txtOPERATORMEMO.Text;
        invoiceDBEntity.ActionType = ActionType;

        _invoiceEntity.InvoiceDBEntity.Add(invoiceDBEntity);
        int iResult = InvoiceBP.InvoiceUpdate(_invoiceEntity);

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

        commonDBEntity.Event_Type = "发票管理-保存";
        commonDBEntity.Event_ID = hidInvoiceID.Value;

        string conTent = GetLocalResourceObject("EventUpdateMessage").ToString();
        conTent = string.Format(conTent, invoiceDBEntity.InvoiceID, (String.IsNullOrEmpty(txtINVOICENUM.Value.ToString().Trim()) ? lbINVOICENUM.Text : txtINVOICENUM.Value.ToString().Trim()), (String.IsNullOrEmpty(txtSENDNAME.Value.ToString().Trim()) ? lbSENDNAME.Text : txtSENDNAME.Value.ToString().Trim()), (String.IsNullOrEmpty(txtSENDCODE.Value.ToString().Trim()) ? lbSENDCODE.Text : txtSENDCODE.Value.ToString().Trim()));
        commonDBEntity.Event_Content = conTent;

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

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