Beispiel #1
0
        //---------------------------------------------------------------------
        private bool GetShopName(string szNo)
        {
            bool bFlag = false;

            MyWebPage myWebPage = new MyWebPage(MyApp.HostIP);

            if (myWebPage.PingHost())
            {
                string szURL = MyApp.WebSite + "/api/GetShopName.php";
                string param = "CodeNo=" + szNo;

                string buf = myWebPage.GetResponseString(szURL, param);
                if (buf != "")
                {
                    string[] aAry = buf.Split(',');

                    this.MachineNo   = Int32.Parse(aAry[0]);
                    m_szPhotoCount   = aAry[1];
                    txtDeviceID.Text = aAry[2];
                    txtShopName.Text = aAry[3];

                    bFlag = true;
                }
                else
                {
                    MessageBox.Show("ERR, CodeNo!");
                }
            }
            else
            {
                MessageBox.Show("ERR, PingHost()!");
            }

            return(bFlag);
        }
Beispiel #2
0
        //---------------------------------------------------------------------
        private void CheckUpdate()
        {
            string lastUpdate = MyApp.GetNodeValue("/AppData/LastUpdate");

            MyWebPage myWebPage = new MyWebPage(MyApp.HostIP);

            if (myWebPage.PingHost())
            {
                string szURL = MyApp.WebSite + "/api/CheckUpdate.php";
                string param = "no=" + m_nMachineNo.ToString() + "&t1=" + lastUpdate;

                string buf = myWebPage.GetResponseString(szURL, param);
                if (buf != "")
                {
                    string[] aAry = buf.Split(',');
                    for (Int32 i = 0; i < aAry.Length; i += 2)
                    {
                        DownFile(aAry[i], aAry[i + 1]);   // 下載檔案並更新。
                    }
                    listBox1.Items.Add("Update OK!");
                    lastUpdate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                    MyApp.SetNodeValue("/AppData/LastUpdate", lastUpdate);
                    MyApp.Save();
                }
                else
                {
                    listBox1.Items.Add("No Updated");
                }
            }
        }
        private void btnPayOrder_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                StoneDelegateBuyOrderInfoUIModel buyOrder = ((Button)sender).DataContext as StoneDelegateBuyOrderInfoUIModel;

                MyWebPage.ShowMyWebPage(buyOrder.AlipayLink);
                MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");

                if (!AlipayPaySucceed)
                {
                    var payResult = MyMessageBox.ShowAlipayPayQuestion();
                    if (payResult == MessageBoxAlipayPayQuestionResult.Succeed)
                    {
                        App.UserVMObject.AsyncGetPlayerInfo();
                    }
                    else if (payResult == MessageBoxAlipayPayQuestionResult.Failed)
                    {
                        MyWebPage.ShowMyWebPage(buyOrder.AlipayLink);
                        MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");
                        return;
                    }
                }
            }
            catch (Exception exc)
            {
                LogHelper.Instance.AddErrorLog("Alipay Pay DelegateBuyStone Order Exception", exc);
            }
        }
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            MyWebPage page        = new MyWebPage();
            String    pageContent = page.TransformText();

            System.IO.File.WriteAllText("outputPage.html", pageContent);
        }
