public void ThenAddToTheCartTheFirstProduct()
        {
            CartPageObject page          = new CartPageObject();
            string         AmountProduct = page.AmountProducts.Text;

            Console.WriteLine("Amount of products into the Cart: " + AmountProduct);
            string ExpectedText = "1 producto en tu carrito";

            SetUp.VAsserts(AmountProduct, ExpectedText);
        }
Beispiel #2
0
        private SetUp GetSetUp()
        {
            using (MPRContext entityContext = new MPRContext())
            {
                SetUp query = (from a in entityContext.SetUpSet
                               select a).FirstOrDefault();

                return(query);
            }
        }
        public void ThenValidateTheAmountOfProducts()
        {
            CartPageObject page2         = new CartPageObject();
            string         AmountProduct = page2.AmountProducts.Text;

            Console.WriteLine("Amount of products into the Cart: " + AmountProduct);
            string ExpectedText = "2 productos en tu carrito";

            SetUp.VAsserts(AmountProduct, ExpectedText);
            page2.BtnCarrito.Click();
        }
Beispiel #4
0
    public void InitSetUp()
    {
        SetUp tmpSetUp = setUp.GetComponent <SetUp>();

        tmpSetUp.mapParam     = selectedMap;
        tmpSetUp.setOfBulding = selectedBulding;
        tmpSetUp.setOfItem    = selectedItem;
        tmpSetUp.setOfNPC     = selectedNPC;
        tmpSetUp.setOfQuest   = selectedQuest;

        tmpSetUp.CreateAllConstraint();
    }
Beispiel #5
0
 public void ClickOnSetupMenu()
 {
     if (SetUp.Displayed)
     {
         SetUp.Click();
         Thread.Sleep(3000);
     }
     else
     {
         throw new Exception("Element is not found or not clickable");
     }
 }
Beispiel #6
0
 /// <summary>
 /// 设置
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SetupPanel_Click(object sender, EventArgs e)
 {
     if (SetUp.Function == false)
     {
         sp = new SetUp(md);
         sp.Show();
     }
     else
     {
         //获得焦点
         sp.Focus();
     }
 }
Beispiel #7
0
        public void InstructionWorksEndToEnd(SetUp setup, string input,
                                         string expectedOutput)
        {
            var model = new ProgrammingModel();
              var memory = new Memory();
              setup(model, memory);
              var repl = new Repl(model, memory);

              if (!repl.TryRead(input))
            Assert.Fail(string.Format("Unable to read assembly input: '{0}'", input));
              if (!repl.Execute())
            Assert.Fail(string.Format("Unable to execute input: '{0}'", input));
              Assert.That(repl.PrintRegisters(), Is.StringContaining(expectedOutput));
        }
        public InventoryUpdaterTests()
        {
            var setup = new SetUp();

            setup.Initialize();
            var context = setup.HolidayDbContext;

            _inventoryItemRepository     = new InventoryItemsRepository(context);
            _inventoryCategoryRepository = new InventoryCategoryRepository(context);
            _timeService = new TimeService();
            var _logger = new Mock <ILogger <BackgroundInventoryUpdater> >().Object;

            _backgroundInventoryUpdater = new BackgroundInventoryUpdater(_inventoryItemRepository, _inventoryCategoryRepository, _timeService, _logger);
        }
Beispiel #9
0
        public HttpResponseMessage GetSetUp(HttpRequestMessage request, int setUpId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                SetUp setUp = _IFRS9Service.GetSetUp(setUpId);

                // notice no need to create a seperate model object since SetUp entity will do just fine
                response = request.CreateResponse <SetUp>(HttpStatusCode.OK, setUp);

                return response;
            }));
        }
Beispiel #10
0
        /**
         * Running all test cases.
         */
        public void RunTestCases(TestReporter reporter)
        {
            TestResultEventHandler += ((o, e) => { reporter.report((TestResultEvent)e); });
            foreach (TestMethod m in TestCases)
            {
                m.TestResultEventHandler += ((o, e) => { reporter.report((TestResultEvent)e); });
            }

            foreach (TestMethod m in FrameworkTestMethods)
            {
                m.TestResultEventHandler += ((o, e) => { reporter.report((TestResultEvent)e); });
            }


            if (OneTimeSetUp != null && !OneTimeSetUp.run(null))
            {
                // if OneTimeSetUp fails mark all testcases as NOT_RUN
                foreach (TestMethod testCase in TestCases)
                {
                    TestResultEventHandler(this, new TestResultEvent(
                                               RESULT_TYPE.NO_RUN_FAILED_ONE_TIME_SETUP,
                                               testCase,
                                               null));
                }

                return;
            }

            foreach (TestMethod testCase in TestCases)
            {
                object testInstance = CreateTestInstance();
                if (SetUp != null)
                {
                    SetUp.run(testInstance);
                }
                testCase.run(testInstance);
                if (TearDown != null)
                {
                    TearDown.run(testInstance);
                }
            }
            if (OneTimeTearDown != null)
            {
                OneTimeTearDown.run(null);
            }
        }
