Exemple #1
0
 public Engine()
 {
     this.managerController = new ManagerController();
     this.writer            = new Writer();
     this.reader            = new Reader();
 }
Exemple #2
0
 // Use this for initialization
 void Start()
 {
     managerControllerScript = manager.GetComponent <ManagerController>();
     timeStopped             = true;
     choreTime = baseChoreTime;
 }
Exemple #3
0
 private void Awake()
 {
     instance = this;
     state    = "idle";
 }
Exemple #4
0
 public Engine()
 {
     reader            = new Reader();
     writer            = new Writer();
     managerController = new ManagerController();
 }
 public SetupHelperForm(ManagerController managerController, ManagerMainForm managerMainForm)
 {
     InitializeComponent();
     _managerController = managerController;
     _managerMainForm   = managerMainForm;
 }
Exemple #6
0
 private void Start()
 {
     managerControllerScript = manager.GetComponent <ManagerController>();
     soundEffectSource.clip  = buttonPushedSound;
 }
        public async Task Index_Get()
        {
            var returnUrlPath  = "/index";
            var returnUrlQuery = "?indexquery=indexquery";
            var returnUrl      = returnUrlPath + returnUrlQuery;

            var context = MakeContext(returnUrlPath, returnUrlQuery);

            ActivityType?filterType     = ActivityType.PostCreated;
            DateTime?    filterFrom     = DateTime.Today;
            DateTime?    filterTo       = filterFrom.Value.AddMinutes(75);
            long?        filterPostId   = context.Mail[0].Id;
            long?        filterBranchId = context.Branches[0].Id;
            long?        filterCarId    = context.Cars[0].Id;
            var          options        = new ListOptions
            {
                Filters = new Dictionary <string, string>
                {
                    { "type", filterType.Value.ToString() },
                    { "message", "1" },
                    { "from", filterFrom.Value.ToString("g") },
                    { "to", filterTo.Value.ToString("g") },
                    { "user", "2" },
                    { "postId", filterPostId.Value.ToString() },
                    { "branchId", filterBranchId.Value.ToString() },
                    { "carId", filterCarId.Value.ToString() }
                }
            };
            var random = new Random();

            for (int i = 0; i < 100; ++i)
            {
                context.Activities.Add(new Activity
                {
                    Id       = i,
                    Type     = (ActivityType)(random.Next() % (int)(ActivityType.PostDelivered + 1)),
                    Message  = "message" + random.Next(),
                    DateTime = filterFrom.Value.AddMinutes(random.Next() % 100),
                    User     = "******" + random.Next(),
                    PostId   = random.Next() % context.Mail.Count(),
                    BranchId = random.Next() % context.Branches.Count(),
                    CarId    = random.Next() % context.Cars.Count(),
                });
            }

            var controller = new ManagerController(
                context.ActivitiesDao,
                context.BranchesDao,
                context.CarsDao)
            {
                ControllerContext = context.ControllerContext
            };

            var r = await controller.Index(options) as ViewResult;

            Assert.NotNull(r);
            Assert.Null(r.ViewName);
            var vm = r.Model as IndexViewModel;

            Assert.NotNull(vm);
            var expectedActivities = context.Activities
                                     .Where(a => a.Type == filterType.Value)
                                     .Where(a => a.Message.Contains(options.Filters["message"]))
                                     .Where(a => a.DateTime >= filterFrom.Value)
                                     .Where(a => a.DateTime <= filterTo.Value)
                                     .Where(a => a.User.Contains(options.Filters["user"]))
                                     .Where(a => a.PostId == filterPostId.Value)
                                     .Where(a => a.BranchId == filterBranchId.Value)
                                     .Where(a => a.CarId == filterCarId.Value)
                                     .OrderByDescending((a) => a.DateTime)
                                     .ToPaginatedList(options.Page, ManagerController.PageSize);

            Assert.Same(Activity.AllTypes, vm.AllActivityTypes);
            Assert.Same(context.Branches, vm.AllBranches);
            Assert.Same(context.Cars, vm.AllCars);
            Assert.Equal(expectedActivities, vm.Activities);
            Assert.Same(options, vm.CurrentListOptions);
            Assert.Equal(returnUrl, vm.ReturnUrl);
        }
Exemple #8
0
 public void Initialize()
 {
     controller = new ManagerController();
 }
