Ejemplo n.º 1
0
        public RodSetOutput Calculate(RodSetInput input)
        {
            Product p = new Product(null, null, null, true);
            F92_1ProductCollection products = new F92_1ProductCollection();

            p = products.Initialize(p, true);
            ReadyMadeProduct bracket = p.ReadyMadeProduct.Find(x => x.Name == Constant.Bracket);
            ReadyMadeProduct endcap  = p.ReadyMadeProduct.Find(x => x.Name == Constant.EndCap);

            RodSetOutput output = CalculateRod(input);

            output = CalculateEndcapBracket(output, 1, bracket, endcap);
            return(output);
        }
Ejemplo n.º 2
0
        private RodSetOutput HandleEndcapBracket(RodSetOutput result, ReadyMadeProduct product)
        {
            int     option = 0;
            Product p      = new Product(null, null, null, true);

            switch (product.Name)
            {
            case Constant.RodKayuHitam:
            case Constant.RodKayuCoco:
                option = 1;
                F92_1ProductCollection f92_1ProductCollection = new F92_1ProductCollection();
                p = f92_1ProductCollection.Initialize(p, true);
                break;

            case Constant.RodKayuPutih:
                option = 2;
                F93_1ProductCollection f93_1ProductCollection = new F93_1ProductCollection();
                p = f93_1ProductCollection.Initialize(p, true);
                break;

            case Constant.RodAluminiumMeroon:
            case Constant.RodAluminiumHitam:
            case Constant.RodAluminiumKokoGelap:
            case Constant.RodAluminiumPutih:
            case Constant.RodAluminiumSilverRose:
                option = 3;
                F94_1ProductCollection f94_1ProductCollection = new F94_1ProductCollection();
                p = f94_1ProductCollection.Initialize(p, true);
                break;
            }

            ReadyMadeProduct bracket = p.ReadyMadeProduct.Find(x => x.Name == Constant.Bracket);
            ReadyMadeProduct endcap  = p.ReadyMadeProduct.Find(x => x.Name == Constant.EndCap);

            // A hack to make name become meter for using CalculateEndcapBracket method
            string tempNameStorage = result.ReadyMadeProduct[0].Name;

            result.ReadyMadeProduct[0].Name = result.ReadyMadeProduct[0].Meter.ToString();

            result = CalculateEndcapBracket(result, option, bracket, endcap);
            result.ReadyMadeProduct[0].Name = tempNameStorage;

            return(result);
        }
Ejemplo n.º 3
0
        public IEnumerable <Product> GetRodProduct()
        {
            Product p85_1 = new Product("F92_1", "Rod Kayu Hitam", Constant.DefaultCurtainImage, true);
            F92_1ProductCollection f92_1ProductCollection = new F92_1ProductCollection();

            p85_1 = f92_1ProductCollection.Initialize(p85_1, true);

            Product p85_2 = new Product("F92_1", "Rod Kayu Coco", Constant.DefaultCurtainImage, true);

            p85_2 = f92_1ProductCollection.Initialize(p85_2, true);

            Product p86_1 = new Product("F92_2", "Rod Kayu Hitam (siap pasang)", Constant.DefaultCurtainImage, true);
            F92_2ProductCollection f92_2ProductCollection = new F92_2ProductCollection();

            p86_1 = f92_2ProductCollection.Initialize(p86_1, true);

            Product p86_2 = new Product("F92_2", "Rod Kayu Coco (siap pasang)", Constant.DefaultCurtainImage, true);

            p86_2 = f92_2ProductCollection.Initialize(p86_2, true);

            Product p87 = new Product("F93_1", "Rod Kayu Putih", Constant.DefaultCurtainImage, true);
            F93_1ProductCollection f93_1ProductCollection = new F93_1ProductCollection();

            p87 = f93_1ProductCollection.Initialize(p87, true);

            Product p88 = new Product("F93_2", "Rod Kayu Putih (siap pasang)", Constant.DefaultCurtainImage, true);
            F93_2ProductCollection f93_2ProductCollection = new F93_2ProductCollection();

            p88 = f93_2ProductCollection.Initialize(p88, true);

            Product p89_1 = new Product("F94_1", "Rod Aluminium Meroon", Constant.DefaultCurtainImage, true);
            F94_1ProductCollection f94_1ProductCollection = new F94_1ProductCollection();

            p89_1 = f94_1ProductCollection.Initialize(p89_1, true);

            Product p89_2 = new Product("F94_1", "Rod Aluminium Silver Rose", Constant.DefaultCurtainImage, true);

            p89_2 = f94_1ProductCollection.Initialize(p89_2, true);

            Product p89_3 = new Product("F94_1", "Rod Aluminium Putih", Constant.DefaultCurtainImage, true);

            p89_3 = f94_1ProductCollection.Initialize(p89_3, true);

            Product p89_4 = new Product("F94_1", "Rod Aluminium Koko Gelap", Constant.DefaultCurtainImage, true);

            p89_4 = f94_1ProductCollection.Initialize(p89_4, true);

            Product p89_5 = new Product("F94_1", "Rod Aluminium Hitam", Constant.DefaultCurtainImage, true);

            p89_5 = f94_1ProductCollection.Initialize(p89_5, true);

            Product p90_1 = new Product("F94_2", "Rod Aluminium Meroon (siap pasang)", Constant.DefaultCurtainImage, true);
            F94_2ProductCollection f94_2ProductCollection = new F94_2ProductCollection();

            p90_1 = f94_2ProductCollection.Initialize(p90_1, true);

            Product p90_2 = new Product("F94_2", "Rod Aluminium Silver Rose (siap pasang)", Constant.DefaultCurtainImage, true);

            p90_2 = f94_2ProductCollection.Initialize(p90_2, true);

            Product p90_3 = new Product("F94_2", "Rod Aluminium Putih (siap pasang)", Constant.DefaultCurtainImage, true);

            p90_3 = f94_2ProductCollection.Initialize(p90_3, true);

            Product p90_4 = new Product("F94_2", "Rod Aluminium Koko Gelap (siap pasang)", Constant.DefaultCurtainImage, true);

            p90_4 = f94_2ProductCollection.Initialize(p90_4, true);

            Product p90_5 = new Product("F94_2", "Rod Aluminium Hitam (siap pasang)", Constant.DefaultCurtainImage, true);

            p90_5 = f94_2ProductCollection.Initialize(p90_5, true);

            Product p91 = new Product("F97", "Rail", Constant.DefaultCurtainImage, true);
            F97ProductCollection f97ProductCollection = new F97ProductCollection();

            p91 = f97ProductCollection.Initialize(p91);

            List <Product> products = new List <Product>();

            products.Add(p85_1);
            products.Add(p85_2);
            products.Add(p86_1);
            products.Add(p86_2);
            products.Add(p87);
            products.Add(p88);
            products.Add(p89_1);
            products.Add(p89_2);
            products.Add(p89_3);
            products.Add(p89_4);
            products.Add(p89_5);
            products.Add(p90_1);
            products.Add(p90_2);
            products.Add(p90_3);
            products.Add(p90_4);
            products.Add(p90_5);
            products.Add(p91);
            return(products);
        }