Beispiel #1
0
        public ActionResult GetMyButton()
        {
            var           UserRoles         = OperateContext.Current.UserRole;
            var           USER_CD           = OperateContext.Current.UsrId;
            ButtonRequest RequestButtonData = new ButtonRequest(HttpContext);

            return(this.JsonFormatSuccess(
                       FW_USER_MANAGER.GetUserRoleButtons(USER_CD, UserRoles, RequestButtonData),
                       SystemMessage.LoadSuccess.ToString()
                       ));
        }
Beispiel #2
0
 public void fakePressButton()
 {
     if (buttonRequest == ButtonRequest.Close)
     {
         buttonRequest = ButtonRequest.Open;
     }
     else if (buttonRequest == ButtonRequest.Open)
     {
         buttonRequest = ButtonRequest.Close;
     }
     lock (lockForProcess) isProcessComplete = false;
 }
 public void createButtons(ButtonRequest[] requests)
 {
     this.buttons = new List <Button>();
     if (requests.Length == 1)
     {
         ButtonRequest        request = requests[0];
         TexturedEffectButton button  = ModelGenerationUtil.createButton(content, new Vector2(middle, y), request.Name);
         this.buttons.Add(new Button(content, button, request.Callback));
     }
     else
     {
         for (int i = 0; i < requests.Length; i++)
         {
             ButtonRequest        request = requests[i];
             TexturedEffectButton button  = ModelGenerationUtil.createButton(content, new Vector2(POSITIONS[i], y), request.Name);
             this.buttons.Add(new Button(content, button, request.Callback));
         }
     }
 }
Beispiel #4
0
        /// <summary>
        /// Authenticated resource that creates a payment button, page, or iFrame to accept bitcoin on your website. This can be used to accept bitcoin for an individual item or to integrate with your existing shopping cart solution. For example, you could create a new payment button for each shopping cart on your website, setting the total and order number in the button at checkout.
        ///
        /// The code param returned in the response can be used to generate an embeddable button, payment page, or iFrame.
        /// </summary>
        public virtual ButtonResponse RegisterButton(ButtonRequest buttonRequest)
        {
            var client = CreateClient();

            var post = CreateRequest("buttons")
                       .AddBody(buttonRequest);

            var resp = client.Execute <ButtonResponse>(post);

            if (resp.ErrorException != null)
            {
                throw resp.ErrorException;
            }
            if (resp.ErrorMessage != null)
            {
                throw new Exception(resp.ErrorMessage);
            }

            return(resp.Data);
        }
Beispiel #5
0
        public IEnumerable <MODEL.ViewModel.ViewModelMyButton> GetUserRoleButtons(List <int> Roles, ButtonRequest RequestController, int AdminUserRoleID)
        {
            List <ViewModelMyButton>        listButtons = new List <ViewModelMyButton>();
            IEnumerable <Sample_Permission> Actions     = new List <Sample_Permission>();

            //获取当前角色的按钮模块数组
            if (Roles.Contains(AdminUserRoleID))
            {
                Actions = PermissionManager.GetListBy(p => p.pControllerName == RequestController.MenuNo && p.pIsButton == true).OrderBy(p => p.pOrder).ToList();
            }
            else
            {
                var buttonids = OperateContext.Current.UsrPermissionId;
                Actions = OperateContext.Current.BLLSession.ISample_PermissionManager.LoadListBy(p => p.pControllerName == RequestController.MenuNo && p.pIsButton == true && buttonids.Contains(p.pId)).ToList();
            }

            foreach (Sample_Permission data in Actions)
            {
                //添加到按钮数组
                listButtons.Add(ViewModelMyButton.ToEntity(data));
            }
            return(listButtons);
        }