Beispiel #5
0
        void Client_GoldCoinRechargeCompleted(object sender, Wcf.Clients.WebInvokeEventArgs <MetaData.Trade.TradeOperResult> e)
        {
            try
            {
                if (e.Cancelled)
                {
                    return;
                }

                if (e.Error != null)
                {
                    MyMessageBox.ShowInfo("访问服务器失败。");
                    return;
                }

                TradeOperResult result = e.Result;
                if (result.ResultCode != OperResult.RESULTCODE_TRUE)
                {
                    MyMessageBox.ShowInfo("金币充值失败。原因:" + OperResult.GetMsg(result.ResultCode));
                    return;
                }
                if (result.PayType == (int)PayType.Alipay)
                {
                    MyWebPage.ShowMyWebPage(result.AlipayLink);
                    MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");

                    if (!AlipayPaySucceed)
                    {
                        var payResult = MyMessageBox.ShowAlipayPayQuestion();
                        if (payResult == MessageBoxAlipayPayQuestionResult.Succeed)
                        {
                            if (!AlipayPaySucceed)
                            {
                                MyMessageBox.ShowInfo("没有接收到支付宝付款信息。如确实付款,请稍后查看购买记录,或联系客服。");
                            }
                        }
                        else if (payResult == MessageBoxAlipayPayQuestionResult.Failed)
                        {
                            MyWebPage.ShowMyWebPage(result.AlipayLink);
                            MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");
                            return;
                        }
                    }
                }

                App.UserVMObject.AsyncGetPlayerInfo();
                _syn.Post(p =>
                {
                    //this.DialogResult = true;
                    this.Close();
                }, null);
            }
            catch (Exception exc)
            {
                MyMessageBox.ShowInfo("充值金币,服务器回调处理异常。" + exc.Message);
            }
        }
        //void Client_ReleaseLockOrderCompleted(object sender, Wcf.Clients.WebInvokeEventArgs<bool> e)
        //{
        //    try
        //    {
        //        if (e.Cancelled)
        //        {
        //            return;
        //        }

        //        App.BusyToken.CloseBusyWindow();

        //        if (e.Error != null)
        //        {
        //            _syn.Post(o =>
        //            {
        //                MyMessageBox.ShowInfo("连接服务器失败。");
        //            }, null);
        //            return;
        //        }

        //        App.StoneOrderVMObject.AsyncGetAllNotFinishedSellOrders();

        //        this.Close();
        //    }
        //    catch (Exception exc)
        //    {
        //        MyMessageBox.ShowInfo("购买矿石,取消购买矿石订单,回调处理异常。" + exc.Message);
        //    }
        //}

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (chkPayType.IsChecked == true)//支付宝支付
                {
                    MyWebPage.ShowMyWebPage(this.LockedOrder.PayUrl);
                    MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");

                    if (!AlipayPaySucceed)
                    {
                        var payResult = MyMessageBox.ShowAlipayPayQuestion();
                        if (payResult == MessageBoxAlipayPayQuestionResult.Succeed)
                        {
                            App.UserVMObject.AsyncGetPlayerInfo();

                            if (!AlipayPaySucceed)
                            {
                                System.Windows.Forms.DialogResult result = MyMessageBox.ShowQuestionOKCancel("没有接收到支付宝付款信息。如确实付款,请点击【确定】,将对订单进行申诉,同时联系管理员进行处理,否则请点击【取消】。注意:三次恶意订单申诉,请被永久封号。");
                                if (result == System.Windows.Forms.DialogResult.OK)
                                {
                                    App.StoneOrderVMObject.AsyncSetStoneOrderPayException(LockedOrder.OrderNumber);
                                }
                            }
                        }
                        else if (payResult == MessageBoxAlipayPayQuestionResult.Failed)
                        {
                            MyWebPage.ShowMyWebPage(this.LockedOrder.PayUrl);
                            MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");
                            return;
                        }
                    }
                }
                else
                {
                    App.StoneOrderVMObject.AsyncPayOrderByRMB(LockedOrder.OrderNumber, LockedOrder.ValueRMB);
                }
            }
            catch (Exception exc)
            {
                MyMessageBox.ShowInfo("购买矿石,处理异常。" + exc.Message);
            }
        }
Beispiel #7
0
        void foo(string s)
        {
            WebPage p1 = new WebPage();
                                MyWebPage p2 = new MyWebPage();

                                p1.foo();
                                p2.foo();

                                a=3;b=4;c=5;
                                if (s > "xyz")
                                {
                                                foo("hello");
                                }
                                if (s <= "xyz")
                                {
                                                print("good");
                                                print("bye");
                                }
                                if (x==y)
                                                print("z");
        }
