protected void btnExport_Click(object sender, EventArgs e)
 {
     messageContent.InnerHtml = "";
     _pushEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
     _pushEntity.LogMessages.Userid = UserSession.Current.UserAccount;
     _pushEntity.LogMessages.Username = UserSession.Current.UserDspName;
     _pushEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
     _pushEntity.PushDBEntity = new List<PushDBEntity>();
     PushDBEntity pushEntity = new PushDBEntity();
     pushEntity.ID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["TaskID"].ToString())) ? null : ViewState["TaskID"].ToString();
     pushEntity.TelPhone = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["TelPhone"].ToString())) ? null : ViewState["TelPhone"].ToString();
     _pushEntity.PushDBEntity.Add(pushEntity);
     DataSet dsResult = PushBP.ExportPushActionHistoryList(_pushEntity).QueryResult;
     CommonFunction.ExportExcelForLM(dsResult);
 }
    protected void btnRefush_Click(object sender, EventArgs e)
    {
        _pushEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _pushEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _pushEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _pushEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _pushEntity.PushDBEntity = new List<PushDBEntity>();
        PushDBEntity pushEntity = new PushDBEntity();
        pushEntity.ID = hidTaskID.Value.Trim();
        _pushEntity.PushDBEntity.Add(pushEntity);
        DataSet dsResult = PushBP.SelectPushInfoSuccCount(_pushEntity).QueryResult;

        decimal decPushSucNum = 0;
        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0 && !String.IsNullOrEmpty(dsResult.Tables[0].Rows[0]["Suc_Count"].ToString()))
        {
            decPushSucNum = decimal.Parse(dsResult.Tables[0].Rows[0]["Suc_Count"].ToString().Trim());
        }
        decimal decPushAllNum = String.IsNullOrEmpty(lbPushAllNum.Text) ? 0 : decimal.Parse(lbPushAllNum.Text);

        string strStatus = dsResult.Tables[0].Rows[0]["Status"].ToString();
        //if (decPushSucNum < decPushAllNum)
        if (!"3".Equals(strStatus))
        {
            hidMsg.Value = "Push发送中..." + decPushSucNum.ToString() + "/" + lbPushAllNum.Text;
            //lblRemainSecond.Text = "5";
            hidRemainSecond.Value = (ConfigurationManager.AppSettings["PushRemainSecond"] != null) ? ConfigurationManager.AppSettings["PushRemainSecond"].ToString() : "20";
            //this.Page.RegisterStartupScript("remaintimebtn0", "<script>setInterval('RemainTimeBtn()',1000);</script>"); //执行定时执行
        }
        else
        {
            //hidMsg.Value = "数据加载中,请稍等...";
            //hidRemainSecond.Value = "0";
            //this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
            //UpdatePanel2.Update();
            //BindReviewLmListGrid();
            Response.Redirect(Request.Url.ToString());
        }
    }
    private string GetPushAllCount()
    {
        PushEntity pushEntityMaster = new PushEntity();
        pushEntityMaster.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        pushEntityMaster.LogMessages.Userid = UserSession.Current.UserAccount;
        pushEntityMaster.LogMessages.Username = UserSession.Current.UserDspName;
        pushEntityMaster.LogMessages.IpAddress = UserSession.Current.UserIP;

        pushEntityMaster.PushDBEntity = new List<PushDBEntity>();
        PushDBEntity pushEntity = new PushDBEntity();
        pushEntity.Type = hidPushType.Value.Trim();
        pushEntity.UserGroupList = hidUserGroupList.Value.Trim();
        pushEntityMaster.PushDBEntity.Add(pushEntity);

        if ("0".Equals(hidPushType.Value))
        {
            pushEntityMaster = PushBP.SelectPushInfoAllUsersCount(pushEntityMaster);
            if (pushEntityMaster.QueryResult.Tables.Count > 0 && pushEntityMaster.QueryResult.Tables[0].Rows.Count > 0)
            {
                return pushEntityMaster.QueryResult.Tables[0].Rows[0][0].ToString();
            }
            else
            {
                return "0";
            }
        }
        else if ("1".Equals(hidPushType.Value))
        {
            pushEntityMaster = PushBP.SelectPushInfoUserGroupCount(pushEntityMaster);
            if (pushEntityMaster.QueryResult.Tables.Count > 0 && pushEntityMaster.QueryResult.Tables[0].Rows.Count > 0)
            {
                return pushEntityMaster.QueryResult.Tables[0].Rows[0][0].ToString();
            }
            else
            {
                return "0";
            }
        }
        else
        {
            return _iAllCount.ToString();
        }
    }
    protected void btnSend_Click(object sender, EventArgs e)
    {
        //getFileData();
        //BindReviewLmListGrid();
        //this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnLoadStyle();", true);

        //System.Diagnostics.Process process = new System.Diagnostics.Process();
        //try
        //{
        //    process.StartInfo.FileName = @"D:\TFS\HotelVPBackend\CMS\01SRC\JobConsole\HotelVp.JobConsole.DailyOrderSum_Top\HotelVp.JobConsole.DailyOrderSumTop\bin\Debug\HotelVp.JobConsole.DailyOrderSumTop.exe";//文件名必须加后缀。
        //    process.StartInfo.Arguments = "1";
        //    process.Start();
        //}
        //catch (Exception exU)
        //{
        //    //exU.Message
        //}
        //finally
        //{
        //    if (!process.HasExited)
        //    {
        //        process.Close();
        //        process.Dispose();
        //    }
        //}
        //lblRemainSecond.Text = "5";

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

        _pushEntity.PushDBEntity = new List<PushDBEntity>();
        PushDBEntity pushEntity = new PushDBEntity();
        pushEntity.ID = hidTaskID.Value.Trim();
        pushEntity.Status = "1";
        _pushEntity.PushDBEntity.Add(pushEntity);
        _pushEntity = PushBP.SendPushInfoMsg(_pushEntity);
        int iResult = _pushEntity.Result;

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

        commonDBEntity.Event_Type = "发送Push信息-发送";
        commonDBEntity.Event_ID = txtPushTitle.Text.Trim();
        string conTent = GetLocalResourceObject("EventSendMessage").ToString();

        string strParams = string.Empty;
        if ("1".Equals(hidPushType.Value))
        {
            strParams = hidUserGroupList.Value.Trim();
        }
        else if ("2".Equals(hidPushType.Value))
        {
            strParams = _strPushProtoType.Trim();
        }
        conTent = string.Format(conTent, hidTaskID.Value, txtPushTitle.Text.Trim(), txtPushContent.Text.Trim(), hidPushType.Value.Trim(), strParams, hidPushActype.Value.Trim());
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            //hidTaskID.Value = _pushEntity.PushDBEntity[0].ID;
            commonDBEntity.Event_Result = GetLocalResourceObject("SendSuccess").ToString();
            //messageContent.InnerHtml = GetLocalResourceObject("SendSuccess").ToString();
            _commonEntity.CommonDBEntity.Add(commonDBEntity);
            CommonBP.InsertEventHistory(_commonEntity);
            //BindReviewLmListGrid();
            //this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvHidChangeEvent();", true);
        }
        else if (iResult == 2)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error9").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("Error9").ToString();
            _commonEntity.CommonDBEntity.Add(commonDBEntity);
            CommonBP.InsertEventHistory(_commonEntity);

            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvHidChangeEvent();", true);
            return;
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error10").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("Error10").ToString();
            _commonEntity.CommonDBEntity.Add(commonDBEntity);
            CommonBP.InsertEventHistory(_commonEntity);

            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvHidChangeEvent();", true);
            return;
        }

        hidMsg.Value = String.Format(GetLocalResourceObject("PushMsg").ToString(), lbPushAllNum.Text); //"Push发送中...0/100";
        hidRemainSecond.Value = (ConfigurationManager.AppSettings["PushRemainSecond"] != null) ? ConfigurationManager.AppSettings["PushRemainSecond"].ToString() : "20";
        this.Page.RegisterStartupScript("remaintimebtn0", "<script>DvHidChangeEvent();setInterval('RemainTimeBtn()',1000);</script>"); //执行定时执行
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        messageContent.InnerHtml = "";

        if (String.IsNullOrEmpty(txtPushTitle.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error1").ToString(); //"Push任务标题不能为空,请确认!";
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvShChangeEvent();", true);
            return;
        }

        if (String.IsNullOrEmpty(txtPushContent.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error2").ToString(); //"Push信息正文不能为空,请确认!";
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvShChangeEvent();", true);
            return;
        }

        if (StringUtility.Text_Length(txtPushContent.Text.Trim()) > 135)
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error6").ToString(); //"Push信息正文限制输入50个中文字符,请确认!";
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvShChangeEvent();", true);
            return;
        }

        if ("1".Equals(hidPushActype.Value.Trim()) && (StringUtility.Text_Length(txtPushContent.Text.Trim()) + StringUtility.Text_Length(txtPushTitle.Text.Trim())) > 135)
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error11").ToString(); //"Push信息正文限制输入50个中文字符,请确认!";
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvShChangeEvent();", true);
            return;
        }
        else if ("2".Equals(hidPushActype.Value.Trim()) && (StringUtility.Text_Length(txtPushContent.Text.Trim()) + StringUtility.Text_Length(txtPushTitle.Text.Trim()) + StringUtility.Text_Length(txtWapUrl.Text.Trim())) > 135)
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error11").ToString(); //"Push信息正文限制输入50个中文字符,请确认!";
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvShChangeEvent();", true);
            return;
        }
        else if ("8".Equals(hidPushActype.Value.Trim()) && (StringUtility.Text_Length(txtPushContent.Text.Trim()) + StringUtility.Text_Length(txtPushTitle.Text.Trim()) + StringUtility.Text_Length(txtPackageCode.Text.Trim())) > 135)
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error11").ToString(); //"Push信息正文限制输入50个中文字符,请确认!";
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvShChangeEvent();", true);
            return;
        }

        if ("2".Equals(hidPushActype.Value.Trim()) && String.IsNullOrEmpty(txtWapUrl.Text.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error12").ToString();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvShChangeEvent();", true);
            return;
        }

        if ("1".Equals(hidPushType.Value.Trim()) && String.IsNullOrEmpty(hidUserGroupList.Value.Trim()))
        {
            messageContent.InnerHtml = GetLocalResourceObject("Error3").ToString(); //"指定用户组不能为空,请确认!";
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvShChangeEvent();", true);
            return;
        }
        else if ("2".Equals(hidPushType.Value.Trim()))
        {
            string strResult = getFileData();
            if (!String.IsNullOrEmpty(strResult))
            {
                messageContent.InnerHtml = strResult;
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvShChangeEvent();", true);
                return;
            }
        }

        if ("8".Equals(hidPushActype.Value.Trim()))
        {
            if (String.IsNullOrEmpty(txtPackageCode.Text.Trim()))
            {
                messageContent.InnerHtml = GetLocalResourceObject("Error13").ToString(); ;
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvShChangeEvent();", true);
                return;
            }
        }

        lbPushTitle.Text = txtPushTitle.Text;
        txtRePushContent.Text = txtPushContent.Text;

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

        _pushEntity.PushDBEntity = new List<PushDBEntity>();
        PushDBEntity pushEntity = new PushDBEntity();
        pushEntity.ID = hidTaskID.Value.Trim();
        pushEntity.PushType = hidPushActype.Value.Trim();
        pushEntity.WapUrl = ("2".Equals(hidPushActype.Value)) ? txtWapUrl.Text.Trim() : "";
        pushEntity.Title = txtPushTitle.Text.Trim();
        pushEntity.Content = txtPushContent.Text.Trim();
        pushEntity.Type = hidPushType.Value.Trim();
        pushEntity.UserGroupList = hidUserGroupList.Value.Trim();
        _strPushProtoType = ("2".Equals(hidPushType.Value)) ? _strPushProtoType : hidUserGroupList.Value.Trim();
        pushEntity.PushProtoType = _strPushProtoType;
        pushEntity.FilePath = _strFilePath.Trim();
        pushEntity.AllCount = GetPushAllCount();
        lbPushAllNum.Text = pushEntity.AllCount;

        pushEntity.TicketPackage = ("8".Equals(hidPushActype.Value)) ? txtPackageCode.Text.Trim() : "";
        pushEntity.TicketAmount = ("8".Equals(hidPushActype.Value)) ? hidTicketAmount.Value.Trim() : "";

        _pushEntity.PushDBEntity.Add(pushEntity);

        if (String.IsNullOrEmpty(hidTaskID.Value.Trim()))
        {
            _pushEntity = PushBP.PushInsert(_pushEntity);
        }
        else
        {
            _pushEntity = PushBP.PushUpdate(_pushEntity);
        }

        int iResult = _pushEntity.Result;

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

        commonDBEntity.Event_Type = "发送Push信息-保存";
        commonDBEntity.Event_ID = txtPushTitle.Text.Trim();
        string conTent = GetLocalResourceObject("EventInsertMessage").ToString();

        string strParams = string.Empty;
        if ("1".Equals(hidPushType.Value))
        {
            strParams = hidUserGroupList.Value.Trim();
        }
        else if ("2".Equals(hidPushType.Value))
        {
            strParams = _strPushProtoType.Trim();
        }
        conTent = string.Format(conTent, txtPushTitle.Text.Trim(), txtPushContent.Text.Trim(), hidPushType.Value.Trim(), strParams, hidPushActype.Value.Trim());
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            hidTaskID.Value = _pushEntity.PushDBEntity[0].ID;
            commonDBEntity.Event_Result = GetLocalResourceObject("InsertSuccess").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("InsertSuccess").ToString();
            _commonEntity.CommonDBEntity.Add(commonDBEntity);
            CommonBP.InsertEventHistory(_commonEntity);
            BindReviewLmListGrid();
            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DoSaveEvent();", true);
        }
        else if (iResult == 2)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error8").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("Error8").ToString();
            _commonEntity.CommonDBEntity.Add(commonDBEntity);
            CommonBP.InsertEventHistory(_commonEntity);

            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DoSaveEvent();", true);
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error7").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("Error7").ToString();
            _commonEntity.CommonDBEntity.Add(commonDBEntity);
            CommonBP.InsertEventHistory(_commonEntity);

            this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "DvShChangeEvent();", true);
        }

        //UpdatePanel1.Update();
        //UpdatePanel4.Update();
    }
    private string GetPushActionDateTime()
    {
        //messageContent.InnerHtml = "";

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

        _pushEntity.PushDBEntity = new List<PushDBEntity>();
        PushDBEntity pushEntity = new PushDBEntity();
        pushEntity.ID = hidTaskID.Value.Trim();
        _pushEntity.PushDBEntity.Add(pushEntity);
        DataSet dsResult = PushBP.SelectActionDateTime(_pushEntity).QueryResult;

        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
        {
            return dsResult.Tables[0].Rows[0]["FACTIONDT"].ToString() + " -- " + dsResult.Tables[0].Rows[0]["LACTIONDT"].ToString();
        }
        else
        {
            return "";
        }
    }
    private void BindReviewMainInfo()
    {
        //messageContent.InnerHtml = "";

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

        _pushEntity.PushDBEntity = new List<PushDBEntity>();
        PushDBEntity pushEntity = new PushDBEntity();
        pushEntity.ID = hidTaskID.Value.Trim();
        _pushEntity.PushDBEntity.Add(pushEntity);
        DataSet dsResult = PushBP.SelectPushSuccCount(_pushEntity).QueryResult;

        if (dsResult.Tables.Count > 0 && dsResult.Tables[0].Rows.Count > 0)
        {
            txtPushTitle.Text = dsResult.Tables[0].Rows[0]["Push_Title"].ToString();
            txtPushContent.Text = dsResult.Tables[0].Rows[0]["Push_Content"].ToString();
            hidPushType.Value = dsResult.Tables[0].Rows[0]["Type"].ToString();
            string strType = dsResult.Tables[0].Rows[0]["Type"].ToString();

            if ("0".Equals(strType))
            {
                lbPushUsers.Text = "所有有效用户";
            }
            else if ("1".Equals(strType))
            {
                lbPushUsers.Text = "用户组: ";
            }
            else if ("2".Equals(strType))
            {
                lbPushUsers.Text = "上传Excel列表: ";
            }

            string strStatus = string.Empty;
            switch (dsResult.Tables[0].Rows[0]["Status"].ToString())
            {
                case "0":
                    strStatus = "已保存,未发送";
                    btnSend.Visible = true;
                    break;
                case "1":
                    strStatus = "待发送";
                    btnSend.Visible = false;
                    break;
                case "2":
                    strStatus = "发送中";
                    btnSend.Visible = false;
                    break;
                case "3":
                    strStatus = "已完成";
                    btnSend.Visible = false;
                    break;
                default:
                    strStatus = "";
                    break;
            }

            lbPustStatus.Text = strStatus;
            lbPushUsers.Text = lbPushUsers.Text + dsResult.Tables[0].Rows[0]["Push_ProtoType"].ToString().Trim(',').Trim();
            lbPushAction.Text = GetPushActionDateTime();

            decimal decAllCount = (String.IsNullOrEmpty(dsResult.Tables[0].Rows[0]["All_Count"].ToString())) ? 0 : decimal.Parse(dsResult.Tables[0].Rows[0]["All_Count"].ToString());
            decimal Suc_Count = (String.IsNullOrEmpty(dsResult.Tables[0].Rows[0]["Suc_Count"].ToString())) ? 0 : decimal.Parse(dsResult.Tables[0].Rows[0]["Suc_Count"].ToString());
            decimal Err_Count = ("2".Equals(dsResult.Tables[0].Rows[0]["Status"].ToString()) || "3".Equals(dsResult.Tables[0].Rows[0]["Status"].ToString())) ? decAllCount - Suc_Count : 0;
            hidPushAllNum.Value = decAllCount.ToString();
            lbPushCount.Text = "DeviceToken总数:" + dsResult.Tables[0].Rows[0]["All_Count"].ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;成功发送:" + dsResult.Tables[0].Rows[0]["Suc_Count"].ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;发送失败:" + Err_Count.ToString();
        }
        else
        {
            messageContent.InnerHtml = GetLocalResourceObject("WarningMessage").ToString();
            btnExport.Visible = false;
            btnSearch.Visible = false;
            btnSend.Visible = false;
        }
    }
    //private int CountLmSystemLog()
    //{
    //    _pushEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
    //    _pushEntity.LogMessages.Userid = UserSession.Current.UserAccount;
    //    _pushEntity.LogMessages.Username = UserSession.Current.UserDspName;
    //    _pushEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
    //    _pushEntity.FogOrderID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OrderID"].ToString())) ? null : ViewState["OrderID"].ToString();
    //    _pushEntity.StartDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["StartDTime"].ToString())) ? null : ViewState["StartDTime"].ToString();
    //    _pushEntity.EndDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["EndDTime"].ToString())) ? null : ViewState["EndDTime"].ToString();
    //    _pushEntity.HotelID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HotelID"].ToString())) ? null : ViewState["HotelID"].ToString();
    //    _pushEntity.CityID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["CityID"].ToString())) ? null : ViewState["CityID"].ToString();
    //    _pushEntity.PayCode = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["PayCode"].ToString())) ? null : ViewState["PayCode"].ToString();
    //    _pushEntity.BookStatus = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["BookStatus"].ToString())) ? null : ViewState["BookStatus"].ToString();
    //    _pushEntity.PayStatus = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["PayStatus"].ToString())) ? null : ViewState["PayStatus"].ToString();
    //    _pushEntity.Aprove = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Aprove"].ToString())) ? null : ViewState["Aprove"].ToString();
    //    _pushEntity.HotelComfirm = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["HotelComfirm"].ToString())) ? null : ViewState["HotelComfirm"].ToString();
    //    _pushEntity.Ticket = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Ticket"].ToString())) ? null : ViewState["Ticket"].ToString();
    //    _pushEntity.Mobile = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Mobile"].ToString())) ? null : ViewState["Mobile"].ToString();
    //    _pushEntity.InStart = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["InStart"].ToString())) ? null : ViewState["InStart"].ToString();
    //    _pushEntity.InEnd = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["InEnd"].ToString())) ? null : ViewState["InEnd"].ToString();
    //    _pushEntity.PlatForm = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["PlatForm"].ToString())) ? null : ViewState["PlatForm"].ToString();
    //    _pushEntity.Sales = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["Sales"].ToString())) ? null : ViewState["Sales"].ToString();
    //    _pushEntity.OutTest = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["OutTest"].ToString())) ? null : ViewState["OutTest"].ToString();
    //    _pushEntity.TicketType = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["TicketType"].ToString())) ? null : ViewState["TicketType"].ToString();
    //    _pushEntity.TicketData = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["TicketData"].ToString())) ? null : ViewState["TicketData"].ToString();
    //    _pushEntity.TicketPayCode = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["TicketPcode"].ToString())) ? null : ViewState["TicketPcode"].ToString();
    //    _pushEntity.DashPopStatus = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["DashPopStatus"].ToString())) ? null : ViewState["DashPopStatus"].ToString();
    //    _pushEntity.DashInStart = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["DashInStart"].ToString())) ? null : ViewState["DashInStart"].ToString();
    //    _pushEntity.DashInEnd = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["DashInEnd"].ToString())) ? null : ViewState["DashInEnd"].ToString();
    //    _pushEntity.DashStartDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["DashStartDTime"].ToString())) ? null : ViewState["DashStartDTime"].ToString();
    //    _pushEntity.DashEndDTime = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["DashEndDTime"].ToString())) ? null : ViewState["DashEndDTime"].ToString();
    //    DataSet dsResult = PushBP.ReviewLmOrderLogSelectCount(_pushEntity).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 BindReviewLmListGrid()
    {
        //messageContent.InnerHtml = "";

        _pushEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _pushEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _pushEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _pushEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
        _pushEntity.PushDBEntity = new List<PushDBEntity>();
        PushDBEntity pushEntity = new PushDBEntity();
        pushEntity.ID = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["TaskID"].ToString())) ? null : ViewState["TaskID"].ToString();
        pushEntity.TelPhone = (ViewState.Count == 0 || String.IsNullOrEmpty(ViewState["TelPhone"].ToString())) ? null : ViewState["TelPhone"].ToString();
        _pushEntity.PushDBEntity.Add(pushEntity);
        _pushEntity.PageCurrent = AspNetPager1.CurrentPageIndex;
        _pushEntity.PageSize = gridViewCSReviewList.PageSize;
        //_pushEntity.SortField = gridViewCSReviewList.Attributes["SortExpression"].ToString();
        //_pushEntity.SortType = gridViewCSReviewList.Attributes["SortDirection"].ToString();
        DataSet dsResult = PushBP.SelectPushActionHistoryList(_pushEntity).QueryResult;

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

        AspNetPager1.PageSize = gridViewCSReviewList.PageSize;
        AspNetPager1.RecordCount = _pushEntity.TotalCount;

        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "BtnCompleteStyle();", true);
    }
    protected void btnSend_Click(object sender, EventArgs e)
    {
        _pushEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _commonEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
        _pushEntity.LogMessages.Userid = UserSession.Current.UserAccount;
        _pushEntity.LogMessages.Username = UserSession.Current.UserDspName;
        _pushEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

        _pushEntity.PushDBEntity = new List<PushDBEntity>();
        PushDBEntity pushEntity = new PushDBEntity();
        pushEntity.ID = hidTaskID.Value.Trim();
        pushEntity.Status = "1";
        _pushEntity.PushDBEntity.Add(pushEntity);
        _pushEntity = PushBP.SendPushMsg(_pushEntity);
        int iResult = _pushEntity.Result;

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

        commonDBEntity.Event_Type = "发送Push信息-发送";
        commonDBEntity.Event_ID = txtPushTitle.Text.Trim();
        string conTent = GetLocalResourceObject("EventSendMessage").ToString();

        conTent = string.Format(conTent, hidTaskID.Value, txtPushTitle.Text.Trim(), txtPushContent.Text.Trim(), hidPushType.Value.Trim());
        commonDBEntity.Event_Content = conTent;

        if (iResult == 1)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("SendSuccess").ToString();
            //messageContent.InnerHtml = GetLocalResourceObject("SendSuccess").ToString();
            _commonEntity.CommonDBEntity.Add(commonDBEntity);
            CommonBP.InsertEventHistory(_commonEntity);
        }
        else if (iResult == 2)
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error9").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("Error9").ToString();
            _commonEntity.CommonDBEntity.Add(commonDBEntity);
            CommonBP.InsertEventHistory(_commonEntity);
            return;
        }
        else
        {
            commonDBEntity.Event_Result = GetLocalResourceObject("Error10").ToString();
            messageContent.InnerHtml = GetLocalResourceObject("Error10").ToString();
            _commonEntity.CommonDBEntity.Add(commonDBEntity);
            CommonBP.InsertEventHistory(_commonEntity);
            return;
        }

        hidMsg.Value = String.Format(GetLocalResourceObject("PushMsg").ToString(), hidPushAllNum.Value); //"Push发送中...0/100";
        hidRemainSecond.Value = (ConfigurationManager.AppSettings["PushRemainSecond"] != null) ? ConfigurationManager.AppSettings["PushRemainSecond"].ToString() : "20";
        this.Page.RegisterStartupScript("remaintimebtn0", "<script>setInterval('RemainTimeBtn()',1000);</script>"); //执行定时执行
    }
    //点击确定按钮
    protected void btnOk_Click(object sender, EventArgs e)
    {
        if (this.HidFlowBtn.Value == "1")
        {
            #region
            try
            {
                if (!chkCashStatus(ViewState["ID"].ToString()))
                {
                    this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('该提现申请状态已经更新,请刷新页面!');", true);
                    return;
                }

                if (StringUtility.Text_Length(txtRemark.Text.Trim()) > 180)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('处理备注最多60个中文字,请修改!');", true);
                    return;
                }

                List<string> list = new List<string>();
                //<asp:ListItem Value="0">已提交</asp:ListItem>
                //<asp:ListItem Value="1">已审核</asp:ListItem>
                //<asp:ListItem Value="2">已成功</asp:ListItem>
                //<asp:ListItem Value="3">已失败</asp:ListItem>
                //<asp:ListItem Value="4">已操作</asp:ListItem>

                //string process_status = this.ddlProcessStatus.SelectedValue;

                string process_status = this.hidProcessStatus.Value;   //点击按钮当前处理的状态
                string pickcashamount = this.lbl_pick_cash_amount_bank.Text;//提现金额

                string remark = this.txtRemark.Text;
                string userRemark = this.txtUserRemark.Text;
                string User_ID = this.lbl_User_ID_bank.Text;
                string isPush = (chkPush.Checked) ? "1" : "0";

                CommonFunction comFun = new CommonFunction();
                int id = comFun.getMaxIDfromSeq("T_LM_CASH_HIS_SEQ");//t_lm_cash_tocash_appl_detl_seq
                string cashWayCode = this.hidCashWayCode_bank.Value;

                string strNow = string.Format("{0:yyyy-MM-dd HH:mm:ss}", System.DateTime.Now);
                //修改主表信息,保留最新一次的备注信息
                //string sqlUpdate = "update T_LM_CASH_TOCASH_APPL set PROCESS_STATUS='" + process_status + "',PROCESS_REMARK='" + remark + "',PROCESS_TIME =to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff') ,PROCESS_USERID='" + UserSession.Current.UserAccount + "'  where id =" + ViewState["ID"].ToString();
                //list.Add(sqlUpdate);

                ////插入一条新信息到详情表中
                //string sqlInsert = "insert into T_LM_CASH_TOCASH_APPL_DETAIL(ID,REF_APPLICATION_ID,USER_ID,HANDLE_STATUS,HANDLE_REMARK,PAY_MODE,HANDLE_TIME,HANDLER) values  ";
                //sqlInsert += "(" + id + ",'" + ViewState["ID"].ToString() + "','" + User_ID + "'," + process_status + ",'" + remark + "','" + cashWayCode + "',to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff'),'" + UserSession.Current.UserAccount + "' )";
                //list.Add(sqlInsert);

                string sqlUpdate = "update T_LM_CASH set STATUS='" + process_status + "',REMARK='" + userRemark + "',PROCESS_REMARK='" + remark + "',UPDATE_TIME =to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff') ,PROCESS_USERID='" + UserSession.Current.UserAccount + "',IS_PUSH='" + isPush + "'  where (STATUS <> 2 AND STATUS <> 3) AND SN =" + ViewState["ID"].ToString();
                list.Add(sqlUpdate);

                //插入一条新信息到详情表中
                if ("4".Equals(process_status))
                {
                    string sqlInserthis = "insert into t_lm_cash_his (id, sn, user_id, status, remark, process_userid, create_time, type, is_push) values  ";
                    sqlInserthis += "(" + id + ",'" + ViewState["ID"].ToString() + "','" + User_ID + "'," + "1" + ",'" + remark + "','" + UserSession.Current.UserAccount + "',to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff')," + hidCashType.Value + ",'" + isPush + "')";
                    list.Add(sqlInserthis);
                    id = comFun.getMaxIDfromSeq("T_LM_CASH_HIS_SEQ");//t_lm_cash_tocash_appl_detl_seq
                }

                string sqlInsert = "insert into t_lm_cash_his (id, sn, user_id, status, remark, process_userid, create_time, type, is_push) values  ";
                sqlInsert += "(" + id + ",'" + ViewState["ID"].ToString() + "','" + User_ID + "'," + process_status + ",'" + remark + "','" + UserSession.Current.UserAccount + "',to_timestamp('" + strNow + "','yyyy-mm-dd hh24:mi:ss.ff')," + hidCashType.Value + ",'" + isPush + "')";
                list.Add(sqlInsert);

                //点击“已审核”
                if (process_status == "3")
                {
                    string sqlCashUser = "******" + pickcashamount + " where USER_ID='" + User_ID + "'";
                    list.Add(sqlCashUser);
                }
                DbHelperOra.ExecuteSqlTran(list);
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('保存成功!');", true);
                BindLToCash();
                setLabelValue(ViewState["ID"].ToString());

                if ("1".Equals(isPush))
                {
                    PushEntity pushEntity = new PushEntity();
                    pushEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
                    pushEntity.LogMessages.Userid = UserSession.Current.UserAccount;
                    pushEntity.LogMessages.Username = UserSession.Current.UserDspName;
                    pushEntity.LogMessages.IpAddress = UserSession.Current.UserIP;

                    pushEntity.PushDBEntity = new List<PushDBEntity>();
                    PushDBEntity pushDBEntity = new PushDBEntity();
                    pushDBEntity.ID = ViewState["ID"].ToString();
                    pushDBEntity.Content = userRemark;
                    pushDBEntity.Type = "6";
                    pushDBEntity.TelPhone = User_ID;
                    pushEntity.PushDBEntity.Add(pushDBEntity);
                    PushInfoSA.SendPush(pushEntity);
                }
            }
            catch
            {
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "key", "alert('保存失败!');", true);
            }
            #endregion
        }
        else
        {
            try
            {
                if (GetCashBackStatus(ViewState["ID"].ToString()) == "0")
                {

                    if (!string.IsNullOrEmpty(this.HidPort.Value))
                    {
                        if (HidPort.Value == "3")
                        {
                            MobilePort_Click(null, null);//手机
                        }
                        else
                        {
                            AlipayPort_Click(null, null);//支付宝
                        }
                    }
                }
                else
                {
                    if (GetCashBackStatus(ViewState["ID"].ToString()) == "2")
                    {
                        ScriptManager.RegisterStartupScript(Page, typeof(Page), "fail", "alert('已失败!');", true);
                    }
                }
            }
            catch (Exception ex)
            {

            }
        }

        ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "alertClose", "BtnCompleteStyle();", true);
        BindLToCash();
    }