예제 #1
0
        public async Task <IActionResult> PutElectronics([FromRoute] int id, [FromBody] Electronics electronics)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != electronics.Id)
            {
                return(BadRequest());
            }

            _context.Entry(electronics).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ElectronicsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #2
0
        public void CastOperator_ElectronicsToFood_NewElectronics()
        {
            Electronics electronics = new Electronics(150, "samsung s6", 5, 11);
            Food        food        = (Food)electronics;

            Assert.IsNotNull(food);
        }
        public void CastOperator_FoodTo_ExpectsNewElectronics()
        {
            Food        food        = new Food(150, "pasta", 5, 11);
            Electronics electronics = (Electronics)food;

            Assert.IsNotNull(electronics);
        }
예제 #4
0
        public void CastOperator_ElectronicsToClothes_ExpectsNewElectronics()
        {
            Electronics electronics = new Electronics(150, "samsung s6", 5, 11);
            Clothes     clothes     = (Clothes)electronics;

            Assert.IsNotNull(clothes);
        }
예제 #5
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name")] Electronics electronics)
        {
            if (id != electronics.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(electronics);
                    await _context.SaveChangesAsync();

                    TempData["message"] = "Electronic Edited";
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ElectronicsExists(electronics.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(electronics));
        }
        public void CastOperator_ClothesToElectronics_ExpectsNewElectronics()
        {
            Clothes     clothes     = new Clothes(150, "jumper", 5, 11);
            Electronics electronics = (Electronics)clothes;

            Assert.IsNotNull(electronics);
        }
예제 #7
0
        public ActionResult GetAdminElectronicsModels(string sidx, string sord, int page, int rows)
        {
            Electronics elctrncs = new Electronics();

            if (sidx == "id")
            {
                sidx = "model_id";
            }
            else
            {
                sidx = "model_desc";
            }

            var models = elctrncs.GetGridElectronicsModels(sidx, sord);

            var dataJson = new
            {
                total    =
                    page = 1,
                records  = 10000,
                rows     = (from md in models
                            select new
                {
                    id = md.model_id,
                    cell = new string[] {
                        Convert.ToString(md.model_id),
                        md.model_desc
                    }
                }).ToArray()
            };

            return(Json(dataJson, JsonRequestBehavior.AllowGet));
        }
        private void BuyFromElectronics()
        {
            var newElect = Electronics.GetElectronic();

            elect.PrintElectronicsList();
            int index = InputController.IndexController(newElect.Count);

            Console.WriteLine("You've chosen:");
            Console.WriteLine(newElect[index].GetInformation());
            Console.WriteLine("\nAdd it? press 1 not? press 2");
            var input = Console.ReadKey(true).Key;

            switch (input)
            {
            case ConsoleKey.NumPad1:
            case ConsoleKey.D1:
                AddElectronicsToShopCart(newElect[index]);

                break;

            case ConsoleKey.NumPad2:
            case ConsoleKey.D2:
                Console.Clear();
                BuyFromElectronics();
                break;
            }
        }
        private void AddElectronicsToShopCart(Electronics newElectronics)
        {
            var tempShoppingList = new ShoppingCart();

            tempShoppingList.Name     = newElectronics.ProductName;
            tempShoppingList.Quantity = InputController.QuantityController();
            tempShoppingList.Price    = tempShoppingList.Quantity * newElectronics.Price;
            ListManager.ShoppingCart.Add(tempShoppingList);
            Console.WriteLine("The product {0} is successfully added to your cart!", tempShoppingList.Name);
            Client.Timer(2);
            Console.WriteLine("Continue? Press 1! Shop another item from another categorie? press 2");
            var input = Console.ReadKey(true).Key;

            switch (input)
            {
            case ConsoleKey.NumPad1:
            case ConsoleKey.D1:
                Console.Clear();
                BuyFromElectronics();
                break;

            case ConsoleKey.NumPad2:
            case ConsoleKey.D2:
                Console.Clear();
                ShoppingStart();
                break;
            }
        }
예제 #10
0
        public ActionResult GetAssignGridData(string id, string sidx, string sord, int page, int rows)
        {
            Electronics elc = new Electronics();

            var assigns = elc.GetGridElectronicsAssign(sidx, sord, id);

            var dataJson = new
            {
                total    =
                    page = 1,
                records  = 10000,
                rows     = (from a in assigns
                            select new
                {
                    id = a.assign_id,
                    cell = new string[] {
                        a.electronics_id,
                        a.assigned_to,
                        String.Format("{0:MM/dd/yyyy}", a.assigned_dt),
                        String.Format("{0:MM/dd/yyyy}", a.return_dt),
                        a.asgn_cond_descr != null ?  a.asgn_cond_descr.TrimEnd().TrimStart() :  null,
                        a.ret_cond_descr != null ?  a.ret_cond_descr.TrimEnd().TrimStart() :  null,
                        a.comment_txt,
                        Convert.ToString(a.assign_id)
                    }
                }).ToArray()
            };

            return(Json(dataJson, JsonRequestBehavior.AllowGet));
        }
        public void ObjecåÑreation_NegativePPprice_ProductPriceExceptionThrow(string type, string name, double pursheringPrice, double markUp, int amount)
        {
            Product product;
            bool    actual = false;

            try
            {
                switch (type)
                {
                case "Electronics":
                    product = new Electronics(pursheringPrice, name, markUp, amount);
                    break;

                case "Food":
                    product = new Food(pursheringPrice, name, markUp, amount);
                    break;

                case "Clothes":
                    product = new Clothes(pursheringPrice, name, markUp, amount);
                    break;
                }
            }
            catch (ProductPriceException)
            {
                actual = true;
            }
            Assert.IsTrue(actual);
        }
예제 #12
0
        public override void Draw()
        {
            if (Selected == true)
            {
                Game1.SpriteBatchGlobal.Draw(Game1.Textures["ShopItemSelected"], _boundary.Position, scale: new Vector2(1));
            }

            Game1.SpriteBatchGlobal.Draw(Game1.Textures["ShopItemBack"], _boundary.Position, scale: new Vector2(1));

            switch (Type)
            {
            case Module.test:
                Game1.SpriteBatchGlobal.Draw(Game1.Textures["Part"], _boundary.Position + new Vector2(15), scale: new Vector2(2));
                break;

            case Module.tier2:
                Game1.SpriteBatchGlobal.Draw(Game1.Textures["Tier2"], _boundary.Position + new Vector2(15));
                break;

            case Module.tier3:
                Game1.SpriteBatchGlobal.Draw(Game1.Textures["Tier3"], _boundary.Position + new Vector2(15));
                break;
            }

            Game1.SpriteBatchGlobal.DrawAtlas(Game1.electronics, _boundary.Position + new Vector2(32, 128 + 96 - 6), new Point(32), new Point(1, 0));
            DrawString.DrawText(Electronics.ToString(), _boundary.Position + new Vector2(32 + 32 + 16, 128 + 96 + 2), Align.left, Color.White, FontType.small);

            Game1.SpriteBatchGlobal.DrawAtlas(Game1.tissue, _boundary.Position + new Vector2(32, 128 + 96 + 42), new Point(32), new Point(0, 0));
            DrawString.DrawText(Tissue.ToString(), _boundary.Position + new Vector2(32 + 32 + 16, 128 + 96 + 2 + 48), Align.left, Color.White, FontType.small);
        }
예제 #13
0
 public ShakespearesTheatre() : base(40)
 {
     Name         = "Shakespeare's Theatre";
     RequiredTech = new Medicine();
     ObsoleteTech = new Electronics();
     SetSmallIcon(6, 1);
     Type = Wonder.ShakespearesTheatre;
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Electronics electronics = db.Electronics.Find(id);

            db.Electronics.Remove(electronics);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public void CastOperator_ProductToDouble_TheFullCostOfTheProductInRubela()
        {
            Product product = new Electronics(150, "samsung s6", 5, 11);

            double expected = product.GetFullPriceOfAllProducts();

            Assert.AreEqual(expected, (double)product, 0.1);
        }
        public void CastOperator_ProductToInt_TheFullCostOfTheProductInKopecksà()
        {
            Product product = new Electronics(150, "samsung s6", 5, 11);

            int expected = (int)(product.GetFullPriceOfAllProducts() * 100);

            Assert.AreEqual(expected, (int)product);
        }
예제 #17
0
        public ActionResult GetNextModelTypeId()
        {
            Electronics elctrncs = new Electronics();

            short shtMax = elctrncs.GetMaxModelTypeID();

            return(Content((shtMax + 1).ToString()));
        }
예제 #18
0
 public HooverDam() : base(60)
 {
     Name         = "Hoover Dam";
     RequiredTech = new Electronics();
     ObsoleteTech = null;
     SetSmallIcon(7, 0);
     Type = Wonder.HooverDam;
 }
        public void GetFullPriceOfAllProductsTest_CorrectProdct_ProductPPricePlusProductMarkUpMulProductAmouunt()
        {
            Product data    = new Electronics(302.3, "Redmi Note 8", 100.8, 10);
            double  actual  = data.GetFullPriceOfAllProducts();
            double  expects = data.Amount * (data.MarkUp + data.PurchasePrice);

            Assert.AreEqual(expects, actual, 0.01);
        }
예제 #20
0
        public void OperatorSum_TwoCorrectElectronics_NewElectronicsWithTheSameNameAsTheFirstTwoElectronicsInAnAmountEqualToTheTotalNumberOfTheFirstTwoElectronicsTheMarkupAndPurchasePriceEqualToTheArithmeticAverageOfTheseValuesInTheFirstTwoElectronics()
        {
            Electronics firstElectronics  = new Electronics(13.7, "samsung s6", 18.5, 5);
            Electronics secondElectronics = new Electronics(16.3, "samsung s6", 11.5, 5);
            Electronics actual            = firstElectronics + secondElectronics;
            Electronics expected          = new Electronics(15, "samsung s6", 15, 10);

            Assert.AreEqual(expected, actual);
        }
예제 #21
0
 public HydroPlant() : base(24, 4)
 {
     Name         = "Hydro Plant";
     RequiredTech = new Electronics();
     SetIcon(4, 2, false);
     SetSmallIcon(3, 4);
     // TODO: Fix icon in patch, should be: SetSmallIcon(3, 3);
     Type = Building.HydroPlant;
 }
예제 #22
0
        public void OperatorSubtraction_CorrectNumber_NewElectronicsWhoseQuantityIsEqualToTheDifferenceBetweenTheQuantityOfTheFirstProductAndTheSubtractedNumber()
        {
            Electronics firstElectronics    = new Electronics(150, "samsung s6", 5, 11);
            int         subtractedNumber    = 10;
            Electronics actual              = firstElectronics - subtractedNumber;
            Electronics expectedElectronics = new Electronics(150, "samsung s6", 5, 1);

            Assert.AreEqual(expectedElectronics, actual);
        }
예제 #23
0
        public VisitorPatternApp()
        {
            TaxAuditor  auditor = new TaxAuditor();
            Furniture   chair   = new Furniture(100);
            Electronics phone   = new Electronics(20000);

            chair.Accept(auditor);
            phone.Accept(auditor);
        }
예제 #24
0
        public ActionResult GetRptDlgTypes()
        {
            Electronics elc = new Electronics();

            var list = elc.GetTypesDlg();

            ViewData["TypesList"] = list;

            return(PartialView("RptElectronicsTypes", ViewData));
        }
 public ActionResult Edit([Bind(Include = "Electronicsid,Type,Model,Brand,price,Description")] Electronics electronics)
 {
     if (ModelState.IsValid)
     {
         db.Entry(electronics).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(electronics));
 }
예제 #26
0
파일: Car.cs 프로젝트: adipistea/Dealership
 public Car(int Id)
 {
     this.Id          = Id;
     Accessories      = new List <string>();
     Engine           = new Engine();
     Base             = new Base();
     Breaks           = new Breaks();
     Electronics      = new Electronics();
     ExhaustingSystem = new ExhaustingSystem();
 }
        public void GetFullPriceOfSingleItemOfProductsTest_CorrectProdct_ProductPPricePlusProductMarkUp()
        {
            Product data = new Electronics(302.3, "Redmi Note 8", 100.8, 10);

            double actual = data.GetFullPriceOfSingleProduct();

            double expects = data.MarkUp + data.PurchasePrice;

            Assert.AreEqual(expects, actual, 0.01);
        }
예제 #28
0
        static void Main(string[] args)
        {
            Client client = new Client();

            Food.CreateGetFile();
            Electronics.CreateGetFile();
            Clothes.CreateGetFile();

            client.Start();
        }
예제 #29
0
 public static bool isBudjetItem(Electronics electronics)
 {
     if (electronics.DevicePrice <= 1000)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        public ActionResult Create([Bind(Include = "Electronicsid,Type,Model,Brand,price,Description")] Electronics electronics)
        {
            if (ModelState.IsValid)
            {
                db.Electronics.Add(electronics);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(electronics));
        }