Beispiel #8
0
        //---------------------------------------------------------------------
        private bool MachineEnabled(string szNo)
        {
            bool      bFlag     = true;
            MyWebPage myWebPage = new MyWebPage(MyApp.HostIP);

            if (myWebPage.PingHost())
            {
                string szURL = MyApp.WebSite + "/api/MachineEnabled.php";
                string param = "ANo=" + szNo;

                string buf = myWebPage.GetResponseString(szURL, param);
                if (buf == "")
                {
                    bFlag = false;
                }
            }
            else
            {
                bFlag = false;
            }
            return(bFlag);
        }
Beispiel #9
0
    void GetResultSetFrame(string strResultsetName, int nStartIndex, int nCount = 10)
    {
        string            strError    = "";
        GetResultSetFrame result_info = new GetResultSetFrame();

        if (string.IsNullOrEmpty(strResultsetName) == true)
        {
            strError = "结果集名不应为空";
            goto ERROR1;
        }
        string strResult = "";
        int    nRet      = ViewResultsetControl.GetContentText(
            app,
            sessioninfo,
            strResultsetName,
            nStartIndex,
            nCount,
            "zh",
            out strResult,
            out strError);

        if (nRet == -1)
        {
            goto ERROR1;
        }

        result_info.Html = strResult;
        this.Response.Write(MyWebPage.GetResultString(result_info));
        this.Response.End();
        return;

ERROR1:
        result_info.ErrorString = strError;
        this.Response.Write(MyWebPage.GetResultString(result_info));
        this.Response.End();
    }
Beispiel #10
0
    //OpacApplication app = null;
    //SessionInfo sessioninfo = null;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (WebUtil.PrepareEnvironment(this,
                                       ref app,
                                       ref sessioninfo) == false)
        {
            return;
        }

        string strError = "";
        int    nRet     = 0;

        string strBarcode = Request.QueryString["barcode"];

#if NO
        if (strBarcode.IndexOf("@") != -1)
        {
            if (sessioninfo.UserID == strBarcode &&
                string.IsNullOrEmpty(sessioninfo.PhotoUrl) == false)
            {
                this.Response.Redirect(this.sessioninfo.PhotoUrl, true);
                return;
            }
        }
#endif

        string strAction = Request.QueryString["action"];

        // 获得一般 QR 图像
        // getphoto.aspx?action=qri&barcode=????????&width=???&height=??? 其中 width 和 height 参数可以缺省
        // 获得读者证号 QR 图像
        // getphoto.aspx?action=pqri&barcode=????????&width=???&height=??? 其中 barcode 参数是读者证条码号。要求当前账户具有 getpatrontempid 的权限,而且读者身份只能获取自己的 tempid
        if (strAction == "qri" ||
            strAction == "pqri")
        {
            string strCharset    = Request.QueryString["charset"];
            string strWidth      = Request.QueryString["width"];
            string strHeight     = Request.QueryString["height"];
            string strDisableECI = Request.QueryString["disableECI"];

            bool bDisableECI = false;
            if (string.IsNullOrEmpty(strDisableECI) == false &&
                (strDisableECI.ToLower() == "true" ||
                 strDisableECI.ToLower() == "yes" ||
                 strDisableECI.ToLower() == "on"))
            {
                bDisableECI = true;
            }

            int nWidth = 0;

            if (string.IsNullOrEmpty(strWidth) == false)
            {
                if (Int32.TryParse(strWidth, out nWidth) == false)
                {
                    strError = "width 参数 '" + strWidth + "' 格式不合法";
                    goto ERROR1;
                }
            }
            int nHeight = 0;
            if (string.IsNullOrEmpty(strHeight) == false)
            {
                if (Int32.TryParse(strHeight, out nHeight) == false)
                {
                    strError = "height 参数 '" + strHeight + "' 格式不合法";
                    goto ERROR1;
                }
            }

            if (strAction == "qri")
            {
                nRet = app.OutputQrImage(
                    this.Page,
                    strBarcode,
                    strCharset,
                    nWidth,
                    nHeight,
                    bDisableECI,
                    false,
                    out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }
            }
            else if (strAction == "pqri")
            {
                // 读者证号二维码
                string strCode = "";
                // 获得读者证号二维码字符串
                nRet = app.GetPatronTempId(
                    // sessioninfo,
                    strBarcode,
                    out strCode,
                    out strError);
                if (nRet == -1)
                {
                    goto ERROR1;    // 把出错信息作为图像返回
                }
                nRet = app.OutputQrImage(
                    this.Page,
                    strCode,
                    strCharset,
                    nWidth,
                    nHeight,
                    bDisableECI,
                    false,
                    out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }
            }
            this.Response.End();
            return;
        }


        string strDisplayName   = Request.QueryString["displayName"];
        string strEncyptBarcode = Request.QueryString["encrypt_barcode"];

        // 2012/5/22
        // 较新的用法 userid=xxxx 或者 userid=encrypt:xxxx
        string strUserID = Request.QueryString["userid"];
        if (string.IsNullOrEmpty(strUserID) == false)
        {
            if (StringUtil.HasHead(strUserID, "encrypt:") == true)
            {
                strEncyptBarcode = strUserID.Substring("encrypt:".Length);
            }
            else
            {
                strBarcode = strUserID;
            }
        }

        string strPhotoPath = "";
        // 根据读者证条码号找到头像资源路径
        // return:
        //      -1  出错
        //      0   没有找到。包括读者记录不存在,或者读者记录里面没有头像对象
        //      1   找到
        nRet = app.GetReaderPhotoPath(
            // sessioninfo,
            strBarcode,
            strEncyptBarcode,
            strDisplayName,
            out strPhotoPath,
            out strError);
        if (nRet == -1)
        {
            goto ERROR1;
        }

        if (nRet == 0)
        {
            this.Response.Redirect(MyWebPage.GetStylePath(app, "nonephoto.png"), true);
            return;
        }

        // TODO: HEAD / if-modify-since等精细处理

        // FlushOutput flushdelegate = new FlushOutput(MyFlushOutput);

        nRet = app.DownloadObject(
            this,
            null,
            strPhotoPath,
            false,
            "",
            out strError);
        if (nRet == -1)
        {
            goto ERROR1;
        }

        Response.End();
        return;

