Exemplo n.º 1
0
        public void Run()
        {
            CompFactory factory = null;

            Console.Write("Enter the computer type you would like to visit: ");
            string comp = Console.ReadLine();

            switch (comp.ToLower())
            {
            case "allinone":
                factory = new AllinOneFactory();
                break;

            case "notebook":
                factory = new NotebookFactory();
                break;

            default:
                break;
            }

            Computer computer = factory.GetComputer();

            Console.WriteLine(">>>Factory {0}<<<", computer.GetNome());
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            NotebookBuilderAbstractor zenbookBuilder  = new ZenbookBuilder();
            INotebookFactory          NotebookFactory = new NotebookFactory();
            NoteBook noteBook = NotebookFactory.Build(zenbookBuilder);

            Console.WriteLine(noteBook.Price);
        }
 public PackScheduleEntityObjectMother(RioAccessSQLEntities oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback)
     : base(oldContext, loggingCallback)
 {
     _newContextHelper = new NewContextHelper(newContext);
     _packagingHelper  = new PackSchedulePackagingHelper(oldContext.CreateObjectSet <tblPackaging>().ToList());
     _notebookFactory  = NotebookFactory.Create(newContext);
     _serializedData   = new SerializedData(oldContext);
 }
        public InventoryAdjustmentsMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback) : base(oldContext, loggingCallback)
        {
            if (newContext == null)
            {
                throw new ArgumentNullException("newContext");
            }

            _newContextHelper = new NewContextHelper(newContext);
            _notebookFactory  = NotebookFactory.Create(newContext);
        }
Exemplo n.º 5
0
        static void BuilderSecond(int n)
        {
            FactoryBetter.FluentBuilder.Computers.Notebook builderNotebook;

            var notebookFactory = new NotebookFactory();

            for (int i = 0; i < n; i++)
            {
                builderNotebook = notebookFactory.Make(new AsusNoteBuilder());
            }
        }
Exemplo n.º 6
0
        public ProductionBatchEntityObjectMother(RioAccessSQLEntities oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback)
            : base(oldContext, loggingCallback)
        {
            if (newContext == null)
            {
                throw new ArgumentNullException("newContext");
            }

            _newContextHelper                  = new NewContextHelper(newContext);
            _serializedData                    = new SerializedData(oldContext);
            _productionResultHelper            = new ProductionResultHelper(_newContextHelper, _serializedData);
            _pickedInventoryItemLocationHelper = new PickedInventoryItemLocationHelper(_newContextHelper);
            _notebookFactory                   = NotebookFactory.Create(newContext);
        }
Exemplo n.º 7
0
        private static List <Notebook> ProduceSomeLaptops()
        {
            Notebook dell = NotebookFactory.CreateNotebook(NotebookManufacture.Dell);

            dell.LaptopModel = "Dell Inspiron 7000 Gaming"; // give it a name like a real manufacture :)

            Notebook alienware = NotebookFactory.CreateNotebook(NotebookManufacture.Dell);

            alienware.LaptopModel = "Dell Alienware m17x";

            Notebook acerLaptop = NotebookFactory.CreateNotebook(NotebookManufacture.Acer);

            acerLaptop.LaptopModel = "Acer Q51AC Gaming";

            Notebook lenovoLaptop = NotebookFactory.CreateNotebook(NotebookManufacture.Lenovo);

            lenovoLaptop.LaptopModel = "Lenovo P50V";

            return(new List <Notebook> {
                dell, alienware, acerLaptop, lenovoLaptop
            });
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            NotebookFactory factory = null;

            factory = new AsusFactory("Vivibook X556", 700);
            Notebook asus = factory.GetNotebook();

            asus.GetInfo();
            factory = new HPFactory("G450", 900);
            Notebook hp = factory.GetNotebook();

            hp.GetInfo();
            factory = new LenovoFactory("IdeaPad Z500", 500);
            Notebook lenovo = factory.GetNotebook();

            lenovo.GetInfo();
            factory = new DellFactory("Inspiron 15", 1000);
            Notebook dell = factory.GetNotebook();

            dell.GetInfo();
            Console.ReadLine();
        }
 public ContractEntityObjectMother(ObjectContext oldContext, RioValleyChiliDataContext newContext, Action <CallbackParameters> loggingCallback) : base(oldContext, loggingCallback)
 {
     _newContextHelper = new NewContextHelper(newContext);
     _notebookFactory  = NotebookFactory.Create(newContext);
 }
Exemplo n.º 10
0
        protected override IEnumerable <CompanyResult> BirthRecords()
        {
            _loadCount.Reset();

            _brokersByName          = new Dictionary <string, Models.Company>();
            _customersPendingBroker = new Dictionary <string, List <Customer> >();
            _notebookFactory        = NotebookFactory.Create(_newContext);

            var companies     = SelectCompaniesToLoad(OldContext);
            var nextCompanyId = 1;

            foreach (var company in companies)
            {
                _loadCount.AddRead(EntityType.Company);

                SerializableCompany serialized;
                var newCompany = CreateNewCompany(company, nextCompanyId, out serialized);
                if (newCompany == null)
                {
                    continue;
                }

                if (!newCompany.CompanyTypes.Any())
                {
                    Log(new CallbackParameters(CallbackReason.CompanyTypeUndetermined)
                    {
                        Company = company
                    });
                }

                Customer newCustomer = null;
                if (newCompany.CompanyTypes.Any(t => t.CompanyTypeEnum == CompanyType.Customer))
                {
                    var broker = serialized != null && serialized.Customer != null && !string.IsNullOrWhiteSpace(serialized.Customer.Broker) ? serialized.Customer.Broker : company.CustomerBroker;
                    if (string.IsNullOrWhiteSpace(broker))
                    {
                        Log(new CallbackParameters(CallbackReason.CustomerDefaultBrokerAssigned)
                        {
                            Company = company
                        });
                        broker = Models.StaticRecords.StaticCompanies.RVCBroker.Name;
                    }

                    newCustomer = CreateCustomer(newCompany, broker, company);
                }
                newCompany.Contacts = GetContacts(company.Contacts, newCompany).ToList();

                if (newCompany.CompanyTypes.Any(t => t.CompanyTypeEnum == CompanyType.Broker))
                {
                    RegisterBroker(newCompany.Name, newCompany);
                }

                var companyResult = new CompanyResult(newCompany, newCustomer);
                CountResults(companyResult);
                nextCompanyId += 1;
                yield return(companyResult);
            }

            _customersPendingBroker.ForEach(c => c.Value.ForEach(u => Log(new CallbackParameters(CallbackReason.CustomerUnresolvedBroker)
            {
                Customer = u
            })));

            _loadCount.LogResults(l => Log(new CallbackParameters(l)));
        }