public void ListPhones()
    {
        switch (vendor)
        {
        case VENDORS.SAMSUNG:
            factory = new SamsungFactory();
            break;

        case VENDORS.HTC:
            factory = new HTCFactory();
            break;

        case VENDORS.NOKIA:
            factory = new NokiaFactory();
            break;

        case VENDORS.APPLE:
            factory = new AppleFactory();
            break;
        }

        Console.WriteLine(vendor.ToString() + ":" +
                          "\nSmart Phone: " + factory.GetSmart().Name() +
                          "\nDumb Phone: " + factory.GetDumb().Name() + "\n");
    }
Пример #2
0
 public void CheckProducts()
 {
     if (manu == MANUFACTURERS.SAMSUNG)
     {
         factory = new SamsungFactory();
         ISmart SamSmart;
         SamSmart = factory.GetSmart();
         IDumb SamDumb;
         SamDumb = factory.GetDumb();
         Console.WriteLine("Smart Phone: {0} \n" +
                           "Dumb Phone: {1}\n", SamSmart.GetName(), SamDumb.GetName());
     }
     if (manu == MANUFACTURERS.HTC)
     {
         factory = new HTCFactory();
         ISmart HTCSmart;
         HTCSmart = factory.GetSmart();
         IDumb HTCDumb;
         HTCDumb = factory.GetDumb();
         Console.WriteLine("Smart Phone: {0} \n" +
                           "Dumb Phone: {1}\n", HTCSmart.GetName(), HTCDumb.GetName());
     }
     if (manu == MANUFACTURERS.NOKIA)
     {
         factory = new NokiaFactory();
         ISmart NokiSmart;
         NokiSmart = factory.GetSmart();
         IDumb NokiDumb;
         NokiDumb = factory.GetDumb();
         Console.WriteLine("Smart Phone: {0} \n" +
                           "Dumb Phone: {1}\n", NokiSmart.GetName(), NokiDumb.GetName());
     }
 }
Пример #3
0
        public void CheckProducts()
        {
            IPhoneFactory factory = null;

            switch (_manufacturer)
            {
            case Manufacturer.Nokia:
                factory = new NokiaFactory();
                break;

            case Manufacturer.HTC:
                factory = new HTCFactory();
                break;

            case Manufacturer.Samsung:
                factory = new SamsungFactory();
                break;

            default:
                break;
            }

            Console.WriteLine("{0}:\nSmartphone: {1}\nDumb phone: {2}", _manufacturer.ToString(), factory.GetSmart().Name,
                              factory.GetDumb().Name);
        }
Пример #4
0
 public void phoneTypeChecker(Manufacturers manu)
 {
     if (manu == Manufacturers.HTC)
     {
         HTCFactory H = new HTCFactory();
         factory = H;
         CheckProducts(factory);
     }
     else if (manu == Manufacturers.Nokia)
     {
         NokiaFactory N = new NokiaFactory();
         factory = N;
         CheckProducts(factory);
     }
     else if (manu == Manufacturers.Samsung)
     {
         SamsungFactory S = new SamsungFactory();
         factory = S;
         CheckProducts(factory);
     }
     void CheckProducts(IPhoneFactory factory)
     {
         factory.GetSmart();
         factory.GetDumb();
     }
 }
Пример #5
0
        public StringProcessor(BPFinanceContext context, IBPFinanceRepository repository)
        {
            _context    = context;
            _repository = repository;

            _stringFactory           = new StringPositionFactory();
            _addressFactory          = new AddressFactory();
            _stringAddressFactory    = new StringAddressFactory();
            _stringOccurrenceFactory = new StringOccurrenceFactory();
            _phoneFactory            = new PhoneFactory();
            _stringPhoneFactory      = new StringPhoneFactory();
            _emailFactory            = new EmailFactory();
            _stringWebFactory        = new StringWebFactory();
        }