Exemple #9
0
 private void Start()
 {
     gameObject.SetActive(false);
     managerControllerScript = manager.GetComponent <ManagerController>();
 }
Exemple #10
0
 private void Awake()
 {
     Init();
     Instance = this;
 }
Exemple #11
0
 public void SetManagerController(ManagerController managerController)
 {
     _managerController = managerController;
 }
Exemple #12
0
 // Use this for initialization
 void Start()
 {
     gameObject.SetActive(true);
     managerControllerScript = manager.GetComponent <ManagerController>();
     soundSource.clip        = dishSound;
 }
Exemple #13
0
 public ClientManager(ManagerController mc) : base(mc)
 {
 }
Exemple #14
0
        static void Main(string[] args)
        {
            ManagerController manager = ManagerController.Instance;

            manager.Init();


            //game loop
            Console.WriteLine("Welcome to the console-tastic version of War, the classic card game.");
            bool isContinuing = true;

            while (isContinuing == true)
            {
                Console.WriteLine("To play a game, type 's' and then enter.  To play a game in fast mode, type 'f' and then enter.");
                char controlChar = '0';
                while (controlChar != ' ')
                {
                    try
                    {
                        controlChar = Console.ReadLine().ToLower()[0];
                    }
                    catch (Exception ex)
                    {
                        controlChar = '0';
                    }
                    if (controlChar == 's')
                    {
                        //play regular game, where the control draws a card with the space key and check their own stats
                        manager.PlayGame();
                        break;
                    }
                    else if (controlChar == 'f')
                    {
                        //play the game in turbo mode, and see how fast C#'s Console.WriteLine() works
                        manager.PlayGameTurbo();
                        break;
                    }
                    else
                    {
                        Console.WriteLine("I couldn't understand that command.");
                    }
                }
                Console.WriteLine("Would you like to play again? Type 'Y' for another game.");
                try
                {
                    controlChar = Console.ReadLine().ToLower()[0];
                }
                catch (Exception ex)
                {
                    controlChar = '0';
                }
                if (controlChar == 'y')
                {
                    isContinuing = true;
                }
                else
                {
                    Console.WriteLine("Good bye!");
                    isContinuing = false;
                }
            }
        }
 public ManagerDashboard()
 {
     InitializeComponent();
     gridManagers.DataSource = ManagerController.GetAllManagers();
 }
        public void GetAllManager_ShouldReturnAllManagers()
        {
            var managerController = new ManagerController();

            IEnumerable <Employee> managers = managerController.GetAllManagers();
        }
Exemple #17
0
 // Use this for initialization
 void Start()
 {
     vacuumChoreScript       = vacuumChoreObject.GetComponent <VacuumingChore>();
     managerControllerScript = manager.GetComponent <ManagerController>();
 }
Exemple #18
0
        private void FillDataToTheDataBase()
        {
            #region Make bar
            BarController     bc      = new BarController();
            ManagerController mc      = new ManagerController();
            Manager           manager = new Manager("TestName", "TestPhonenumber", "TestEmail", "TestUsername", null);
            Manager           m       = mc.CreateManager(manager, "TestPassword");

            Country country = LocationDB.Instance.getCountryById(1);
            if (country is null)
            {
                Assert.Fail("Country is null");
            }
            Zipcode zip = LocationDB.Instance.findZipById(1);
            Address a   = new Address("TestVej", zip);
            zip.Country = country;
            a.Zipcode   = zip;

            Bar bar = new Bar
            {
                Address     = a,
                Email       = "TestBarEmail",
                Name        = "TestBarName",
                PhoneNumber = "TestBarP",
                Username    = "******"
            };
            this.bar = bc.Create(bar, m.Id, "TestPassword");
            #endregion

            IngredientController ingredientController = new IngredientController();

            List <Drink> drinks = new List <Drink>();


            Ingredient vodka = new Ingredient
            {
                Name       = "TestVodka",
                Measurable = true,
                Alch       = 37.5
            };

            Ingredient juice = new Ingredient
            {
                Name       = "TestJuice",
                Measurable = true,
                Alch       = 0
            };

            TestVodkaIngre = ingredientController.Create(vodka);
            TestJuiceIngre = ingredientController.Create(juice);


            quantifiedIngredientVodka = new QuantifiedIngredient
            {
                Quantity    = 6,
                Ingredient  = ingredientController.Find("TestVodka").First(), //We would like it to throw an exception here, as it's a test
                Measurement = ingredientController.FindMeasurement("cl")
            };

            quantifiedIngredientJuice = new QuantifiedIngredient
            {
                Quantity    = 2,
                Ingredient  = ingredientController.Find("TestJuice").First(), //We would like it to throw an exception here, as it's a test
                Measurement = ingredientController.FindMeasurement("cl")
            };

            Drink drinkVodkaJuice = new Drink
            {
                Recipe = "TestVodkaJuiceRecipe",
                Names  = new List <string>()
                {
                    "TestName1", "TestName2"
                },
                Ingredients = new List <QuantifiedIngredient>()
                {
                    quantifiedIngredientJuice, quantifiedIngredientVodka
                }
            };

            Drink drinkVodka = new Drink
            {
                Recipe = "TestVodkaRecipe",
                Names  = new List <string>()
                {
                    "TestNameVodka"
                },
                Ingredients = new List <QuantifiedIngredient>()
                {
                    quantifiedIngredientVodka
                }
            };

            Drink drinkJuice = new Drink
            {
                Recipe = "TestJuiceRecipe",
                Id     = 3,
                Names  = new List <string>()
                {
                    "TestJuice", "TestAppelsinjuice"
                },
                Ingredients = new List <QuantifiedIngredient>()
                {
                    quantifiedIngredientJuice
                }
            };

            TestVodka      = controller.Create(drinkVodka);
            TestJuice      = controller.Create(drinkJuice);
            TestVodkaJuice = controller.Create(drinkVodkaJuice);
        }