#if NO
ERROR1:
        Response.Write(strError);
        Response.End();
        return;
#endif
ERROR1:
        {
            // 文字图片
            using (MemoryStream image = WebUtil.TextImage(
                       ImageFormat.Gif,
                       strError,
                       Color.Black,
                       Color.Yellow,
                       10,
                       300))
            {
                Page.Response.ContentType = "image/gif";
                this.Response.AddHeader("Content-Length", image.Length.ToString());

                this.Response.AddHeader("Pragma", "no-cache");
                this.Response.AddHeader("Cache-Control", "no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
                this.Response.AddHeader("Expires", "0");

                FlushOutput flushdelegate = new FlushOutput(MyFlushOutput);

                image.Seek(0, SeekOrigin.Begin);
                StreamUtil.DumpStream(image, Response.OutputStream, flushdelegate);
            }
            Response.Flush();
            Response.End();
        }
    }
Beispiel #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.BiblioSearchControl1.Location = this.TitleBarControl1.SelectedLibraryCode;

        if (WebUtil.PrepareEnvironment(this,
                                       ref app,
                                       ref sessioninfo) == false)
        {
            return;
        }

        string strSideBarFile = Server.MapPath("./search_sidebar.xml");

        if (File.Exists(strSideBarFile) == true)
        {
            this.SideBarControl1.CfgFile = strSideBarFile;
        }
        else
        {
            this.SideBarControl1.Visible = false;
        }

        SetSideBarVisible();

        /*
         * // 是否登录?
         * if (sessioninfo.UserID == "")
         * {
         *  sessioninfo.LoginCallStack.Push(Request.RawUrl);
         *  Response.Redirect("login.aspx", true);
         *  return;
         * }
         * */

        if (this.BrowseSearchResultControl1.ResultCount > 0)
        {
            this.BrowseSearchResultControl1.Visible = true;
#if FILTER
            VisibleFilter(true);
#endif
        }

        // 是否登录?
        if (sessioninfo.UserID == "")
        {
            if (this.Page.Request["forcelogin"] == "on")
            {
                sessioninfo.LoginCallStack.Push(Request.RawUrl);
                Response.Redirect("login.aspx", true);
                return;
            }
            if (this.Page.Request["forcelogin"] == "userid")
            {
                sessioninfo.LoginCallStack.Push(Request.RawUrl);
                Response.Redirect("login.aspx?loginstyle=librarian", true);
                return;
            }
            sessioninfo.UserID   = "public";
            sessioninfo.IsReader = false;

            /*
             * sessioninfo.LoginCallStack.Push(Request.RawUrl);
             * Response.Redirect("login.aspx", true);
             * return;
             * */
        }

        string strError = "";
        int    nRet     = 0;

