예제 #1
0
 public void Update(Componet componet, string title, string standart, decimal Price)
 {
     if (ComponentValidationService.IsValid(componet))
     {
         _repository.Update(_mapper.Map <Componet, ComponetEntity>(componet), title, standart, Price);
     }
 }
예제 #2
0
 public void Create(Componet componet)
 {
     if (ComponentValidationService.IsValid(componet))
     {
         _repository.Create(_mapper.Map <Componet, ComponetEntity>(componet));
     }
 }
예제 #3
0
파일: Computer.cs 프로젝트: TzvetanIG/OOP
 public Computer(string name, Componet boxPC, Componet motherboard, Componet hdd, Componet procesor, Componet graficsCard, Componet ram, params Componet[] componets) :
     this(name, boxPC, motherboard, hdd, procesor, graficsCard, ram)
 {
     this.componets.AddRange(componets);
     foreach (Componet componet in componets)
     {
         this.price += componet.Price;
     }
 }
예제 #4
0
 public Computer(string name, Componet boxPC, Componet motherboard, Componet hdd, Componet procesor, Componet graficsCard, Componet ram, params Componet[] componets) :
     this(name, boxPC, motherboard, hdd, procesor, graficsCard, ram)
 {
     this.componets.AddRange(componets);
     foreach (Componet componet in componets)
     {
         this.price += componet.Price;
     }
 }
예제 #5
0
파일: Computer.cs 프로젝트: TzvetanIG/OOP
 public Computer(string name, Componet boxPC, Componet motherboard, Componet hdd, Componet procesor, Componet graficsCard, Componet ram)
 {
     this.Name = name;
     this.componets.Add(boxPC);
     this.componets.Add(motherboard);
     this.componets.Add(hdd);
     this.componets.Add(procesor);
     this.componets.Add(graficsCard);
     this.componets.Add(ram);
     foreach (Componet componet in this.componets)
     {
         this.price += componet.Price;
     }
 }
예제 #6
0
 public Computer(string name, Componet boxPC, Componet motherboard, Componet hdd, Componet procesor, Componet graficsCard, Componet ram)
 {
     this.Name = name;
     this.componets.Add(boxPC);
     this.componets.Add(motherboard);
     this.componets.Add(hdd);
     this.componets.Add(procesor);
     this.componets.Add(graficsCard);
     this.componets.Add(ram);
     foreach (Componet componet in this.componets)
     {
         this.price += componet.Price;
     }
 }
예제 #7
0
 public ActionResult CreateComponent(Componet componet)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _componentServices.Create(componet);
             return(RedirectToAction("ComponentList"));
         }
         catch (Exception ex)
         {
             ModelState.AddModelError(ex.GetHashCode().ToString(), ex.Message);
         }
     }
     return(View(componet));
 }
예제 #8
0
    static void Main()
    {
        Componet boxPC       = new Componet(name: "Кутия Shenha V6", price: 55.20m, details: "Размер: 475 x 185 x 465 cm");
        Componet motherboard = new Componet(name: "Дънна платка ASROCK FM2A88X Extreme6+", price: 188.40m);
        Componet hdd         = new Componet(name: "Диск SEAGATE 2T, ES.3, SATA III", price: 330m, details: "Капацитет: 2 TB");
        Componet procesor    = new Componet(name: "Процесор Intel Core I3-4340", price: 316.80m);
        Componet graficsCard = new Componet(name: "Видео карта PALIT GeForce GT 610", price: 80.40m, details: "Видео памет размер: 1 GB");
        Componet ram         = new Componet(name: "Памет ADATA 2X4GB", price: 171.60m, details: "Описание: 2X4G DDR3");

        Componet discSSD = new Componet(name: "Диск A-DATA 128GB SSD", price: 127.20m, details: "Описание: Multi-Level Cell (MLC) NAND Flash Memory, 2.5 inch");
        Componet blower  = new Componet(name: "Вентилатор COOLERMASTER Blade Master 80", price: 16.80m);
        Componet power   = new Componet(name: "PSU FD 750W INTEGRA BLACK", price: 157.20m, details: "Описание: Multi-Level Cell (MLC) NAND Flash Memory, 2.5 inch");



        Computer computer1 = new Computer(
            name: "Frankenstein",
            boxPC: boxPC,
            motherboard: motherboard,
            hdd: hdd,
            procesor: procesor,
            graficsCard: graficsCard,
            ram: ram
            );

        Computer computer2 = new Computer("The Мachine", boxPC, motherboard, hdd, procesor, graficsCard, ram, discSSD, blower, power);

        Computer computer3 = new Computer("SbirotakModel", boxPC, motherboard, hdd, procesor, graficsCard, ram, discSSD);

        List <Computer> computers = new List <Computer>()
        {
            computer2, computer1, computer3, computer1
        };


        computers = computers.OrderBy(computer => computer.Price).ToList();

        foreach (var computer in computers)
        {
            computer.writeToConsole();
            Console.WriteLine();
        }
    }
