Ejemplo n.º 1
0
        /// <summary>
        /// 保存computerdata数据集数据
        /// </summary>
        /// <param name="bookfromcountrydata">数据集对象</param>
        /// <returns>返回保存后的响应信息</returns>
        public String SaveComputer(ComputerData computerdata)
        {
            #region
            ComputerClass computerclass = new ComputerClass();
            return(base.Save(computerdata, computerclass));

            #endregion
        }
Ejemplo n.º 2
0
        /****************************************
         ***生成器版本:V1.0.1.31494
         ***生成时间:2013-09-05 09:05:58
         ***公司:山西ICat Studio有限公司
         ***友情提示:以下代码为生成器自动生成,可做参照修改之用;
         ***         如需有其他业务要求,可在region外添加新方法;
         ***         如发现任何编译和运行时错误,请联系QQ:330669393。
         *****************************************/

        #region public members methods

        /// <summary>
        /// 根据条件筛选所有Computer指定页码的数据(分页型)
        /// </summary>
        /// <param name="bookfromcountry">实体对象</param>
        /// <param name="pageparams">分页对象</param>
        /// <returns></returns>
        public string GetJsonByPage(EntityComputer computer, PageParams pageparams)
        {
            #region
            int           totalCount    = 0;
            ComputerClass computerclass = new ComputerClass();
            DataSet       computerdata  = this.GetData(computer, pageparams, out totalCount);
            return(base.GetJson(computerdata, totalCount));

            #endregion
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            //примеры работы с моделью.

            ConnectionInterface sata       = new ConnectionInterface("Sata-1");
            ConnectionInterface pciExpress = new ConnectionInterface("PCI-Express");
            ConnectionInterface powerPin   = new ConnectionInterface("PowerPin");
            ConnectionInterface socket     = new ConnectionInterface("AM4");

            MotherboardModel motherboardModel = new MotherboardModel("B450", 2, new List <ConnectionInterface>()
            {
                sata, pciExpress, powerPin, socket
            }, Socket.AM4, FormFactor.MiniATx);
            HardDriveModel hddModel = new HardDriveModel("mega hdd", 4, new List <ConnectionInterface>()
            {
                sata, powerPin
            }, 7200);
            PowerSupplyModel powerSupplyModel = new PowerSupplyModel("PS-8000", 55, new List <ConnectionInterface>()
            {
                powerPin, powerPin, powerPin
            }, 600);
            ProcessorModel processorModel = new ProcessorModel("3600x", 6, new List <ConnectionInterface>()
            {
                socket
            }, 6);

            MotherBoard mother        = new MotherBoard(motherboardModel);
            MotherBoard anotherMother = new MotherBoard(motherboardModel);
            Processor   processor     = new Processor(processorModel);
            PowerSupply powerSupply   = new PowerSupply(powerSupplyModel);
            HardDrive   hardDrive     = new HardDrive(hddModel);

            mother.Establisher.TryToConnect(processor, socket);
            mother.Establisher.TryToConnect(hardDrive, sata);
            mother.Establisher.TryToConnect(powerSupply, powerPin);
            hardDrive.Establisher.TryToConnect(powerSupply, powerPin);

            Hardware       hardware = new Hardware(mother);
            ComputerSystem system   = new ComputerSystem();

            hardDrive.InstallSystem(system);

            //Включение и перезагрузка. Включать можно только через Hardware. Выключать и рестарат через Hardware и ComputerSystem.(like IRL)
            Computer       computer     = new Computer(hardware);
            ComputerSystem loadedSystem = computer.Hardware.TryToTurnOn();

            loadedSystem.Restart();

            //Продажа компьютеров
            ShopCatalog catalog = new ShopCatalog();

            catalog.AddLot(new Lot(computer.Hardware, 100, 2));
            Lot      wantToBuy      = catalog.FindSuitable(x => x.Cost < 150 && x.Item is Hardware).First();
            Hardware boughtHardware = (Hardware)catalog.Buy(wantToBuy);
            Computer boughtComputer = new Computer(boughtHardware);

            //Замена материнской платы
            boughtComputer.Hardware.TryToReplaceComponent(mother, anotherMother);

            //Установка приложения в компьютерном классе
            Application     trojan             = new Application(new byte[228]);
            List <Computer> installedComputers = new List <Computer>()
            {
                boughtComputer
            };
            ComputerClass computerClass = new ComputerClass(installedComputers);

            computerClass.InstallApplicationOnEach(trojan);
            computerClass.Command(x => x.System?.Execute(trojan.BinaryCode));

            // сбор металлолома
            MetalCollector collector = new MetalCollector();

            collector.Collect(boughtComputer);
        }