#if NO
        string strAction = this.Request["action"];
        if (strAction == "getdblist")
        {
            DoGetDbNameList();
            return;
        }
#endif

        // 如果有参数
        string strWord = this.Request["word"];
        if (String.IsNullOrEmpty(strWord) == false &&
            this.IsPostBack == false)
        {
            string strXml = "";

            // string strWord = "";
            string strDbName     = "";
            string strFrom       = "";
            string strMatchStyle = "";

            GetSearchParams(out strWord,
                            out strDbName,
                            out strFrom,
                            out strMatchStyle);

            // 根据检索参数创建XML检索式
            nRet = OpacApplication.BuildQueryXml(
                this.app,
                strDbName,     // this.Request["dbname"],
                strWord,
                strFrom,       // this.Request["from"],
                strMatchStyle, // this.Request["matchstyle"],
                null,
                null,
                app.SearchMaxResultCount,
                this.BiblioSearchControl1.SearchStyle, // strSearchStyle
                out strXml,
                out strError);
            if (nRet == -1)
            {
                goto ERROR1;
            }

            string strResultSetNamePrefix = "";

            strResultSetNamePrefix = this.Request["resultsetname"];
            if (String.IsNullOrEmpty(strResultSetNamePrefix) == true)
            {
                strResultSetNamePrefix = Session.SessionID + "_opac_1";
            }
            else
            {
                strResultSetNamePrefix = Session.SessionID + "_" + strResultSetNamePrefix;
            }

            string strResultSetName = GetResultSetName(strResultSetNamePrefix);

            LibraryChannel channel = sessioninfo.GetChannel(true);
            //sessioninfo.Channel.
            channel.Idle += new IdleEventHandler(channel_Idle);
            try
            {
                long lRet = // sessioninfo.Channel.
                            channel.Search(
                    null,
                    strXml,
                    strResultSetName,
                    "", // strOutputStyle
                    out strError);
                if (lRet == -1)
                {
                    goto ERROR1;
                }
#if FILTER
                app.SetFilterTask(strResultSetName, null);
#endif

                if (app.SearchLog != null)
                {
                    SearchLogItem log = new SearchLogItem();
                    log.IP    = this.Request.UserHostAddress.ToString();
                    log.Query = SearchLog.BuildLogQueryString(
                        this.Request["dbname"],
                        strWord,
                        this.Request["from"],
                        this.Request["matchstyle"]);
                    log.Time     = DateTime.UtcNow;
                    log.HitCount = nRet;
                    log.Format   = "searchcount";
                    app.SearchLog.AddLogItem(log);
                }

                // not found
                if (lRet == 0)
                {
                    this.BrowseSearchResultControl1.Visible = false;
#if FILTER
                    this.filter.Visible = false;
#endif
                    strError = "没有找到";
                    goto ERROR1;
                }

                this.BrowseSearchResultControl1.Clear();
                this.BrowseSearchResultControl1.Visible = true;
#if FILTER
                VisibleFilter(true);
#endif

                this.BrowseSearchResultControl1.ResultSetName = strResultSetName;
                this.BrowseSearchResultControl1.ResultCount   = (int)lRet;
                this.BrowseSearchResultControl1.StartIndex    = 0; // 2008/12/15

#if FILTER
                this.filter.ResultSetName = strResultSetName;
#endif

                string strFormat = this.Request["format"];
                if (String.IsNullOrEmpty(strFormat) == false)
                {
                    this.BrowseSearchResultControl1.FormatName = strFormat;
                }
                return;
            }
            finally
            {
                // sessioninfo.Channel.
                channel.Idle -= new IdleEventHandler(channel_Idle);
                sessioninfo.ReturnChannel(channel);
            }
        }

        // 观察特定的结果集
        if (this.IsPostBack == false)
        {
            string strResultSet     = this.Request["resultset"];
            string strBaseResultSet = this.Request["base"];
            string strTitle         = this.Request["title"];
            if (string.IsNullOrEmpty(strResultSet) == false)
            {
                string strResultsetFilename = PathUtil.MergePath(app.TempDir,   // sessioninfo.GetTempDir(), // ??
                                                                 strResultSet);
                if (File.Exists(strResultsetFilename) == true)
                {
                    long lHitCount = CacheBuilder.GetCount(app, strResultsetFilename, true);

                    this.BrowseSearchResultControl1.ResultsetFilename = strResultsetFilename;

                    this.BrowseSearchResultControl1.Visible = true;
#if FILTER
                    VisibleFilter(true);

                    this.filter.ResultSetName = strBaseResultSet;
#endif

                    string strOffset = this.Request["offset"];
                    this.BrowseSearchResultControl1.ResultsetOffset = strOffset;

#if FILTER
                    this.filter.SelectedNodePath = MakeSelectedPath(strResultSet, strOffset);
#endif
                    if (string.IsNullOrEmpty(strOffset) == false)
                    {
                        int nStart  = 0;
                        int nLength = -1;
                        BrowseSearchResultControl.ParseOffsetString(strOffset,
                                                                    out nStart,
                                                                    out nLength);
                        if (nLength == -1)
                        {
                            nLength = (int)lHitCount - nStart;
                        }
                        this.BrowseSearchResultControl1.ResultCount = nLength;
                    }
                    else
                    {
                        this.BrowseSearchResultControl1.ResultCount = (int)lHitCount;
                    }

                    if (string.IsNullOrEmpty(strTitle) == false)
                    {
                        this.BrowseSearchResultControl1.Title = strTitle;
                    }
                }
                else
                {
                    strError = "结果集文件 '" + strResultSet + "' 不存在";
                    goto ERROR1;
                }
            }
            else if (string.IsNullOrEmpty(strBaseResultSet) == false)
            {
                // 只用了base参数
                this.BrowseSearchResultControl1.Clear();
                this.BrowseSearchResultControl1.Visible = true;
#if FILTER
                VisibleFilter(true);
#endif

                this.BrowseSearchResultControl1.ResultSetName = strBaseResultSet;
                this.BrowseSearchResultControl1.ResultCount   = (int)MyWebPage.GetServerResultCount(sessioninfo, strBaseResultSet);
                this.BrowseSearchResultControl1.StartIndex    = 0;

#if FILTER
                this.filter.ResultSetName = strBaseResultSet;
#endif
            }
        }

        //this.AdvanceSearchControl1.Channels = sessioninfo.Channels;
        //this.AdvanceSearchControl1.ServerUrl = app.WsUrl;

        // this.HeadBarControl1.CurrentColumn = HeaderColumn.Search;
        return;