Пример #6
0
 public void CheckProducts()
 {
     if (manu == Manufacturers.Samsung)
     {
         factory = new SamsungFactory(); factory.GetSmart(); factory.GetDumb();
     }
     if (manu == Manufacturers.HTC)
     {
         factory = new HTCFactory(); factory.GetSmart(); factory.GetDumb();
     }
     if (manu == Manufacturers.Nokia)
     {
         factory = new NokiaFactory(); factory.GetSmart(); factory.GetDumb();
     }
 }
        static void Main(string[] args)
        {
            Client client = new Client();

            IPhoneFactory phoneFactory = client.GetInstance(FactoryName.SAMSUNG);
            IDump         dump         = phoneFactory.Dump();
            string        name         = dump.GetName("Hey this is SAMSUNG S8");

            ISmart smart       = phoneFactory.Smart();
            string modelNumber = smart.GetModelNumber("XT672K");

            System.Console.WriteLine(name + Environment.NewLine);
            System.Console.WriteLine(modelNumber + Environment.NewLine);

            Console.WriteLine("Hello World!");
        }
Пример #8
0
        public PhoneClient(MANUFACTURER manufacturer)
        {
            switch (manufacturer)
            {
            case MANUFACTURER.NOKIA:
                factory = new NokiaFactory();
                break;

            case MANUFACTURER.SONYERICSSON:
                factory = new SonyEricssonFactory();
                break;

            default:
                throw new ArgumentException("Invalid Manufacturer");
            }
        }
Пример #9
0
        public void CheckProducts()
        {
            switch (manu)
            {
                case Manufacturers.SAMSUNG:
                    factory = new SamsungFactory();
                    break;
                case Manufacturers.HTC:
                    factory = new HTCFactory();
                    break;
                case Manufacturers.NOKIA:
                    factory = new NokiaFactory();
                    break;
            }

            Console.WriteLine(factory.GetDumb().getName());
            Console.WriteLine(factory.GetSmart().getName());
        }
Пример #10
0
        public void productChecker()
        {
            //set internal factory to correct factory, then write both phone types to console
            factory = new SamsungFactory();

            Console.WriteLine(factory.getSmart().getName());
            Console.WriteLine(factory.getDumb().getName());

            factory = new HTCFactory();

            Console.WriteLine(factory.getSmart().getName());
            Console.WriteLine(factory.getDumb().getName());

            factory = new NokiaFactory();

            Console.WriteLine(factory.getSmart().getName());
            Console.WriteLine(factory.getDumb().getName());
        }
        public void CheckProducts()
        {
            switch (manu)
            {
            case Manufactura.SAMSUNG:
                factory = new SamsungFactory();
                break;

            case Manufactura.HTC:
                factory = new HtcFactory();
                break;

            case Manufactura.NOKIA:
                factory = new NokiaFactory();
                break;
            }

            Console.WriteLine(manu.ToString() + ":\nSmart Phone: " + factory.GetSmart().Name() + "\nDumb Phone: " + factory.GetDumb().Name());
        }
Пример #12
0
        public void CheckProducts() // This method is called to new up the correct class
        {
            switch (manu)
            {
            case MANUFACTURERS.SAMSUNG:
                factory = new SamsungFactory();
                break;

            case MANUFACTURERS.HTC:
                factory = new HTCFactory();
                break;

            case MANUFACTURERS.NOKIA:
                factory = new NokiaFactory();
                break;
            }

            Console.WriteLine(manu.ToString() + ":\nSmart Phone: " + factory.GetSmart().Name() + "\nDumb Phone: " + factory.GetDumb().Name());
        }
Пример #13
0
        public void CheckType()
        {
            switch (manuf)
            {
            case Manufacturers.a:
                factory = new A();
                break;

            case Manufacturers.b:
                factory = new B();
                break;

            case Manufacturers.c:
                factory = new C();
                break;
            }

            Console.WriteLine(manuf + ": Smart phone - " + factory.GetSmart().Name() + " and Dumb phone - " + factory.GetDumb().Name());
        }
