示例#1
0
        public void Start()
        {
            do
            {
                Cart            cart = cartServices.GetCartByCustId(customer.Id);
                List <CartItem> ci   = cartItemServices.GetAllCartItemsByCartId(cart.Id);
                Console.WriteLine("These are the items in your cart");
                foreach (CartItem item in ci)
                {
                    Sticks stick = productServices.GetProductByStickId(item.stickId);
                    Console.WriteLine($"{stick.description} \t${stick.Price}");
                }
                Console.WriteLine("Welcome to check out! If there is anything you forget go back otherwise proceed to checkout. Thank you for Shopping with us.");
                Console.WriteLine("[0] Back \n[2] Checkout");
                custInput = Console.ReadLine();
                switch (custInput)
                {
                case "0":
                    break;

                case "2":
                    CheckOutItems();
                    break;

                default:
                    ValidInvalidServices.InvalidInput();
                    break;
                }
            } while (!(custInput.Equals("0")));
        }
示例#2
0
        public void CheckOutItems()
        {
            Cart            cart  = cartServices.GetCartByCustId(customer.Id);
            List <CartItem> items = cartItemServices.GetAllCartItemsByCartId(cart.Id);
            Orders          order = new Orders();
            double          total = 0;

            order.CustomersId = customer.Id;
            order.LocationId  = customer.LocationId;
            DateTime dateOfOrder = order.dateOfOrder = DateTime.Now;

            orderServices.AddOrder(order);
            Orders orderToProcess = orderServices.GetOrderByDate(dateOfOrder);

            Console.WriteLine("You imaginary order has been placed. You will revieve it never. \n");
            foreach (CartItem item in items)
            {
                lineItem lineItem = new lineItem();
                Sticks   stick    = productServices.GetProductByStickId(item.stickId);
                lineItem.orderId  = orderToProcess.Id;
                lineItem.stickId  = item.stickId;
                lineItem.price    = stick.Price;
                lineItem.quantity = item.quantity;
                total            += (stick.Price * item.quantity);
                lineItemServices.AddLineItem(lineItem);
                cartItemServices.DeleteCartItem(item);
                Inventory inventory = inventoryServices.GetItemByLocIdStickId(customer.LocationId, stick.Id);
                inventory.quantity -= item.quantity;
            }
            order.TotalPrice = total;
            orderServices.UpdateOrder(orderToProcess);
            Console.WriteLine($"\nYour total was: ${order.TotalPrice}");
        }
示例#3
0
        public static Vector2 Axis(Sticks device)
        {
            var current = (int)device;

            return(new Vector2(
                       Input.GetJoyAxis(current, (int)JoystickList.Axis0),
                       Input.GetJoyAxis(current, (int)JoystickList.Axis1)
                       ));
        }
示例#4
0
        public override void OnUpdate()
        {
            Sticks  sticks     = Gamepad.GetSticks(Player.First);
            Vector2 moveVec    = new Vector2((int)(objInitialSpeed * sticks.LeftStickAxisX), (int)(objInitialSpeed * sticks.LeftStickAxisY * -1));
            Vector2 moveCamVec = new Vector2((int)(objInitialSpeed * sticks.LeftStickAxisX * -1), (int)(objInitialSpeed * sticks.LeftStickAxisY));

            cameraBinded.Transform.Move(moveVec);
            scene1.Camera.MoveCamera(moveCamVec);
        }