ERROR1:
        Response.Write(HttpUtility.HtmlEncode(strError));
        Response.End();
    }
Beispiel #12
0
    void CreateRssLink(
        string strTitle,
        string strRssNavigateUrl)
    {
        if (string.IsNullOrEmpty(strRssNavigateUrl) == true)
        {
            return;
        }

        this.BrowseSearchResultControl1.Title = "<div class='resulttitle'><div class='text'>" + strTitle + "</div>" + "<div class='rss'><a class='rss' href='" + strRssNavigateUrl + "' title='RSS订阅'><img src='" + MyWebPage.GetStylePath(app, "rss.gif") + "'></img></a></div><div class='clear'></div>" + "</div>";

        HtmlLink link = new HtmlLink();

        link.Href = strRssNavigateUrl;
        link.Attributes.Add("rel", "alternate");
        link.Attributes.Add("type", "application/rss+xml");
        link.Attributes.Add("title", strTitle);

        this.Page.Header.Controls.Add(link);
    }
Beispiel #13
0
 private void hlinkHomePage_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
 {
     MyWebPage.ShowMyWebPage("");
     e.Handled = true;
 }
Beispiel #14
0
 private void hlinkRegister_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
 {
     MyWebPage.ShowMyWebPage("Register.aspx");
     e.Handled = true;
 }
        void Client_DelegateBuyStoneCompleted(object sender, Wcf.Clients.WebInvokeEventArgs <MetaData.OperResultObject> e)
        {
            try
            {
                App.BusyToken.CloseBusyWindow();

                if (e.Error != null)
                {
                    LogHelper.Instance.AddErrorLog("Client_DelegateBuyStone Server Exception", e.Error);
                    return;
                }
                if (e.UserState == null)
                {
                    return;
                }
                PayType paytype = (PayType)e.UserState;

                App.StackStoneVMObject.AsyncGetAllNotFinishedBuyOrders();
                App.UserVMObject.AsyncGetPlayerInfo();

                if (e.Result.OperResultCode == OperResult.RESULTCODE_TRUE)
                {
                    if (paytype == PayType.Alipay)
                    {
                        MyWebPage.ShowMyWebPage(e.Result.Message);
                        MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");

                        if (!AlipayPaySucceed)
                        {
                            var payResult = MyMessageBox.ShowAlipayPayQuestion();
                            if (payResult == MessageBoxAlipayPayQuestionResult.Succeed)
                            {
                                App.UserVMObject.AsyncGetPlayerInfo();

                                //if (!AlipayPaySucceed)
                                //{
                                //    System.Windows.Forms.DialogResult result = MyMessageBox.ShowQuestionOKCancel("没有接收到支付宝付款信息。如确实付款,请点击【确定】,将对订单进行申诉,同时联系管理员进行处理,否则请点击【取消】。注意:三次恶意订单申诉,请被永久封号。");
                                //    if (result == System.Windows.Forms.DialogResult.OK)
                                //    {
                                //        App.StoneOrderVMObject.AsyncSetStoneOrderPayException(LockedOrder.OrderNumber);
                                //    }
                                //}
                            }
                            else if (payResult == MessageBoxAlipayPayQuestionResult.Failed)
                            {
                                MyWebPage.ShowMyWebPage(e.Result.Message);
                                MyMessageBox.ShowInfo("请在弹出的网页中,登录支付宝进行付款。");
                                return;
                            }
                        }
                    }
                    else
                    {
                        MyMessageBox.ShowInfo("挂单成功");
                    }
                }
                else
                {
                    MyMessageBox.ShowInfo("挂单失败,原因为:" + OperResult.GetMsg(e.Result.OperResultCode));
                }
            }
            catch (Exception exc)
            {
                LogHelper.Instance.AddErrorLog("Client_DelegateBuyStone Exception", exc);
            }
        }