Beispiel #11
0
        public static IHostBuilder CreateHostBuilder(string[] args)
        {
            // Init all classes here
            string ADMIN_NAME;
            string ADMIN_PASS;
            string INIT_FILE_PATH = null;

            if (args.Length < 2)//default
            {
                ADMIN_NAME = "ADMIN";
                ADMIN_PASS = "******";
                Console.WriteLine("Usage: dotnet build <username> <password>\n" +
                                  "Please specify Admin name and password next time");
            }
            else
            {
                ADMIN_NAME = args[0];
                ADMIN_PASS = args[1];
                if (args.Length >= 3)
                {
                    Console.WriteLine("using init operations file");
                    INIT_FILE_PATH = args[2];
                }
            }
            Console.WriteLine("Admin Username: {0}\n" +
                              "Admin Password: {1}", ADMIN_NAME, ADMIN_PASS);
            string setup_response = SetUp.Init(ADMIN_NAME, ADMIN_PASS, INIT_FILE_PATH, out NotificationManager notification,
                                               out PurchaseActions purchaseActions, out UserActions userActions, out StoreActions storeActions);

            Console.WriteLine(setup_response);
            if (setup_response.Contains("Invalid operations File"))
            {
                Console.WriteLine(String.Format("Invalid operations File, response from setup = {0}", setup_response));
                Environment.Exit(1);
            }
            Actions.SetUp(purchaseActions, userActions, storeActions, notification);

            return(Host.CreateDefaultBuilder(args)
                   .ConfigureWebHostDefaults(webBuilder =>
            {
                webBuilder.UseStartup <Startup>();
            }));
        }
Beispiel #12
0
        public void Test6()
        {
            SearchProductPageObject page1 = new SearchProductPageObject();

            page1.LinkDisplay.Click();
            page1.BtnAddtoCart.Click();
            CartPageObject page2         = new CartPageObject();
            string         AmountProduct = page2.AmountProducts.Text;

            Console.WriteLine("Amount of products into the Cart: " + AmountProduct);
            string ExpectedText = "2 productos en tu carrito";

            SetUp.VAsserts(AmountProduct, ExpectedText);
            page2.BtnCarrito.Click();
            CleanCartPageObject page = new CleanCartPageObject();

            page.DeleteDisplay.Click();
            page.BtnCarrito.Click();
            page.DeletePhone.Click();
        }
        public void ThenCompareThePrices()
        {
            SearchProductPageObject page = new SearchProductPageObject();
            string PriceSelected         = page.Price.Text;

            Console.WriteLine("Price Selected: " + PriceSelected);
            string WholeP = page.PriceFraction.Text;

            Console.WriteLine("Price Fraction: " + WholeP);
            WholePrice = "$" + PriceSelected + "." + WholeP;
            Console.WriteLine("Price Selected: " + WholePrice);
            page.ProductSelected.Click();
            string ActualPriceS = page.ActualPrice.Text;

            Console.WriteLine("Detail Price: " + ActualPriceS);
            SetUp.VAsserts(WholePrice, ActualPriceS);
            page.BtnAddtoCart.Click();
            String PriceCart1 = page.PriceCart.Text;

            Console.WriteLine("Price into the Cart: " + PriceCart1);
            SetUp.VAsserts(WholePrice, PriceCart1);
        }
Beispiel #14
0
        public HttpResponseMessage DeleteSetUp(HttpRequestMessage request, [FromBody] int setUpId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                SetUp setUp = _IFRS9Service.GetSetUp(setUpId);

                if (setUp != null)
                {
                    _IFRS9Service.DeleteSetUp(setUpId);

                    response = request.CreateResponse(HttpStatusCode.OK);
                }
                else
                {
                    response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No setUp found under that ID.");
                }

                return response;
            }));
        }
Beispiel #15
0
 // Use this for initialization
 void Start()
 {
     hand      = FindObjectOfType(typeof(movehand1)) as movehand1;
     phand     = FindObjectOfType(typeof(Playerhand)) as Playerhand;
     setup     = FindObjectOfType(typeof(SetUp)) as SetUp;
     p1winhole = GameObject.FindWithTag("Player1");
     p2winhole = GameObject.FindWithTag("Player2");
     hand1ani  = phand.GetComponent <Animator>();
     hand2ani  = hand.GetComponent <Animator> ();
     if (previoustag != 0)
     {
         GameObject prevhole = GameObject.FindGameObjectWithTag("points" + previoustag);
         prevhole.GetComponent <Renderer> ().enabled = false;
     }
     audioSource = UnityEngine.Object.FindObjectOfType <AudioSource>();
     if (PlayerPrefs.GetInt("MancalaSound", 1) == 1)
     {
         audioSource.UnPause();
     }
     else
     {
         audioSource.Pause();
     }
 }