Beispiel #6
0
        public IEnumerable <MyButton> GetUserRoleButtons(string USER_CD, List <int> UserRoles, ButtonRequest RequestController)
        {
            List <MyButton>             listButtons = new List <MyButton>();
            IEnumerable <FW_PERMISSION> Actions     = new List <FW_PERMISSION>();

            //获取当前角色的按钮模块数组
            if (USER_CD == "Administrator")
            {
                listButtons = OperateContext.Current.BLLSession.IFW_MODULEPERMISSION_MANAGER.GetListBy(p => p.FW_MODULE.MODULE_ID == RequestController.MenuNo && p.FW_PERMISSION.ISBUTTON == "Y").OrderBy(p => p.FW_PERMISSION.SEQ_NO).Select(p => new MyButton()
                {
                    BtnNo    = p.FW_PERMISSION.ACTIONNAME,
                    BtnName  = p.FW_PERMISSION.NAME,
                    BtnIcon  = p.FW_PERMISSION.ICON,
                    BtnClick = p.FW_PERMISSION.SCRIPT
                }).ToList();
            }
            else
            {
                var buttonids = OperateContext.Current.UsrPermissionId;
                listButtons = OperateContext.Current.BLLSession.IFW_MODULEPERMISSION_MANAGER.GetListBy(p => p.FW_MODULE.MODULE_ID == RequestController.MenuNo && buttonids.Contains(p.FW_PERMISSION.PERMISSION_ID) && p.FW_PERMISSION.ISBUTTON == "Y").OrderBy(p => p.FW_PERMISSION.SEQ_NO).Select(p => new MyButton()
                {
                    BtnNo    = p.FW_PERMISSION.ACTIONNAME,
                    BtnName  = p.FW_PERMISSION.NAME,
                    BtnIcon  = p.FW_PERMISSION.ICON,
                    BtnClick = p.FW_PERMISSION.SCRIPT
                }).ToList();
            }



            //Actions = OperateContext.Current.BLLSession.IFW_PERMISSION_MANAGER.GetListBy(p => p.CONTROLLERNAME == RequestController.MenuNo && p.ISBUTTON == "Y").OrderBy(p => p.SEQ_NO).ToList();
            //foreach (FW_PERMISSION data in Actions)
            //{
            //    //添加到按钮数组
            //    listButtons.Add(MyButton.ToEntity(data));
            //}
            return(listButtons);
        }
        public void integration_test_create_button()
        {
            var api = new CoinbaseApi();

            var paymenRequest = new ButtonRequest
                {
                    Name = "Order Name",
                    Currency = Currency.USD,
                    Price = 79.99m,
                    Type = ButtonType.BuyNow,
                    Custom = "Custom_Order_Id",
                    Description = "Order Description",
                    Style = ButtonStyle.CustomLarge,
                    CallbackUrl = "http://www.bitarmory.com/callback",
                    CancelUrl = "http://www.bitarmory.com/cancel",
                    InfoUrl = "http://www.bitarmory.com/info",
                    SuccessUrl = "http://www.bitarmory.com/success",
                    ChoosePrice = false,
                    IncludeAddress = false,
                    IncludeEmail = false,
                    VariablePrice = false
                };

            var buttonResponse = api.RegisterButton( paymenRequest );

            if( buttonResponse.Success )
            {
                var redirectUrl = buttonResponse.GetCheckoutUrl();
                //Redirect the user to the URL to complete the
                //the purchase
                Console.WriteLine( redirectUrl );
            }
            else
            {
                //Something went wrong. Check errors and fix any issues.
                Debug.WriteLine( string.Join( ",", buttonResponse.Errors ) );
            }

            var o = api.CreateOrder( buttonResponse );
            o.Should().NotBeNull();

            buttonResponse.Button.Code.Should().NotBeNullOrEmpty();

            buttonResponse.Button.Price.Cents.Should().Be( 7999 );

            buttonResponse.Success.Should().BeTrue();
            //http://www.bitarmory.com/cancel?order%5Bbutton%5D%5Bdescription%5D=Order+Description&order%5Bbutton%5D%5Bid%5D=ea607b144c6fc28ec289eea5acaaaf86&order%5Bbutton%5D%5Bname%5D=Order+Name&order%5Bbutton%5D%5Btype%5D=buy_now&order%5Bcreated_at%5D=2013-12-01+19%3A04%3A24+-0800&order%5Bcustom%5D=Custom_Order_Id&order%5Bid%5D=3LP5XUP7&order%5Breceive_address%5D=13uwaYfphxs51eN2DuhBJqimRJJ3UrYjSX&order%5Bstatus%5D=new&order%5Btotal_btc%5D%5Bcents%5D=7767029&order%5Btotal_btc%5D%5Bcurrency_iso%5D=BTC&order%5Btotal_native%5D%5Bcents%5D=7999&order%5Btotal_native%5D%5Bcurrency_iso%5D=USD&order%5Btransaction%5D=
            //http://www.bitarmory.com/cancel?
            //order[button][description]=Order Description
            //&order[button][id]=ea607b144c6fc28ec289eea5acaaaf86
            //&order[button][name]=Order Name
            //&order[button][type]=buy_now&order[created_at]=2013-12-01 19:04:24 -0800
            //&order[custom]=Custom_Order_Id
            //&order[id]=3LP5XUP7
            //&order[receive_address]=13uwaYfphxs51eN2DuhBJqimRJJ3UrYjSX
            //&order[status]=new&order[total_btc][cents]=7767029
            //&order[total_btc][currency_iso]=BTC
            //&order[total_native][cents]=7999
            //&order[total_native][currency_iso]=USD
            //&order[transaction]=
        }
        public void integration_test_create_button()
        {
            var api = new CoinbaseApi();

            var paymenRequest = new ButtonRequest
            {
                Name           = "Order Name",
                Currency       = Currency.USD,
                Price          = 79.99m,
                Type           = ButtonType.BuyNow,
                Custom         = "Custom_Order_Id",
                Description    = "Order Description",
                Style          = ButtonStyle.CustomLarge,
                CallbackUrl    = "http://www.bitarmory.com/callback",
                CancelUrl      = "http://www.bitarmory.com/cancel",
                InfoUrl        = "http://www.bitarmory.com/info",
                SuccessUrl     = "http://www.bitarmory.com/success",
                ChoosePrice    = false,
                IncludeAddress = false,
                IncludeEmail   = false,
                VariablePrice  = false
            };

            var buttonResponse = api.RegisterButton(paymenRequest);

            if (buttonResponse.Success)
            {
                var redirectUrl = buttonResponse.GetCheckoutUrl();
                //Redirect the user to the URL to complete the
                //the purchase
                Console.WriteLine(redirectUrl);
            }
            else
            {
                //Something went wrong. Check errors and fix any issues.
                Debug.WriteLine(string.Join(",", buttonResponse.Errors));
            }

            var o = api.CreateOrder(buttonResponse);

            o.Should().NotBeNull();

            buttonResponse.Button.Code.Should().NotBeNullOrEmpty();

            buttonResponse.Button.Price.Cents.Should().Be(7999);

            buttonResponse.Success.Should().BeTrue();
            //http://www.bitarmory.com/cancel?order%5Bbutton%5D%5Bdescription%5D=Order+Description&order%5Bbutton%5D%5Bid%5D=ea607b144c6fc28ec289eea5acaaaf86&order%5Bbutton%5D%5Bname%5D=Order+Name&order%5Bbutton%5D%5Btype%5D=buy_now&order%5Bcreated_at%5D=2013-12-01+19%3A04%3A24+-0800&order%5Bcustom%5D=Custom_Order_Id&order%5Bid%5D=3LP5XUP7&order%5Breceive_address%5D=13uwaYfphxs51eN2DuhBJqimRJJ3UrYjSX&order%5Bstatus%5D=new&order%5Btotal_btc%5D%5Bcents%5D=7767029&order%5Btotal_btc%5D%5Bcurrency_iso%5D=BTC&order%5Btotal_native%5D%5Bcents%5D=7999&order%5Btotal_native%5D%5Bcurrency_iso%5D=USD&order%5Btransaction%5D=
            //http://www.bitarmory.com/cancel?
            //order[button][description]=Order Description
            //&order[button][id]=ea607b144c6fc28ec289eea5acaaaf86
            //&order[button][name]=Order Name
            //&order[button][type]=buy_now&order[created_at]=2013-12-01 19:04:24 -0800
            //&order[custom]=Custom_Order_Id
            //&order[id]=3LP5XUP7
            //&order[receive_address]=13uwaYfphxs51eN2DuhBJqimRJJ3UrYjSX
            //&order[status]=new&order[total_btc][cents]=7767029
            //&order[total_btc][currency_iso]=BTC
            //&order[total_native][cents]=7999
            //&order[total_native][currency_iso]=USD
            //&order[transaction]=
        }
 public void ActivePlayerHUD(ButtonRequest req)
 {
     playerHUD.ShowSpecificButton(req);
 }