示例#5
0
 public IActionResult DeleteStick(Sticks stick)
 {
     try
     {
         productServices.DeleteStick(stick);
         return(Ok());
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
示例#6
0
 public IActionResult UpdateStick(Sticks stick)
 {
     try
     {
         productServices.UpdateStick(stick);
         return(CreatedAtAction("UpdateStick", stick));
     }
     catch (Exception)
     {
         return(BadRequest());
     }
 }
示例#7
0
        public void Generate(int number)
        {
            ObservableCollection <Sticks> tempo      = new ObservableCollection <Sticks>();
            ObservableCollection <Sticks> alphatempo = new ObservableCollection <Sticks>();
            ObservableCollection <Sticks> betatempo  = new ObservableCollection <Sticks>();

            first.Clear();
            third.Clear();
            second.Clear();
            ALPHAfirst.Clear();
            ALPHAsecond.Clear();
            ALPHAthird.Clear();
            BETAfirst.Clear();
            BETAsecond.Clear();
            BETAthird.Clear();
            Procedure.Clear();
            BackProcedure.Clear();
            Steps = "";
            if (pegname == "A" || pegname == "a")
            {
                pegname    = "A";
                tempo      = first;
                alphatempo = ALPHAfirst;
                betatempo  = BETAfirst;
            }
            if (pegname == "B" || pegname == "b")
            {
                pegname = "B";

                tempo      = second;
                alphatempo = ALPHAsecond;
                betatempo  = BETAsecond;
            }
            if (pegname == "C" || pegname == "c")
            {
                pegname = "C";

                tempo      = third;
                alphatempo = ALPHAthird;
                betatempo  = BETAthird;
            }
            for (int i = number; i > 0; i--)
            {
                var b = new Sticks(i.ToString());
                tempo.Insert(0, new Sticks(i.ToString()));
                alphatempo.Insert(0, new Sticks(i.ToString()));
                betatempo.Insert(0, new Sticks(i.ToString()));
            }
            StepByStepFlag = false;
        }
示例#8
0
 public ProductDetails2(Customer customer, Sticks stick, lacrosseContext context, ICustomerRepo customerRepo, IInventoryRepo inventoryRepo, IProductRepo productRepo, ICartRepo cartRepo, ICartItemsRepo cartItemsRepo)
 {
     this.customer          = customer;
     this.stick             = stick;
     this.customerRepo      = customerRepo;
     this.productRepo       = productRepo;
     this.cartRepo          = cartRepo;
     this.cartItemsRepo     = cartItemsRepo;
     this.inventoryRepo     = inventoryRepo;
     this.customerServices  = new CustomerServices(customerRepo);
     this.inventoryServices = new InventoryServices(inventoryRepo);
     this.productServices   = new ProductServices(productRepo);
     this.cartServices      = new CartServices(cartRepo);
     this.cartItemServices  = new CartItemServices(cartItemsRepo);
 }
        public override void ParseXml(XmlParser xp, string path)
        {
            base.ParseXml(xp, path);

            string s = xp.GetString(path + "->Stick", Stick.ToString());
            if (s == "Left")
            {
                Stick = Sticks.Left;
            }
            else if (s == "Right")
            {
                Stick = Sticks.Right;
            }

            PlayerIndex = (PlayerIndex)xp.GetInt(path + "->PlayerIndex", (int)PlayerIndex);
        }
示例#10
0
        public override void ParseXml(XmlParser xp, string path)
        {
            base.ParseXml(xp, path);

            string s = xp.GetString(path + "->Stick", Stick.ToString());

            if (s == "Left")
            {
                Stick = Sticks.Left;
            }
            else if (s == "Right")
            {
                Stick = Sticks.Right;
            }

            PlayerIndex = (PlayerIndex)xp.GetInt(path + "->PlayerIndex", (int)PlayerIndex);
        }
示例#11
0
        static int[] EnumToArray(Sticks sticks)
        {
            sticks = ValidateSticks((int)sticks);
            switch (sticks)
            {
            case Sticks.A:
                return(stickA);

            case Sticks.B:
                return(stickB);

            case Sticks.C:
                return(stickC);

            default:
                return(new int[0]);
            }
        }
        public void Start()
        {
            do
            {
                Console.WriteLine("Select From Our Lacrosse Sticks Below: ");
                List <Inventory> items = GetProductsForCustomerLocation();
                Console.WriteLine("[0] Exit");
                foreach (Inventory item in items)
                {
                    Sticks product = productServices.GetProductByStickId(item.stickId);
                    Console.WriteLine($"[{product.Id}]: {product.description}, ${product.Price}, remaining: {item.quantity}");
                }

                custInput = Console.ReadLine();
                switch (custInput)
                {
                case "0":
                    break;

                case "1":
                    sticks          = productServices.GetProductByStickId(1);
                    productDetails2 = new ProductDetails2(customer, sticks, context, new DBRepo(context), new DBRepo(context), new DBRepo(context), new DBRepo(context), new DBRepo(context));
                    productDetails2.Start();
                    break;

                case "2":
                    sticks          = productServices.GetProductByStickId(2);
                    productDetails2 = new ProductDetails2(customer, sticks, context, new DBRepo(context), new DBRepo(context), new DBRepo(context), new DBRepo(context), new DBRepo(context));
                    productDetails2.Start();
                    break;

                case "3":
                    sticks          = productServices.GetProductByStickId(3);
                    productDetails2 = new ProductDetails2(customer, sticks, context, new DBRepo(context), new DBRepo(context), new DBRepo(context), new DBRepo(context), new DBRepo(context));
                    productDetails2.Start();
                    break;

                default:
                    Console.WriteLine("oppps");
                    ValidInvalidServices.InvalidInput();
                    break;
                }
            } while (!(custInput.Equals("0")));
        }
示例#13
0
        public void ManageInventory(int locationId)
        {
            do
            {
                Console.WriteLine("Select which item to replenish by selecting the number in brackets.");
                List <Inventory> items = GetProductsByLocation(locationId);
                Console.WriteLine("[0] Back");

                foreach (Inventory item in items)
                {
                    Sticks product = productServices.GetProductByStickId(item.stickId);
                    Console.WriteLine($"[{product.Id}] {product.description}, remaining: {item.quantity}");
                }
                manInput2 = Console.ReadLine();
                switch (manInput2)
                {
                case "0":
                    break;

                case "1":
                    updateStock(1);
                    break;

                case "2":
                    updateStock(2);
                    break;

                case "3":
                    updateStock(3);
                    break;

                default:
                    Console.WriteLine("oops");
                    ValidInvalidServices.InvalidInput();
                    break;
                }
            } while(!(manInput2.Equals("0")));
        }
示例#14
0
        private void ProcessTouchEvents(Sticks stick)
        {
            TouchLocation location = new TouchLocation();

            // Stick is not yet accepting input?
            if (!_CurrentStickAcceptingInput[(int)stick])
            {
                // No, so try to find an initial touch that is close enough to the stick.
                if (!FindInitialTouchEvent(_StickLocation[(int)stick], ref location))
                {
                    return;
                }

                _StartTouchPoint[(int)stick]            = new Vector2(location.Position.X, location.Position.Y);
                _CurrentTouchId[(int)stick]             = location.Id;
                _CurrentStickAcceptingInput[(int)stick] = true;
            }
            else
            {
                // Yes, so try to find any updated touch events for this id.
                if (!FindNextTouchEvent(_CurrentTouchId[(int)stick], ref location))
                {
                    return;
                }

                if (location.State == TouchLocationState.Released)
                {
                    _CurrentStickAcceptingInput[(int)stick] = false;
                    _CurrentMoveAmount[(int)stick]          = Vector2.Zero;
                }
                else
                {
                    _CurrentMoveAmount[(int)stick].X = (float)(location.Position.X - _StartTouchPoint[(int)stick].X) * 0.01f;
                    _CurrentMoveAmount[(int)stick].Y = (float)(location.Position.Y - _StartTouchPoint[(int)stick].Y) * -0.01f;
                }
            }
        }
示例#15
0
 public void AddStick(Sticks stick)
 {
     prodRepo.AddStick(stick);
 }
 public void UpdateStick(Sticks stick)
 {
     context.Product.Update(stick);
     context.SaveChanges();
 }
示例#17
0
 public GamePadAnalog(Node parent, string name, Sticks stick, PlayerIndex pi)
     : base(parent, name)
 {
     Stick = stick;
     PlayerIndex = pi;
 }
 public void AddStick(Sticks stick)
 {
     context.Product.Add(stick);
     context.SaveChanges();
 }
 public void DeleteStick(Sticks stick)
 {
     context.Product.Remove(stick);
     context.SaveChanges();
 }
示例#20
0
 public void UpdateStick(Sticks stick)
 {
     prodRepo.UpdateStick(stick);
 }
示例#21
0
        static void Main(string[] args)
        {
            //stickC[7] = 3;
            int loops = 0;

            while (loops < diskCount)
            {
                if (diskCount - loops != 3 && diskCount - loops != 4)
                {
                    Gravity(stickA, diskCount - loops);
                }
                loops++;
            }

            DrawSticks(stickA, stickB, stickC);
            Sticks source = Sticks.A;


            DrawSticks(stickA, stickB, stickC);
            while (true) // GamingLoop
            {
                ConsoleKeyInfo s = Console.ReadKey();
                Console.ForegroundColor = ConsoleColor.White;

                Console.Clear();

                switch (s.Key)
                {
                case ConsoleKey.D1:
                    Console.WriteLine("You have selected the first tower");
                    source = Sticks.A;
                    break;

                case ConsoleKey.D2:
                    Console.WriteLine("You have selected the second tower");
                    source = Sticks.B;
                    break;

                case ConsoleKey.D3:
                    Console.WriteLine("You have selected the third tower");
                    source = Sticks.C;
                    break;

                case ConsoleKey.LeftArrow:
                    Console.WriteLine("You have pushed the left Arrow");
                    MoveDisk(EnumToArray(source), EnumToArray(source - 1));
                    break;

                case ConsoleKey.RightArrow:
                    Console.WriteLine("You have pushed the right Arrow");
                    MoveDisk(EnumToArray(source), EnumToArray(source + 1));
                    break;

                default:
                    Console.WriteLine("Nespresso what else");
                    break;
                }

                DrawSticks(stickA, stickB, stickC);
            }
        }
示例#22
0
 public void cutTheSticksTest()
 {
     CollectionAssert.AreEqual(new int[] { 6, 4, 2, 1 }, Sticks.cutTheSticks(new int[] { 5, 4, 4, 2, 2, 8 }));
 }
示例#23
0
 public static bool IsConnected(Sticks device)
 {
     return(Instance.Connected((int)device));
 }
示例#24
0
        public override void OnUpdate()
        {
            Random rnd = new Random();

            Program.labelDebug.BackColor = scene.BackColor;
            Buttons buttons = Gamepad.GetButtons(Player.First);

            Triggers triggers = Gamepad.GetTriggers(Player.First);
            Sticks   sticks   = Gamepad.GetSticks(Player.First);

            DPad dPad = Gamepad.GetDPad(Player.First);

            Program.labelDebug.Text = $"Current Game Tick: {this.Tick}\r\nLS_X: {sticks.LeftStickAxisX:F2} | LS_Y: {sticks.LeftStickAxisY:F2} | RS_X: {sticks.RightStickAxisX:F2} | RS_Y: {sticks.RightStickAxisY:F2} | LT: {triggers.LT:F2} | RT: {triggers.RT:F2}\r\nButtons: A: {buttons.A} | B: {buttons.B} | X: {buttons.X} | Y: {buttons.Y} | LB: {buttons.LB} | RB: {buttons.RB} | BACK: {buttons.Back} | START: {buttons.Menu} | LS: {buttons.LeftStick} | RS: {buttons.RightStick}\r\nDPad: Up {dPad.Up} | Right: {dPad.Right} | Down: {dPad.Down} | Left: {dPad.Left}\r\nKeyboard: {Keyboard.GetKeys().ToString()}";

            obj1.X += (int)(obj1.InitialSpeed * sticks.LeftStickAxisX);
            obj1.Y += (int)(obj1.InitialSpeed * sticks.LeftStickAxisY * -1);

            obj2.X += (int)(obj2.InitialSpeed * sticks.RightStickAxisX);
            obj2.Y += (int)(obj2.InitialSpeed * sticks.RightStickAxisY * -1);

            if (buttons.Back)
            {
                GameApplication.Exit(0);
            }

            Keys mod = Keyboard.GetKeyModifiers();

            if (Keyboard.IsKeyDown(Keys.W))
            {
                if (!obj2.IsAnimated)
                {
                    obj2.PlayAnimation("anim");
                }
                if (Keyboard.IsKeyDown(Keys.ControlKey))
                {
                    obj1.Y -= (int)(obj1.InitialSpeed * 0.5f);
                }
                else
                {
                    obj1.Y -= obj1.InitialSpeed;
                }
            }
            if (Keyboard.IsKeyDown(Keys.S))
            {
                if (!obj2.IsAnimated)
                {
                    obj2.PlayAnimation("anim");
                }
                if (Keyboard.IsKeyDown(Keys.ControlKey))
                {
                    obj1.Y += (int)(obj1.InitialSpeed * 0.5f);
                }
                else
                {
                    obj1.Y += obj1.InitialSpeed;
                }
            }
            if (Keyboard.IsKeyDown(Keys.A))
            {
                if (!obj2.IsAnimated)
                {
                    obj2.PlayAnimation("anim");
                }
                if (Keyboard.IsKeyDown(Keys.ControlKey))
                {
                    obj1.X -= (int)(obj1.InitialSpeed * 0.5f);
                }
                else
                {
                    obj1.X -= obj1.InitialSpeed;
                }
            }
            if (Keyboard.IsKeyDown(Keys.D))
            {
                if (!obj2.IsAnimated)
                {
                    obj2.PlayAnimation("anim");
                }
                if (Keyboard.IsKeyDown(Keys.ControlKey))
                {
                    obj1.X += (int)(obj1.InitialSpeed * 0.5f);
                }
                else
                {
                    obj1.X += obj1.InitialSpeed;
                }
            }

            if (GameApplication.GetGameTick() == 100)
            {
                IsTinting = true;
            }
            if (IsTinting && GameApplication.GetGameTick() < 130 && GameApplication.GetGameTick() > 100)
            {
                TintVal += 0.05f;
                if (TintVal < 1.0f)
                {
                    scene.TintScene(Color.Black, TintVal);
                }
                else
                {
                    scene.TintScene(Color.Black, 1.0f);
                    IsTinting = false;
                }
            }
            if (!IsTinting && GameApplication.GetGameTick() > 130)
            {
                TintVal -= 0.05f;
                if (TintVal > 0.0f)
                {
                    scene.TintScene(Color.Black, TintVal);
                }
                else
                {
                    scene.TintScene(Color.Black, 0.0f);
                }
            }
            label.LabelColor          = Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255));
            rectangleObject.FillColor = Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255));
        }
示例#25
0
 public GamePadAnalog(Entity entity, string name, Sticks stick, PlayerIndex pi)
     : base(entity, name)
 {
     Stick       = stick;
     PlayerIndex = pi;
 }
示例#26
0
 public void DeleteStick(Sticks stick)
 {
     prodRepo.DeleteStick(stick);
 }
示例#27
0
        public Sticks GetProductByStickId(int stickId)
        {
            Sticks stick = prodRepo.GetProductByStickId(stickId);

            return(stick);
        }
示例#28
0
 public GamePadAnalog(Node parent, string name, Sticks stick, PlayerIndex pi)
     : base(parent, name)
 {
     Stick       = stick;
     PlayerIndex = pi;
 }