Beispiel #16
0
        public FileServiceTests()
        {
            var setup = new SetUp();

            setup.Initialize();

            _context                 = setup.HolidayDbContext;
            _configuration           = setup.GetConfiguration();
            _azureStorageServiceMock = new Mock <IAzureStorageService>();
            ConfigureAzureStorageServiceMock();
            var timeServiceMock = new Mock <ITimeService>();

            timeServiceMock
            .Setup(s => s.GetCurrentTime())
            .Returns(new DateTime(2020, 7, 9, 6, 0, 0))
            ;

            _fileService = new FileService(
                new FileRepository(_context),
                _configuration,
                timeServiceMock.Object,
                _azureStorageServiceMock.Object
                );
        }
Beispiel #17
0
 void Start()
 {
     hand  = FindObjectOfType(typeof(movehand1)) as movehand1;
     phand = FindObjectOfType(typeof(Playerhand)) as Playerhand;
     setup = FindObjectOfType(typeof(SetUp)) as SetUp;
 }
Beispiel #18
0
        static void Main(string[] args)
        {
            string gameName = "Grace";

            SetUp.Init();
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.SFMLGraphics.Graphics>(); // need to more to text
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.SFMLInput.Input>();
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.StandardPhysics.Physics>();
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.SFMLSound.SFMLSoundManager>();
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.GraceGame.Core>();

            BlinkByte.Core.Managers.ModuleManager.instance.Init();

            Scene scene = new BlinkByte.Core.Scene();

            GameObject text = GameObject.InstansateNew("Text");

            text.AddComponent <BlinkByte.SFMLGraphics.SFMLTextComp>().SetText("Grace Game");
            scene.addGameObject(text);

            GameObject go = GameObject.InstansateNew("EnemySprite");

            go.AddComponent <BlinkByte.SFMLGraphics.SFMLSprite2DComp>().TextureName = "Enemy.png";
            go.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>();
            (go.getComponent <BlinkByte.Core.Component.Transform>() as BlinkByte.Core.Component.Transform).Position = new Vector2(250, 250);
            go.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(0, 0), new Vector2(64, 64));

            (go.getComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>() as BlinkByte.StandardPhysics.StanRidgedBodyComp).drag = 1;
            (go.getComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>() as BlinkByte.StandardPhysics.StanRidgedBodyComp).SetVelocity(new Vector2(0.1f, 0.2f));

            scene.addGameObject(go);


            GameObject sp = GameObject.InstansateNew("Sprite");

            sp.AddComponent <BlinkByte.SFMLGraphics.SFMLSprite2DComp>().TextureName = "Player.png";
            sp.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>();
            (sp.getComponent <BlinkByte.Core.Component.Transform>() as BlinkByte.Core.Component.Transform).Position = new Vector2(0, 400);
            sp.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(), new Vector2(64, 64));
            sp.AddComponent <BlinkByte.GraceGame.PurpleComp>();
            scene.addGameObject(sp);

            GameObject wallTop = GameObject.InstansateNew("Top Wall");

            wallTop.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>().startCollision = false;
            wallTop.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(0, -10), new Vector2(800, 0));
            scene.addGameObject(wallTop);

            GameObject wallLeft = GameObject.InstansateNew("Left Wall");

            wallLeft.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>().startCollision = false;
            wallLeft.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(-10, 0), new Vector2(0, 600));
            scene.addGameObject(wallLeft);

            GameObject wallRight = GameObject.InstansateNew("Right Wall");

            wallRight.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>().startCollision = false;
            wallRight.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(800, 0), new Vector2(810, 600));
            scene.addGameObject(wallRight);

            GameObject wallBottom = GameObject.InstansateNew("Bottom Wall");

            wallBottom.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>().startCollision = false;
            wallBottom.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(0, 600), new Vector2(800, 610));
            scene.addGameObject(wallBottom);

            scene.saveToFile(gameName + "/Scene");
            BlinkByte.Core.IO.LoadFromFile.saveModules(gameName + "/mods");
        }
Beispiel #19
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     lblError.Text = string.Empty;
     SetUp?.Invoke();
 }