Exemple #19
0
 private void Start()
 {
     managerControllerScript = manager.GetComponent <ManagerController>();
     sweepChoreScript        = sweepChoreObject.GetComponent <SweepChore>();
     sweepSwipe = 0;
 }
Exemple #20
0
        public void Get_Should_Return_All_Manager_Count()
        {
            var actual = new ManagerController().GetAllManagers().Count;

            Assert.Equal(2, actual);
        }
Exemple #21
0
 void Awake()
 {
     player             = GameObject.FindGameObjectWithTag("Player");
     _managerController = player.GetComponent <ManagerController>();
 }
Exemple #22
0
 private void Start()
 {
     managerControllerScript = manager.GetComponent <ManagerController>();
 }
Exemple #23
0
 public RequestManager(ManagerController mc) : base(mc)
 {
 }
Exemple #24
0
        public void barCreateStock()
        {
            IngredientController ingredientController = new IngredientController();
            DrinkController      drinkController      = new DrinkController();
            //setup
            Ingredient vodka = new Ingredient
            {
                Name       = "TestVodka",
                Measurable = true,
                Alch       = 37.5
            };

            Ingredient juice = new Ingredient
            {
                Name       = "TestJuice",
                Measurable = false,
                Alch       = 0
            };

            vodka = ingredientController.Create(vodka);
            juice = ingredientController.Create(juice);

            ManagerController mc      = new ManagerController();
            Manager           manager = new Manager("TestName", "TestPhonenumber", "TestEmail", "TestUsername", null);
            Manager           m       = mc.CreateManager(manager, "TestPassword");

            Country country = LocationDB.Instance.getCountryById(1);

            if (country is null)
            {
                Assert.Fail("Country is null");
            }
            Zipcode zip = LocationDB.Instance.findZipById(1);
            Address a   = new Address("TestVej", zip);

            zip.Country = country;
            a.Zipcode   = zip;
            Bar bar = new Bar
            {
                Address     = a,
                Email       = "TestBarEmail",
                Name        = "TestBarName",
                PhoneNumber = "TestBarP",
                Username    = "******"
            };
            Bar Createdbar = controller.Create(bar, m.Id, "TestPassword");

            ICollection <Measurement> measurements = new DrinkController().FindAllMeasurements();
            var allStocks          = controller.GetAllStocks(bar.ID);
            int precount           = allStocks.Count;
            int preVodkaStockCount = allStocks.Where(e => e.Ingredient.Equals(vodka)).Count();
            int preJuiceStockCount = allStocks.Where(e => e.Ingredient.Equals(juice)).Count();

            //act
            controller.CreateStock(Createdbar.ID, 20, vodka, measurements.FirstOrDefault().Id);

            preVodkaStockCount++;   //Just creted one vodka. so we increment
            precount++;             // Just created one more stock in the DB so we increment

            controller.CreateStock(Createdbar.ID, 20, juice, null);
            precount++;           //Just created one juice, so we increment
            preJuiceStockCount++; // Just craeted one juice so we increment

            List <Stock> stocksFound = controller.GetAllStocks(bar.ID);
            //assert
            bool success = (stocksFound.Where(e => e.Ingredient.Equals(vodka))).Count() == preVodkaStockCount &&
                           stocksFound.Count() == precount;


            Assert.IsTrue(success, "Stock measurable was not created successfully");
            int actual = stocksFound.Where(e => e.Ingredient.Equals(juice)).Count();


            success = (actual == preJuiceStockCount && stocksFound.Count() == precount);

            Assert.IsTrue(success, "Stock not mreasurable was not created successfully");
        }
