コード例 #1
0
        public void query()
        {
            try
            {
                ElecQueryElecInfo info = ElecAccess.QueryElec(Payment.elecPayParam.Account);
                loadlbl.Dispatcher.Invoke(new isShowLabelDelegate(isShowLabel), loadlbl, false);
                try
                {
                    //ElecQueryUserInfo userInfo = ElecAccess.QueryUser(Payment.elecPayParam.Account);
                    //address = userInfo.msgrsp.userInfoList[0].yddz;
                    address = info.msgrsp.yddz;
                    addresslbl.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), this.addresslbl, info.msgrsp.yddz);
                    if (address.Length > 10)
                    {
                        // timer1.Enabled = true;
                    }
                }
                catch (Exception ex) { }


                if (!"0000".Equals(info.msgrsp.retcode))
                {
                    //欠费
                    if ("0001".Equals(info.msgrsp.retcode))
                    {
                        btnRecharg.Dispatcher.Invoke(new isShowButtonDelegate(isShowButton), btnRecharg, true);
                        //提示
                        lblAccountInfo.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), lblAccountInfo, "查询无欠费,可进行预收");
                        //电费账号
                        lblBalance.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), lblBalance, Payment.elecPayParam.Account);
                        yonhumingchengLbl.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), yonhumingchengLbl, info.msgrsp.yhmc);
                        if (info.msgrsp.ysje != null)
                        {
                            if (info.msgrsp.ysje.Length > 0)
                            {
                                lblAmount.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), lblAmount, info.msgrsp.ysje);
                            }
                            else
                            {
                                lblAmount.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), lblAmount, "0.0");
                            }
                        }
                        //if (info.msgrsp.qfje != null)
                        //{
                        //    //欠费金额
                        //    if (info.msgrsp.qfje.Length > 0)
                        //        qfjeLbl.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), qfjeLbl, info.msgrsp.qfje);
                        //    else
                        //        qfjeLbl.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), qfjeLbl, "0.0");
                        //}
                        Payment.elecPayParam.IsArrearage = true;
                        //Payment.elecPayParam.Account = Payment.elecPayParam.Account;
                        //btnRecharg.Dispatcher.Invoke(new isShowButtonDelegate(isShowButton),btnRecharg,true);
                        panel4.Dispatcher.Invoke(new isShowGridDelegate(isShowGrid), panel4, true);
                        try
                        {
                            rollingThread = new Thread(delegate() { rolling(); });
                            rollingThread.Start();
                        }catch (ThreadAbortException ae) { log.Write("error:" + ae.Message); }
                        catch (Exception ex) { log.Write("error:电力查询信息滚动异常:" + ex.Message); }
                        SysBLL.Player("继续缴费请点击确定按钮.wav");
                        return;
                    }
                    else if (!"0000".Equals(info.msgrsp.retcode))
                    {
                        loadlbl.Dispatcher.Invoke(new isShowLabelDelegate(isShowLabel), this.loadlbl, false);
                        //激活按钮
                        btnRecharg.Dispatcher.Invoke(new isShowButtonDelegate(isShowButton), this.btnRecharg, false);
                        if (info.msgrsp.retshow.Length > 0)
                        {
                            lblAccountInfo.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), lblAccountInfo, info.msgrsp.retshow);
                            return;
                        }
                        else
                        {
                            lblAccountInfo.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), lblAccountInfo, "查询失败,请稍后再试");
                            return;
                        }
                    }
                    else if (info.msgrsp.retshow != null)
                    {
                        if (info.msgrsp.retshow == null)
                        {
                            info.msgrsp.retshow = "";
                        }
                        string retshow = SysBLL.ClearBlank(info.msgrsp.retshow);
                        if (retshow.Length <= 15)
                        {
                            //提示
                            lblAccountInfo.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), lblAccountInfo, retshow);
                            loadlbl.Dispatcher.Invoke(new isShowLabelDelegate(isShowLabel), this.loadlbl, false);
                            return;
                        }
                    }
                    else
                    {
                        PrintInfo(WtException.formatMsg(WtExceptionCode.Bus.BUS_QUERY));
                    }
                }
                if (info.msgrsp.dfze != null)
                {
                    btnRecharg.Dispatcher.Invoke(new isShowButtonDelegate(isShowButton), btnRecharg, false);
                    //提示
                    lblAccountInfo.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText), lblAccountInfo, "您的账号信息");
                    loadlbl.Dispatcher.Invoke(new isShowLabelDelegate(isShowLabel), this.loadlbl, false);
                    ////电费账号
                    //lblBalance.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText)Text = account;
                    yonhumingcheng = info.msgrsp.yhmc;
                    ////余额
                    //if (info.msgrsp.ysje.Length > 0)
                    //    lblAmount.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText)Text = info.msgrsp.ysje;
                    //else
                    //    lblAmount.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText)Text = "0.0";
                    ////欠费金额
                    //if (info.msgrsp.qfje.Length > 0)
                    //    qfjeLbl.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText)Text = info.msgrsp.qfje;
                    //else
                    //    qfjeLbl.Dispatcher.Invoke(new setTextBlockTextDelegate(setTextBlockText)Text = "0.0";
                    panel2.Dispatcher.Invoke(new isShowGridDelegate(isShowGrid), panel2, true);
                    //btnRecharg.Dispatcher.Invoke(new isShowButtonDelegate(isShowButton),btnRecharg,true);
                    //Payment.elecPayParam.UserInputAmount = info.msgrsp.qfje;
                    //Payment.elecPayParam.Account = Payment.elecPayParam.Account;
                    //获取支付参数
                    Payment.elecPayParam.Param      = new ElecPayresParam();
                    Payment.elecPayParam.Param.dzpc = info.msgrsp.dzpc;
                    Payment.elecPayParam.Param.yhbh = info.msgrsp.yhbh;
                    Payment.elecPayParam.Param.ysje = info.msgrsp.ysje;
                    Payment.elecPayParam.Param.jfbs = info.msgrsp.dfbs;
                    list = info.msgrsp.dianFeiDetail;
                    if (list.Count > 0)
                    {
                        string str = "";
                        for (int i = 0; i < list.Count; i++)
                        {
                            str  = list[i].yhbh + "-" + list[i].ysbz + "-" + list[i].bbyjje + "-" + list[i].dfje + "-" + list[i].wyjje + "-" + list[i].sctw + "-" + list[i].bctw + "|";
                            jfmx = jfmx + str;
                        }
                        jfmx = jfmx.Remove(jfmx.Length - 1, 1);
                    }
                    pushlist();
                    pagelbl.Dispatcher.Invoke(new isShowTextBlockDelegate(isShowTextBlock), pagelbl, true);
                    //激活按钮
                    //btnRecharg.Dispatcher.Invoke(new isShowButtonDelegate(isShowButton),btnRecharg,true);
                    btnRecharg.Dispatcher.Invoke(new isShowButtonDelegate(isShowButton), btnRecharg, false);
                    SysBLL.Player("继续缴费请点击充值按钮.wav");
                    return;
                }
            }
            catch (ThreadAbortException ae) { log.Write("error:FormElectricStep02:query():" + ae.Message); }
            catch (WtException ex)
            {
                if (ex.getCode() == WtExceptionCode.Sys.NETWORK)
                {
                    PrintInfo(WtException.formatMsg(WtExceptionCode.Bus.BUS_QUERY, ex.Message));
                }
                else
                {
                    PrintInfo(ex);
                }
            }
            catch (Exception e)
            {
                PrintInfo(WtException.formatMsg(WtExceptionCode.Bus.BUS_QUERY, e.Message));
            }
        }