Beispiel #20
0
        static void Main(string[] args)
        {
            string gameName = "James";


            SetUp.Init();
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.SFMLGraphics.Graphics>(); // need to more to text
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.SFMLInput.Input>();
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.StandardPhysics.Physics>();
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.SFMLSound.SFMLSoundManager>();
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.JamesGame.Core>();

            BlinkByte.Core.Managers.ModuleManager.instance.Init();

            Scene scene = new BlinkByte.Core.Scene();

            GameObject text = GameObject.InstansateNew("Text");

            text.AddComponent <BlinkByte.SFMLGraphics.SFMLTextComp>().SetText("James Game");
            scene.addGameObject(text);

            GameObject go = GameObject.InstansateNew("GameObject");

            (go.AddComponent <BlinkByte.SFMLGraphics.SFMLCircle2DComp>().changeColor(new BlinkByte.Graphics.Colour(255, 0, 0)) as BlinkByte.SFMLGraphics.SFMLCircle2DComp).radius = 50;
            (go.getComponent <BlinkByte.Core.Component.Transform>() as BlinkByte.Core.Component.Transform).Position = new Vector2(250, 250);
            go.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(0, 0), new Vector2(100, 100));
            go.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>().isTrigger = true;
            //go.AddComponent<BlinkByte.Physics.GravityComp>();
            scene.addGameObject(go);


            GameObject sp = GameObject.InstansateNew("Sprite");

            sp.AddComponent <BlinkByte.SFMLGraphics.SFMLSprite2DComp>().TextureName = "DinoTorq.png";
            sp.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>();
            (sp.getComponent <BlinkByte.Core.Component.Transform>() as BlinkByte.Core.Component.Transform).Position = new Vector2(0, 400);
            (sp.getComponent <BlinkByte.Core.Component.Transform>() as BlinkByte.Core.Component.Transform).Scale    = new Vector2(0.25f, 0.25f);
            sp.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(), new Vector2(75, 100));
            sp.AddComponent <BlinkByte.JamesGame.DinoComp>();
            scene.addGameObject(sp);

            GameObject wallTop = GameObject.InstansateNew("Top Wall");

            wallTop.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>().startCollision = false;
            wallTop.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(0, -10), new Vector2(800, 0));
            // scene.addGameObject(wallTop);

            GameObject wallLeft = GameObject.InstansateNew("Left Wall");

            wallLeft.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>().startCollision = false;
            wallLeft.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(-10, 0), new Vector2(0, 600));
            // scene.addGameObject(wallLeft);

            GameObject wallRight = GameObject.InstansateNew("Right Wall");

            wallRight.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>().startCollision = false;
            wallRight.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(800, 0), new Vector2(810, 600));
            // scene.addGameObject(wallRight);

            GameObject wallBottom = GameObject.InstansateNew("Bottom Wall");

            wallBottom.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>().startCollision = false;
            wallBottom.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(0, 600), new Vector2(800, 610));
            //scene.addGameObject(wallBottom);

            scene.saveToFile(gameName + "/Scene");
            BlinkByte.Core.IO.LoadFromFile.saveModules(gameName + "/mods");
        }
 private void SetUpSimulationButton_Click(object sender, EventArgs e)
 {
     SetUp?.Invoke();
 }
 protected void Edit(SetUp b)
 {
     context2.Entry(b).State = System.Data.Entity.EntityState.Modified;
 }
 protected void Add(SetUp b)
 {
     context2.SetUpSet.Add(b);
     context2.SaveChanges();
 }