Пример #14
0
            public void CheckProducts()
            {
                switch (manu)
                {
                case MANUFACTURERS.SAMSUNG:
                    factory = new SamsungFactory();
                    break;

                case MANUFACTURERS.HTC:
                    factory = new HTCFactory();
                    break;

                case MANUFACTURERS.IPHONE:
                    factory = new iPhoneFactory();
                    break;
                }

                Console.WriteLine(manu.ToString() + ":\nSmart Phone: " +
                                  factory.GetSmart().Name() + "\nDumb Phone: " + factory.GetDumb().Name());
            }
Пример #15
0
        public void CheckProducts()
        {
            if (manu == Manufacturers.SAMSUNG)
            {
                factory = new SamsungFactory();
                Console.WriteLine("Smart: " + GetSmart().GetName() + "\nDumb: " + GetDumb().GetName());
            }

            else if (manu == Manufacturers.HTC)
            {
                factory = new HTCFactory();
                Console.WriteLine("Smart: " + GetSmart().GetName() + "\nDumb: " + GetDumb().GetName());
            }

            else if (manu == Manufacturers.NOKIA)
            {
                factory = new NokiaFactory();
                Console.WriteLine("Smart: " + GetSmart().GetName() + "\nDumb: " + GetDumb().GetName());
            }
        }
Пример #16
0
        /// <summary>
        /// This method will create new object using _manu and then will provide its details
        /// </summary>
        public void CheckProducts()
        {
            switch (_manu)
            {
            case Manufacturers.Samsung:
                _factory = new SamsungFactory();
                break;

            case Manufacturers.HTC:
                _factory = new HTCFactory();
                break;

            case Manufacturers.Nokia:
                _factory = new NokiaFactory();
                break;
            }

            Console.WriteLine(_manu.ToString() + ":\nSmart Phone: " +
                              _factory.GetSmart().Name() + "\nDumb Phone: " + _factory.GetDumb().Name());
        }
Пример #17
0
 PhoneTypeChecker(Manufactures manu)
 {
     if (manu == Manufactures.Samsung)
     {
         SamsungFactory s = new SamsungFactory();
         factory = s;
         CheckProducts(factory);
     }
     else if (manu == Manufactures.HTC)
     {
         HTCFactory htc = new HTCFactory();
         factory = htc;
         CheckProducts(factory);
     }
     else if (manu == Manufactures.Nokia)
     {
         NokiaFactory n = new NokiaFactory();
         factory = n;
         CheckProducts(factory);
     }
 }
Пример #18
0
        // Check phone brands, write to console
        public void CheckProducts()
        {
            // Set internal factory to correct factory
            if (manu == MANUFACTURERS.SAMSUNG)
            {
                factory = new SamsungFactory();
            }
            else if (manu == MANUFACTURERS.HTC)
            {
                factory = new HTCFactory();
            }
            else if (manu == MANUFACTURERS.NOKIA)
            {
                factory = new NokiaFactory();
            }

            // Write phone types to console
            Console.WriteLine(manu.ToString());
            Console.WriteLine("Smartphone: " + factory.GetSmart().getName());
            Console.WriteLine("Dumbphone: " + factory.GetDumb().getName());
        }
        public void CheckProducts()
        {
            switch (this.manufacturer)
            {
                case Manufacturer.Samsung:
                    this.factory = new SamsungFactory();
                    break;
                case Manufacturer.Htc:
                    this.factory = new HtcFactory();
                    break;
                case Manufacturer.Nokia:
                    this.factory = new NokiaFactory();
                    break;
                default:
                    throw new ArgumentOutOfRangeException("Unsupported type of Factory");
            }

            Console.WriteLine(this.manufacturer.ToString());
            Console.WriteLine($"Smart Phone: {this.factory.GetSmartPhone().Name()}");
            Console.WriteLine($"Simple Phone: {this.factory.GetSimplePhone().Name()}");
        }