Beispiel #16
0
    // 根据记录数量的多少,少的时候可以立即返回结果,多的时候用线程后台处理,然后可以随时查询状态
    // 线程用线程池,避免过多耗用线程数目

    // 根据结果集名,提取全部书目 XML 记录,然后批处理经过 MarcFilter 过滤,创建若干个子结果集
    // 最基本的功能是返回子结果集的显示名,文件名,包含记录数量,供前端显示在界面上
    // 较为深入的功能是,将子结果集按照 key 排序归并,而显示出二级条目和数量。二级结果集是子结果集的子结果集

    // TODO: 如何及时清理Task对象,避免内存过度膨胀? 是否仅保存最新10个Task对象?
    void GetFilterInfo(
        string strResultsetName,
        string strSelected,
        string strLang)
    {
        string        strError    = "";
        GetFilterInfo result_info = new GetFilterInfo();

        if (string.IsNullOrEmpty(strResultsetName) == true)
        {
            strError = "结果集名不应为空";
            goto ERROR1;
        }

        FilterTask t = app.FindFilterTask(strResultsetName);    // Task对象是利用 Session 内结果集名来进行管理的

        if (t == null)
        {
            // 如果一个结果集还没有被后台任务处理,就立即启动一个后台任务
            t = new FilterTask();
            app.SetFilterTask(strResultsetName, t);

            string strGlobalResultSetName = "";
            bool   bShare = false;

            if (strResultsetName[0] == '#')
            {
                strGlobalResultSetName = strResultsetName.Substring(1);
            }
            else
            {
                // 构造全局结果集名
                strGlobalResultSetName = sessioninfo.GetHashCode() + "_" + strResultsetName;

                LibraryChannel channel = sessioninfo.GetChannel(true);
                try
                {
                    // 先把结果集共享
                    // 管理结果集
                    // parameters:
                    //      strAction   share/remove 分别表示共享为全局结果集对象/删除全局结果集对象
                    long lRet = // sessioninfo.Channel.
                                channel.ManageSearchResult(
                        null,
                        "share",
                        strResultsetName,
                        strGlobalResultSetName,
                        out strError);
                    if (lRet == -1)
                    {
                        goto ERROR1;
                    }

                    bShare = true;
                }
                finally
                {
                    sessioninfo.ReturnChannel(channel);
                }
            }

            FilterTaskInput i = new FilterTaskInput();
            i.App            = app;
            i.FilterFileName = Path.Combine(app.DataDir, "cfgs/facet.fltx");
            i.ResultSetName  = strGlobalResultSetName;
            i.ShareResultSet = bShare;
            // i.SessionInfo = sessioninfo;
            i.TempDir  = app.TempDir;
            i.TaskName = strResultsetName;  // Task对象是利用Session内结果集名来进行管理的
            i.MaxCount = 1000;
            // i.aggregation_names = new List<string>() {"author"};

            XmlDocument def_dom = GetFacetDefDom(out strError);
            if (def_dom == null)
            {
                goto ERROR1;
            }
            i.DefDom = def_dom;

            ThreadPool.QueueUserWorkItem(t.ThreadPoolCallBack, i);
            strError = "#pending";  // 表示正在处理,希望前端稍后重新访问
            goto ERROR1;
        }
        else
        {
            if (t.TaskState == TaskState.Processing)
            {
                if (t.ProgressRange != 0)
                {
                    result_info.ProgressValue = (int)(((double)t.ProgressValue / (double)t.ProgressRange) * 100);
                }
                strError = "#pending";  // 表示正在处理,希望前端稍后重新访问
                goto ERROR1;
            }
            if (string.IsNullOrEmpty(t.ErrorInfo) == false)
            {
                strError = t.ErrorInfo;
                goto ERROR1;
            }

            GC.Collect();   // 试着释放 Hashtable 等

            long lHitCount = MyWebPage.GetServerResultCount(sessioninfo, strResultsetName);

            XmlDocument def_dom = GetFacetDefDom(out strError);
            if (def_dom == null)
            {
                goto ERROR1;
            }
            this.m_facetDom = def_dom;
            this.m_strLang  = strLang;

            try
            {
                // 创建FilterInfo数组
                result_info.Items = ResultsetFilter.BuildFilterInfos(
                    strResultsetName,
                    lHitCount,
                    strSelected,
                    GetKeyNameCaption,
                    t.ResultItems,
                    app.TempDir,    // sessioninfo.GetTempDir(),
                    10);
                // GC.Collect();    // 担心 DpResultSet 未能回收
            }
            catch (Exception ex)
            {
                strError = ExceptionUtil.GetAutoText(ex);
                goto ERROR1;
            }

            if (t.HitCount > 1000)
            {
                result_info.Comment = "分面导航只提取了当前结果集的前 1000 条记录";
            }
        }

        // 返回一级节点的名字和包含记录数量
        this.Response.Write(MyWebPage.GetResultString(result_info));
        this.Response.End();
        return;

ERROR1:
        result_info.ErrorString = strError;
        this.Response.Write(MyWebPage.GetResultString(result_info));
        this.Response.End();
    }