Beispiel #24
0
 void Start()
 {
     setup = FindObjectOfType(typeof(SetUp)) as SetUp;
 }
        static void Main(string[] args)
        {
            // connects to a local database
            Services.Services._client   = new MongoClient("mongodb://127.0.0.1:27017/");
            Services.Services._database = Services.Services._client.GetDatabase("SocialNetworkDb");

            services.CreateCollections();    //comment this out after first run of the programme
            services.retrieveCollections();

            SetUp  setUp = new SetUp(services);
            string input = "0";

            // insert dummydata
            Console.WriteLine("Want to insert dummydata? press D (Press any button if don't wish to add dummy data)");
            Console.WriteLine("NOTE: if this is the first time running the program, its an good idea to insert dummyData");
            input = Console.ReadLine();
            switch (input)
            {
            case "D":
                setUp.seedData();
                Console.WriteLine("DummyData inserted!");
                input = "0";
                break;

            default:
                Console.WriteLine("DummyData not inserted!");
                input = "0";
                break;
            }
            //SetUp.SeedingData();           //comment this out after first run of the programme

            User Currentuser = new User();
            Wall wall        = new Wall(services);
            Feed feed        = new Feed(services);

            Console.WriteLine("WELCOME TO THE SOCIAL NETWORK");
            Currentuser = setUp.UserLogin();



            //string input = "0";

            while (true)
            {
                switch (input)
                {
                case "0":
                    InitMessage();
                    input = Console.ReadLine();
                    break;

                case "1":
                    CreatePostPrintout();
                    string postType = Console.ReadLine();
                    string postContent;
                    if (postType == "T")
                    {
                        Console.WriteLine("Please enter content for your post");
                        postContent = Console.ReadLine();
                        TextPost textPost = new TextPost()
                        {
                            CreationTime = DateTime.Now,
                            TextContent  = postContent,
                            Author       = Currentuser.UserName
                        };
                        setUp.PostOptions(Currentuser, textPost);
                    }
                    else if (postType == "V")
                    {
                        Console.WriteLine("Please enter Video title: ");
                        var       videoContent = Console.ReadLine();
                        string    videoInput   = "";
                        VideoPost videoPost    = new VideoPost()
                        {
                            CreationTime = DateTime.Now,
                            VideoContent = videoContent,
                            Options      = new Dictionary <string, int>(),
                            Author       = Currentuser.UserName
                        };

                        do
                        {
                            Console.WriteLine("--------------------------------------");
                            Console.WriteLine("|| 0  || Where to post               ||");
                            Console.WriteLine("|| 1  || Create Video                ||");
                            videoInput = Console.ReadLine();
                            if (videoInput == "1")
                            {
                                Console.WriteLine("------------------------------------------------------------------------------------------");
                                Console.WriteLine("||                       PLEASE ENTER VIDEO CONTENT                                       ||");
                                Console.WriteLine("------------------------------------------------------------------------------------------");
                                var content = Console.ReadLine();
                                videoPost.Options.Add(content, 0);
                            }
                        } while (videoInput != "0");
                        setUp.PostOptions(Currentuser, videoPost);
                        Console.WriteLine("-------------------------------------------------------------------------------------------");
                        Console.WriteLine("||                       THE VIDEO HAS BEEN POSTED SUCCESSFULLY!                         ||");
                        Console.WriteLine("-------------------------------------------------------------------------------------------");
                    }
                    input = "0";
                    break;

                case "2":
                    Console.WriteLine("Please enter a user to visit their wall:");
                    var userInput = Console.ReadLine();
                    var findUser  = services.GetUser().FirstOrDefault(u => userInput == u.UserName);
                    if (findUser == null)
                    {
                        Console.WriteLine("------------------------------------------------------------------------------------------");
                        Console.WriteLine("||                       WARNING: USER DOES NOT EXIST - PRESS ENTER TO CONTINUE         ||");
                        Console.WriteLine("------------------------------------------------------------------------------------------");
                        Console.ReadLine();
                        input = "0";
                        break;
                    }
                    var wallOfUser       = wall.GetWall(findUser.UserId, Currentuser.UserId);
                    int PostnumberOnWall = 1;
                    foreach (var post in wallOfUser)
                    {
                        Console.WriteLine($"------------------ PostNumber: {PostnumberOnWall++} ------------------------");
                        post.print();
                    }

                    Console.WriteLine("|| 0  || Enter to add a comment      ||");
                    if (wallOfUser.OfType <VideoPost>().Any())
                    {
                        Console.WriteLine("|| 1  || Enter to vote on meme   ||");
                    }
                    Console.WriteLine("|| Enter  || To continue             ||");
                    var commentWallChoice = Console.ReadLine();
                    if (commentWallChoice == "0")
                    {
                        var wallCommentNumber = 0;
                        do
                        {
                            Console.WriteLine("Please enter the number of the post you wish to comment on:");
                            wallCommentNumber = int.Parse(Console.ReadLine());
                            if (wallCommentNumber <= 5 && wallCommentNumber >= 1)
                            {
                                break;
                            }
                            warningMessageNumber_NotValid();
                        } while (true);

                        Console.WriteLine(wallOfUser[wallCommentNumber - 1].Author);
                        setUp.NewComment(wallOfUser[wallCommentNumber - 1]);
                    }
                    else if (commentWallChoice == "1")
                    {
                        var wallMemeNumber = 0;
                        do
                        {
                            Console.WriteLine("Please enter the number of the post you wish to vote on:");
                            wallMemeNumber = int.Parse(Console.ReadLine());
                            if (wallMemeNumber <= 5 && wallMemeNumber >= 1)
                            {
                                break;
                            }
                            if ((wallOfUser[wallMemeNumber - 1] is VideoPost))
                            {
                                break;
                            }
                            warningMessageNumber_NotValid();
                        } while (true);

                        Console.WriteLine("Choose the option to vote for: (Name of the option. Case sensitive)");
                        var WallMemeChoice = Console.ReadLine();
                        var post           = wallOfUser[wallMemeNumber - 1] as VideoPost;
                        post.Options[WallMemeChoice]++;
                        setUp.UpdatePosts(post);
                    }
                    input = "0";
                    break;

                case "3":
                    Console.WriteLine("------------------------------------------------------------------------------------------");
                    Console.WriteLine("||                       THIS IS YOUR FEED                                              ||");
                    Console.WriteLine("------------------------------------------------------------------------------------------");
                    var yourFeed         = feed.ShowFeed(Currentuser.UserId);
                    int postNumberInFeed = 1;
                    foreach (var post in yourFeed)
                    {
                        Console.WriteLine($"------------------ PostNumber: {postNumberInFeed++} ------------------------");
                        post.print();
                    }

                    Console.WriteLine("|| 0  || Enter to add a comment for one of the posts      ||");
                    if (yourFeed.OfType <VideoPost>().Any())
                    {
                        Console.WriteLine("|| 1  || Enter to vote on meme   ||");
                    }
                    Console.WriteLine("|| Enter  || To continue             ||");
                    var choosingComment = Console.ReadLine();
                    if (choosingComment == "0")
                    {
                        var numberCommentsOfFeed = 0;
                        do
                        {
                            Console.WriteLine("Please enter the number of post you wish to comment on: ");
                            numberCommentsOfFeed = int.Parse(Console.ReadLine());
                            if (numberCommentsOfFeed <= 5 && numberCommentsOfFeed >= 1)
                            {
                                break;
                            }

                            warningMessageNumber_NotValid();
                        } while (true);

                        setUp.NewComment(yourFeed[numberCommentsOfFeed - 1]);
                    }
                    else if (choosingComment == "1")
                    {
                        var feedMemeNumber = 0;
                        do
                        {
                            Console.WriteLine("Please enter the number of the post you wish to vote on: ");
                            feedMemeNumber = int.Parse(Console.ReadLine());
                            if (feedMemeNumber <= 5 && feedMemeNumber >= 1)
                            {
                                break;
                            }
                            if ((yourFeed[feedMemeNumber - 1] is VideoPost))
                            {
                                break;
                            }
                            warningMessageNumber_NotValid();
                        } while (true);

                        Console.WriteLine("Choose the option to vote for: (Name of the option. Case sensitive)");
                        var feedMemeChoice = Console.ReadLine();
                        var post           = yourFeed[feedMemeNumber - 1] as VideoPost;
                        post.Options[feedMemeChoice]++;
                        setUp.UpdatePosts(post);
                    }
                    input = "0";
                    break;

                case "4":
                    Console.WriteLine("Please enter a username you wish to add to your blocked list:");
                    var BlockedUser     = Console.ReadLine();
                    var findUserToBlock = services.GetUser().FirstOrDefault(u => BlockedUser == u.UserName);
                    if (findUserToBlock == null)
                    {
                        Console.WriteLine("------------------------------------------------------------------------------------------");
                        Console.WriteLine("||                           WARNING: USER DOES NOT EXIST!                              ||");
                        Console.WriteLine("------------------------------------------------------------------------------------------");
                        input = "0";
                        break;
                    }

                    if (Currentuser.BlockedList.Contains(findUserToBlock.UserId))
                    {
                        Currentuser.BlockedList.Add(findUserToBlock.UserId);
                        Console.WriteLine("------------------------------------------------------------------------------------------");
                        Console.WriteLine("||                        A USER HAS BEEN BLOCKED SUCCESSFULLY!                         ||");
                        Console.WriteLine("------------------------------------------------------------------------------------------");
                    }
                    else
                    {
                        Currentuser.BlockedList.Remove(findUserToBlock.UserId);
                        Console.WriteLine("------------------------------------------------------------------------------------------");
                        Console.WriteLine("||                        A USER HAS BEEN UNBLOCKED SUCCESSFULLY!                       ||");
                        Console.WriteLine("------------------------------------------------------------------------------------------");
                    }
                    services.UpdateUser(Currentuser.UserId, Currentuser);

                    input = "0";
                    break;

                case "5":
                    Console.WriteLine("Please enter the username you want to follow/unfollow: ");
                    var UserToFollow     = Console.ReadLine();
                    var findUserToFollow = services.GetUser().FirstOrDefault(u => UserToFollow == u.UserName);
                    if (findUserToFollow == null)
                    {
                        Console.WriteLine("\nUser does not exist");
                        input = "0";
                        break;
                    }

                    if (Currentuser.FriendList.Contains(findUserToFollow.UserId)) // hvis user findes i db vil den gå ind i if noget med circle
                    {
                        if (Currentuser.Circles == findUserToFollow.Circles)      // hvis der findes et circlename i currentusers circles, som også findes i findUsertoFollows circles
                        {
                            Currentuser.FriendList.Add(findUserToFollow.UserId);
                            Console.WriteLine("------------------------------------------------------------------------------------------");
                            Console.WriteLine("||                    A USER HAS BEEN ADDED TO YOUR FRIENDLIST SUCCESSFULLY!            ||");
                            Console.WriteLine("------------------------------------------------------------------------------------------");
                            break;
                        }
                        Currentuser.FriendList.Add(findUserToFollow.UserId);
                        Console.WriteLine("------------------------------------------------------------------------------------------");
                        Console.WriteLine("||                    A USER HAS BEEN ADDED TO YOUR FRIENDLIST SUCCESSFULLY!            ||");
                        Console.WriteLine("------------------------------------------------------------------------------------------");
                    }
                    else
                    {
                        Currentuser.FriendList.Remove(findUserToFollow.UserId);
                        Console.WriteLine("------------------------------------------------------------------------------------------");
                        Console.WriteLine("||                    A USER HAS BEEN REMOVED FROM YOUR FRIENDLIST SUCCESSFULLY!          ||");
                        Console.WriteLine("------------------------------------------------------------------------------------------");
                    }
                    //Currentuser.FriendList.Add(findUserToFollow.UserId);
                    services.UpdateUser(Currentuser.UserId, Currentuser);

                    input = "0";
                    break;

                case "6":
                    setUp.newUser();
                    break;

                case "7":
                    setUp.AddCircle(Currentuser);
                    input = "0";
                    break;

                case "8":
                    Currentuser = setUp.UserLogin();
                    input       = "0";
                    break;

                case "9":
                    return;

                default:
                    Console.WriteLine("------------------------------------------------------------------------------------------");
                    Console.WriteLine("||                         WARNING: WRONG COMMAND - PLEASE TRY AGAIN                    ||");
                    Console.WriteLine("------------------------------------------------------------------------------------------");
                    input = "0";
                    break;
                }
            }
        }