예제 #9
0
파일: PcCatalog.cs 프로젝트: TzvetanIG/OOP
    static void Main()
    {
        Componet boxPC = new Componet(name: "Кутия Shenha V6", price: 55.20m, details: "Размер: 475 x 185 x 465 cm");
        Componet motherboard = new Componet(name: "Дънна платка ASROCK FM2A88X Extreme6+", price: 188.40m);
        Componet hdd = new Componet(name: "Диск SEAGATE 2T, ES.3, SATA III", price: 330m, details: "Капацитет: 2 TB");
        Componet procesor = new Componet(name: "Процесор Intel Core I3-4340", price: 316.80m);
        Componet graficsCard = new Componet(name: "Видео карта PALIT GeForce GT 610", price: 80.40m, details: "Видео памет размер: 1 GB");
        Componet ram = new Componet(name: "Памет ADATA 2X4GB", price: 171.60m, details: "Описание: 2X4G DDR3");

        Componet discSSD = new Componet(name: "Диск A-DATA 128GB SSD", price: 127.20m, details: "Описание: Multi-Level Cell (MLC) NAND Flash Memory, 2.5 inch");
        Componet blower = new Componet(name: "Вентилатор COOLERMASTER Blade Master 80", price: 16.80m);
        Componet power = new Componet(name: "PSU FD 750W INTEGRA BLACK", price: 157.20m, details: "Описание: Multi-Level Cell (MLC) NAND Flash Memory, 2.5 inch");



        Computer computer1 = new Computer(
            name: "Frankenstein",
            boxPC: boxPC,
            motherboard: motherboard,
            hdd: hdd,
            procesor: procesor,
            graficsCard: graficsCard,
            ram: ram
        );

        Computer computer2 = new Computer("The Мachine", boxPC, motherboard, hdd, procesor, graficsCard, ram, discSSD, blower, power);

        Computer computer3 = new Computer("SbirotakModel", boxPC, motherboard, hdd, procesor, graficsCard, ram, discSSD);

        List<Computer> computers = new List<Computer>() { computer2, computer1, computer3, computer1 };


        computers = computers.OrderBy(computer => computer.Price).ToList();

        foreach (var computer in computers)
        {
            computer.writeToConsole();
            Console.WriteLine();
        }

    }
 public static bool IsValid(Componet componet)
 {
     if (componet != null)
     {
         if (componet.Price > 100000 || componet.Price < (decimal)0.01)
         {
             throw new ValidationException(Messages.PriceMessage);
         }
         if ((componet?.Title?.Length ?? 0) < 3 || componet.Title.Length > 100)
         {
             throw new ValidationException(Messages.WrongServiceTitlteMessage);
         }
         if ((componet?.ProductionStandards?.Length ?? 0) < 3 || componet.ProductionStandards.Length > 100)
         {
             throw new ValidationException(Messages.WrongStandartLentghtMessage);
         }
         return(true);
     }
     else
     {
         throw new ValidationException(Messages.ObjectNotCreatedMessage);
     }
 }
예제 #11
0
    static void Main()
    {
        Componet boxPC = new Componet(name: "Case Shenha V6", price: 55.20m, details: "Dimmensions: 475 x 185 x 465 cm");
        Componet motherboard = new Componet(name: "Motherboard ASROCK FM2A88X Extreme6+", price: 188.40m);
        Componet hdd = new Componet(name: "HDD SEAGATE 2T, ES.3, SATA III", price: 330m, details: "Size: 2 TB");
        Componet procesor = new Componet(name: "CPU Intel Core I3-4340", price: 316.80m);
        Componet graficsCard = new Componet(name: "GPU PALIT GeForce GT 610", price: 80.40m, details: "Size: 1 GB");
        Componet ram = new Componet(name: "RAM ADATA 2X4GB", price: 171.60m, details: "Descr: 2X4G DDR3");

        Componet discSSD = new Componet(name: "Drive A-DATA 128GB SSD", price: 127.20m, details: "Descr: Multi-Level Cell (MLC) NAND Flash Memory, 2.5 inch");
        Componet blower = new Componet(name: "Fan COOLERMASTER Blade Master 80", price: 16.80m);
        Componet power = new Componet(name: "PSU FD 750W INTEGRA BLACK", price: 157.20m, details: "Descr: Multi-Level Cell (MLC) NAND Flash Memory, 2.5 inch");

        Computer computer1 = new Computer(
            name: "Frankenstein",
            boxPC: boxPC,
            motherboard: motherboard,
            hdd: hdd,
            procesor: procesor,
            graficsCard: graficsCard,
            ram: ram
        );

        Computer computer2 = new Computer("The machine", boxPC, motherboard, hdd, procesor, graficsCard, ram, discSSD, blower, power);

        Computer computer3 = new Computer("SbirotakModel", boxPC, motherboard, hdd, procesor, graficsCard, ram, discSSD);

        List<Computer> computers = new List<Computer>() { computer2, computer1, computer3, computer1 };

        computers = computers.OrderBy(computer => computer.Price).ToList();

        foreach (var computer in computers)
        {
            computer.writeToConsole();
            Console.WriteLine();
        }
    }
예제 #12
0
 public void Update(Componet componet)
 {
     _componentService.Update(_mapper.Map <Componet, BL.DtoModels.Componet>(componet), componet.Title, componet.ProductionStandards, componet.Price);
 }
예제 #13
0
 public void Delete(Componet componet)
 {
     _componentService.Delete(_mapper.Map <Componet, BL.DtoModels.Componet>(componet));
 }
예제 #14
0
 public void Delete(Componet componet)
 {
     _repository.Delete(_mapper.Map <Componet, ComponetEntity>(componet));
 }
예제 #15
0
 public void RemoveComponet(Componet componet)
 {
     Componets.Remove(componet);
 }
예제 #16
0
 /// <summary>
 /// addComponets to Componts
 /// </summary>
 public void addComponet(Componet componet)
 {
     componet.Attach(this);
     Componets.Add(componet);
 }