Пример #20
0
        public PhoneTypeChecker(Manufacturers m)
        {
            manu = m;

            if (manu == Manufacturers.SAMSUNG)
            {
                factory = new SamsungFactory();
            }
            else if (manu == Manufacturers.HTC)
            {
                factory = new HTCFactory();
            }
            else if (manu == Manufacturers.NOKIA)
            {
                factory = new NokiaFactory();
            }
            else
            {
                factory = null;
            }
        }
Пример #21
0
        public void CheckPhone(string brand)
        {
            switch (brand)
            {
            case "Nokia":
                factory = new NokiaFactory();
                break;

            case "Htc":
                factory = new HTCFactory();
                break;

            case "Samsung":
                factory = new SamsungFactory();
                break;

            default:
                break;
            }

            Console.WriteLine($"Basic Phone available is {factory.GetBasic().GetName()}. Smart phone available is {factory.GetSmart().GetName()}");
        }
Пример #22
0
        public void CheckProducts()
        {
            if (Manu == Manufacturers.HTC)
            {
                Factory = new HTCFactory();
                Console.WriteLine($"The dumb phone for HTC is the {Factory.GetDumb().GetName()}");
                Console.WriteLine($"The smart phone for HTC is the {Factory.GetSmart().GetName()}");
            }

            if (Manu == Manufacturers.NOKIA)
            {
                Factory = new NokiaFactory();
                Console.WriteLine($"The dumb phone for Nokia is the {Factory.GetDumb().GetName()}");
                Console.WriteLine($"The smart phone for Nokia is the {Factory.GetSmart().GetName()}");
            }

            if (Manu == Manufacturers.SAMSUNG)
            {
                Factory = new SamsungFactory();
                Console.WriteLine($"The dumb phone for Samsung is the {Factory.GetDumb().GetName()}");
                Console.WriteLine($"The smart phone for Samsung is the {Factory.GetSmart().GetName()}");
            }
        }
    public void ListPhones()
    {
        switch (vendor)
        {
            case VENDORS.SAMSUNG:
                factory = new SamsungFactory();
                break;
            case VENDORS.HTC:
                factory = new HTCFactory();
                break;
            case VENDORS.NOKIA:
                factory = new NokiaFactory();
                break;
            case VENDORS.APPLE:
                factory = new AppleFactory();
                break;
        }

        Console.WriteLine(vendor.ToString() + ":" +
            "\nSmart Phone: " + factory.GetSmart().Name() +
            "\nDumb Phone: " + factory.GetDumb().Name() + "\n");
    }
Пример #24
0
 void CheckProducts(IPhoneFactory factory)
 {
     factory.GetSmart();
     factory.GetDumb();
 }
Пример #25
0
 public PhoneClient(IPhoneFactory phoneFactory, string phoneType)
 {
     _phone       = phoneFactory.GetPhone(phoneType);
     _cordedPhone = phoneFactory.GetCordedPhone(phoneType);
 }
        public void CheckProduct()
        {
            switch (_userChoice)
            {
                case Manufacturer.Nokia:
                    {
                        _factory = new Nokia();
                        break;
                    }
                case Manufacturer.Samsung:
                    {
                        _factory = new Samsung();
                        break;
                    }
            }

            Console.WriteLine(_factory.ToString() + " Smart Phone : " + _factory.GetSmart().Name() + "\n  Dumb Phone :" + _factory.GetDumb().Name());
        }
Пример #27
0
 /// <summary>
 /// Creates new instance of Phone Client class
 /// </summary>
 /// <param name="phoneFactory"></param>
 public PhoneClient(IPhoneFactory phoneFactory)
 {
     _smartPhone  = phoneFactory.GetSmartPhone();
     _normalPhone = phoneFactory.GetNormalPhone();
 }
Пример #28
0
 /// <summary>
 /// This method provide its details using passed parameter
 /// </summary>
 /// <param name="iPhoneFactory">Object whose details need to view</param>
 public void CheckProducts(IPhoneFactory iPhoneFactory)
 {
     Console.WriteLine("Smart Phone: " + iPhoneFactory.GetSmart().Name() + "\nDumb Phone: " + iPhoneFactory.GetDumb().Name());
 }