Beispiel #26
0
 private void button1_Click(object sender, EventArgs e)
 {
     SetUp?.Invoke();
 }
Beispiel #27
0
        //[ValidateAntiForgeryToken]
        public IActionResult ProcessDirectDebit([FromBody] SetUp model)
        {
            ////var _user = HttpContext.Session.Get<AuthenticateResponse>("ArmUser");
            var _user = new AuthenticateResponse
            {
                MembershipKey = 1006979,                   //1007435,
                EmailAddress  = "*****@*****.**", //"*****@*****.**",
                FirstName     = "Tolulope",
                LastName      = "Olusakin",
                FullName      = "Olusakin Tolulope S" //"Funmilayo Ruth Adeyemi",
                                                      //MembershipKey = 1007435,
                                                      //EmailAddress = "*****@*****.**",
                                                      //FirstName = "Funmilayo",
                                                      //LastName = "Adeyemi",
                                                      //FullName = "Funmilayo Ruth Adeyemi",
            };

            try
            {
                var decrypt = new SecureCredentials();

                string MacKey  = _configSettingManager.ArmMacKey;
                var    XmlData = string.Empty;

                if (ModelState.IsValid)
                {
                    var product   = model.ProductCode;
                    var amount    = Decimal.Parse(model.Amount) * 100;
                    var startdate = model.StartDate;
                    var frequency = model.Frequency;

                    if (amount <= 0)
                    {
                        return(StatusCode((int)HttpStatusCode.ExpectationFailed, "Invalid Transaction."));
                    }
                    else
                    {
                        XmlData = $@"<paymentitemxml>
                                       <payment_items> 
                                            <payment_item>
                                               <item_code>{product}</item_code>
                                               <item_amt>{amount}</item_amt>
                                            </payment_item>
                                       </payment_items>
                                   </paymentitemxml>";
                    }

                    var userdetails    = JsonConvert.SerializeObject(_user, Formatting.Indented);
                    var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(userdetails);
                    var userprofile    = System.Convert.ToBase64String(plainTextBytes);

                    var TransactionReference = _client.GenerateUniqueID(_user.MembershipKey);
                    var transactionDebit     = new DirectDebitTransactionModel
                    {
                        ArmVendorUserName = decrypt.DecryptCredentials(_configSettingManager.ArmServiceUsername),
                        ArmCustomerID     = _user.MembershipKey,
                        ArmCustomerName   = _user.FullName,
                        ArmDdAmt          = amount,
                        ArmStartDate      = startdate,
                        ArmFrequency      = frequency,
                        ArmDdNotiUrl      = string.Format("{0}://{1}{2}", Request.Scheme, Request.Host.ToUriComponent(), Request.PathBase.ToUriComponent()) + "/Client/Buy/DebitStatus?au=" + userprofile,
                        ArmPaymentParams  = TransactionReference,
                        ArmXmlData        = XmlData
                    };

                    var HashData = _client.DebitHashString(MacKey, transactionDebit);

                    var hashString = String.Concat(transactionDebit.ArmCustomerID, transactionDebit.ArmVendorUserName,
                                                   transactionDebit.ArmDdAmt, transactionDebit.ArmDdNotiUrl, MacKey);

                    var ArmHash = _client.GetHashString(hashString);
                    transactionDebit.ArmHash = ArmHash;

                    DirectDebitTransactions debit = new DirectDebitTransactions();
                    debit.Action            = _configSettingManager.ArmAggregatorBaseUrl + "/Aggregator/DirectDebit/";
                    debit.ArmVendorUsername = transactionDebit.ArmVendorUserName;
                    debit.ArmCustomerId     = transactionDebit.ArmCustomerID.ToString();
                    debit.ArmCustomerName   = transactionDebit.ArmCustomerName;
                    debit.ArmDdAmt          = transactionDebit.ArmDdAmt;
                    debit.ArmStartDate      = transactionDebit.ArmStartDate;
                    debit.ArmFrequency      = transactionDebit.ArmFrequency;
                    debit.ArmDdNotiUrl      = transactionDebit.ArmDdNotiUrl;
                    debit.ArmPaymentParams  = transactionDebit.ArmPaymentParams;
                    debit.ArmXmlData        = transactionDebit.ArmXmlData;
                    debit.ArmHash           = transactionDebit.ArmHash;

                    db.DirectDebitTransactions.Add(debit);
                    db.SaveChanges();

                    return(Json(debit));
                }
            }
            catch (Exception ex)
            {
                TempData["message"] = ViewBag.Message = ex.Message;
                Utilities.ProcessError(ex, _contentRootPath);
                _logger.LogError(null, ex, ex.Message);
            }
            return(View());
        }