Exemple #25
0
    void generateToken()
    {
        GameObject        manager            = GameObject.Find("Manager");
        ManagerController tokenManagerScript = manager.GetComponent <ManagerController>();

        int i       = 0;
        int counter = 0;

        while (spawnToken == null)
        {
            i = Random.Range(2, 13);
            if (i == 2 && tokenManagerScript.two < 1)
            {
                spawnToken = tokenTwo;
                tokenManagerScript.two++;
            }
            if (i == 3 && tokenManagerScript.three < 2)
            {
                spawnToken = tokenThree;
                tokenManagerScript.three++;
            }
            if (i == 4 && tokenManagerScript.four < 2)
            {
                spawnToken = tokenFour;
                tokenManagerScript.four++;
            }
            if (i == 5 && tokenManagerScript.five < 2)
            {
                spawnToken = tokenFive;
                tokenManagerScript.five++;
            }
            if (i == 6 && tokenManagerScript.six < 2)
            {
                spawnToken = tokenSix;
                tokenManagerScript.six++;
            }
            if (i == 8 && tokenManagerScript.eight < 2)
            {
                spawnToken = tokenEight;
                tokenManagerScript.eight++;
            }
            if (i == 9 && tokenManagerScript.nine < 2)
            {
                spawnToken = tokenNine;
                tokenManagerScript.nine++;
            }
            if (i == 10 && tokenManagerScript.ten < 2)
            {
                spawnToken = tokenTen;
                tokenManagerScript.ten++;
            }
            if (i == 11 && tokenManagerScript.eleven < 2)
            {
                spawnToken = tokenEleven;
                tokenManagerScript.eleven++;
            }
            if (i == 12 && tokenManagerScript.twelve < 1)
            {
                spawnToken = tokenTwelve;
                tokenManagerScript.twelve++;
            }
            if (counter >= 50)
            {
                Debug.Log("There was a problem placing a token.");
                break;
            }
            else
            {
                counter++;
            }
        }
        Instantiate(spawnToken, transform.position, transform.rotation);
        Destroy(gameObject);
    }
        public void Run()
        {
            IManagerController managerController = new ManagerController();

            while (true)
            {
                string data = Console.ReadLine();

                if (data == "Exit")
                {
                    break;
                }

                var    cmdData = data.Split(" ", StringSplitOptions.RemoveEmptyEntries);
                string cmd     = cmdData[0];

                try
                {
                    switch (cmd)
                    {
                    case "AddPlayer":
                    {
                        string playerType     = cmdData[1];
                        string playerUsername = cmdData[2];
                        Console.WriteLine(managerController.AddPlayer(playerType, playerUsername));
                        break;
                    }

                    case "AddCard":
                    {
                        string cardType = cmdData[1];
                        string cardName = cmdData[2];
                        Console.WriteLine(managerController.AddCard(cardType, cardName));
                        break;
                    }

                    case "AddPlayerCard":
                    {
                        string username = cmdData[1];
                        string cardName = cmdData[2];
                        Console.WriteLine(managerController.AddPlayerCard(username, cardName));
                        break;
                    }

                    case "Fight":
                    {
                        string attackUser = cmdData[1];
                        string enemy      = cmdData[2];
                        Console.WriteLine(managerController.Fight(attackUser, enemy));
                        break;
                    }

                    case "Report":
                    {
                        Console.WriteLine(managerController.Report());
                        break;
                    }

                    default:
                        break;
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Exemple #27
0
 // Use this for initialization
 void Start()
 {
     managerControllerScript = manager.GetComponent <ManagerController>();
     savingManagerScript     = savingManager.GetComponent <SavingManager>();
 }