Ejemplo n.º 1
0
        protected override void ExecuteStatement(ExecutionContext context)
        {
            if (!context.Request.Context.CursorExists(CursorName))
            {
                throw new StatementException(String.Format("The cursor '{0}' was not found in the current context.", CursorName));
            }

            var cursor = context.Request.Context.FindCursor(CursorName);

            if (cursor == null)
            {
                throw new StatementException(String.Format("The cursor '{0}' was not found in the current context.", CursorName));
            }
            if (cursor.Status == CursorStatus.Closed)
            {
                throw new StatementException(String.Format("The cursor '{0}' was already closed.", CursorName));
            }

            int offset = -1;

            if (OffsetExpression != null)
            {
                offset = OffsetExpression.EvaluateToConstant(context.Request, null);
            }

            var fetchContext = new FetchContext(context.Request, Direction, ReferenceExpression);

            if (Direction == FetchDirection.Absolute ||
                Direction == FetchDirection.Relative)
            {
                fetchContext.Offset = offset;
            }

            cursor.FetchInto(fetchContext);
        }
Ejemplo n.º 2
0
    /*
     * private void OnSubmitSuccess(object sender, ShopBuyStoneArguments arg)
     * {
     *      if(string.IsNullOrEmpty(arg.ResponseBaseInfo1.Error))
     *      {
     *              if(arg.ResponseBaseInfo1.ResponseCode.Equals("0"))
     *              {
     *                      this.Success(StoreKitHelper.ComfirmTransaction(this.transactionID));
     *              }
     *              else
     *              {
     *                      this.Success(StoreKitHelper.ComfirmTransaction(this.transactionID));
     *              }
     *      }
     *      else
     *      {
     *              this.Success(null);
     *      }
     * }
     */

    private void Success(string comfirmedProduct)
    {
        this.ShopModule.State = comfirmedProduct == null ? ShopActionState.Idle : ShopActionState.Success;
        if (this.SuccessorContext == null)
        {
            this.ShopModule.ChangeContext(new IdleContext());
        }
        else
        {
            this.ShopModule.State = ShopActionState.Operating;
            FetchContext fetchContext = this.SuccessorContext as FetchContext;
            this.ShopModule.ChangeContext(this.SuccessorContext);
            if (fetchContext != null)
            {
                fetchContext.StartFetch();
            }
        }
        if (comfirmedProduct == null)
        {
            return;
        }
        ShopItemInformation info = new ShopItemInformation();

        //info.Initialize(Json.jsonDecode(comfirmedProduct) as Hashtable);
        this.ShopModule.OnPurchaseSuccessed(info);
    }