Beispiel #28
0
 private void btn_SetUp_Click(object sender, EventArgs e)
 {
     SetUp?.Invoke();
 }
Beispiel #29
0
 private void btn_SetUp_Click(object sender, EventArgs e)
 {
     lbl_Error.Text = "";
     SetUp?.Invoke();
 }
Beispiel #30
0
        static void Main(string[] args)
        {
            string gameName = "Lewis";


            SetUp.Init();
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.SFMLGraphics.Graphics>(); // need to more to text
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.SFMLInput.Input>();
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.StandardPhysics.Physics>();
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.SFMLSound.SFMLSoundManager>();
            BlinkByte.Core.Managers.ModuleManager.instance.AddManager <BlinkByte.LewisGame.Core>();



            //BlinkByte.Core.IO.LoadFromFile.LoadModules("mods");

            BlinkByte.Core.Managers.ModuleManager.instance.Init();

            Scene scene = new BlinkByte.Core.Scene();

            ///GameObject text = GameObject.InstansateNew("Text");
            //  text.AddComponent<BlinkByte.SFMLGraphics.SFMLTextComp>().SetText("YAY");
            //  scene.addGameObject(text);

            GameObject go = GameObject.InstansateNew("GameObject");

            (go.AddComponent <BlinkByte.SFMLGraphics.SFMLCircle2DComp>().changeColor(new BlinkByte.Graphics.Colour(255, 0, 0)) as BlinkByte.SFMLGraphics.SFMLCircle2DComp).radius = 50;
            (go.getComponent <BlinkByte.Core.Component.Transform>() as BlinkByte.Core.Component.Transform).Position = new Vector2(250, 250);
            go.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(0, 0), new Vector2(100, 100));

            go.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>();
            go.AddComponent <BlinkByte.LewisGame.GameComp>();


            scene.addGameObject(go);

            GameObject bm = GameObject.InstansateNew("background");

            bm.AddComponent <BlinkByte.SFMLSound.SFMLSoundComp>().setFileName("Audios/toot.wav");
            (bm.AddComponent <BlinkByte.SFMLGraphics.SFMLCircle2DComp>().changeColor(new BlinkByte.Graphics.Colour(0, 255, 0)) as BlinkByte.SFMLGraphics.SFMLCircle2DComp).radius = 50;
            (bm.getComponent <BlinkByte.Core.Component.Transform>() as BlinkByte.Core.Component.Transform).Position = new Vector2(50, 50);
            bm.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(0, 0), new Vector2(100, 100));
            bm.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>();
            scene.addGameObject(bm);

            GameObject bc = GameObject.InstansateNew("ballcolour");

            (bc.AddComponent <BlinkByte.SFMLGraphics.SFMLCircle2DComp>().changeColor(new BlinkByte.Graphics.Colour(0, 125, 125)) as BlinkByte.SFMLGraphics.SFMLCircle2DComp).radius = 50;
            (bc.getComponent <BlinkByte.Core.Component.Transform>() as BlinkByte.Core.Component.Transform).Position = new Vector2(550, 50);
            bc.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(0, 0), new Vector2(100, 100));
            bc.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>();


            scene.addGameObject(bc);
            ;

            GameObject wallTop = GameObject.InstansateNew("Top Wall");

            wallTop.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>().startCollision = false;
            wallTop.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(0, -10), new Vector2(800, 0));
            scene.addGameObject(wallTop);

            GameObject wallLeft = GameObject.InstansateNew("Left Wall");

            wallLeft.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>().startCollision = false;
            wallLeft.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(-10, 0), new Vector2(0, 600));
            scene.addGameObject(wallLeft);

            GameObject wallRight = GameObject.InstansateNew("Right Wall");

            wallRight.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>().startCollision = false;
            wallRight.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(800, 0), new Vector2(800, 600));
            scene.addGameObject(wallRight);

            GameObject wallBottom = GameObject.InstansateNew("Bottom Wall");

            wallBottom.AddComponent <BlinkByte.StandardPhysics.StanRidgedBodyComp>().startCollision = false;
            wallBottom.AddComponent <BlinkByte.StandardPhysics.StanBoundingBox>().SetMinMax(new Vector2(0, 600), new Vector2(800, 600));
            scene.addGameObject(wallBottom);

            scene.saveToFile(gameName + "/Scene");
            BlinkByte.Core.IO.LoadFromFile.saveModules(gameName + "/mods");
        }