Esempio n. 1
0
        public Jewel(ItemInitializerParameterObject itemInitializerParameterObject, Media media, Metal metal, JewelryExtra extra, JewelMediaType jewelMediaSets)
        {
            Media = media;
            ID    = itemInitializerParameterObject.ID;

            JewelCategory      = itemInitializerParameterObject.JewelryCategory;
            JewelSubCategory   = itemInitializerParameterObject.JewelrySubCategory;
            JewelCategoryID    = itemInitializerParameterObject.JewelryCategoryID;
            JewelSubCategoryID = itemInitializerParameterObject.JewelrySubCategoryID;


            ItemNumber = itemInitializerParameterObject.ItemNumber;

            Metal = metal;

            Price        = itemInitializerParameterObject.Price;
            SpecialPrice = itemInitializerParameterObject.SpecialPrice;
            DealerPrice  = itemInitializerParameterObject.DealerPrice;
            RegularPrice = itemInitializerParameterObject.RegularPrice;
            Title        = itemInitializerParameterObject.Title;
            Weight       = itemInitializerParameterObject.Weight;

            Width = itemInitializerParameterObject.Width;

            IsBestOffer = itemInitializerParameterObject.OnBargain;
            IsSpecial   = itemInitializerParameterObject.OnSpecial;

            JewelryExtra = extra;



            MediaSetsOwnedByJewel = jewelMediaSets;
        }
Esempio n. 2
0
        public Jewel(ItemInitializerParameterObject itemInitializerParameterObject, Media media, Metal metal, JewelryExtra extra,JewelMediaType jewelMediaSets)
        {
            Media = media;
            ID = itemInitializerParameterObject.ID;

            JewelCategory = itemInitializerParameterObject.JewelryCategory;
            JewelSubCategory = itemInitializerParameterObject.JewelrySubCategory;
            JewelCategoryID = itemInitializerParameterObject.JewelryCategoryID;
            JewelSubCategoryID = itemInitializerParameterObject.JewelrySubCategoryID;

            ItemNumber = itemInitializerParameterObject.ItemNumber;

            Metal = metal;

            Price = itemInitializerParameterObject.Price;
            SpecialPrice = itemInitializerParameterObject.SpecialPrice;
            DealerPrice = itemInitializerParameterObject.DealerPrice;
            RegularPrice = itemInitializerParameterObject.RegularPrice;
            Title = itemInitializerParameterObject.Title;
            Weight = itemInitializerParameterObject.Weight;

            Width = itemInitializerParameterObject.Width;

            IsBestOffer = itemInitializerParameterObject.OnBargain;
            IsSpecial = itemInitializerParameterObject.OnSpecial;

            JewelryExtra = extra;

            MediaSetsOwnedByJewel = jewelMediaSets;
        }
Esempio n. 3
0
        public void Constructor_ShouldReturnRightCSColorFreeText()
        {
            //Arrange
            var initJewelExtra = JewelryExtraInitializerParameterFactory();
            var initObj = fixture.CreateAnonymous<ItemInitializerParameterObject>();
            //Act

            var jewelExtra = new JewelryExtra(initJewelExtra, initObj);

            //Assert

            jewelExtra.CS.ColorFreeText.Should().Be("CSFreeColor");
        }
Esempio n. 4
0
        public void Constructor_ShouldReturnRightTotalWeight()
        {
            //Arrange
            var initJewelExtra = JewelryExtraInitializerParameterFactory();
            var initObj = fixture.CreateAnonymous<ItemInitializerParameterObject>();
            //Act

            var jewelExtra = new JewelryExtra(initJewelExtra, initObj);

            //Assert

            jewelExtra.TotalWeight.Should().BeInRange(3.5, 3.6);
        }
Esempio n. 5
0
        public void Constructor_ShouldReturnRightSSDescription()
        {
            //Arrange
            var initJewelExtra = JewelryExtraInitializerParameterFactory();
            var initObj = fixture.CreateAnonymous<ItemInitializerParameterObject>();
            //Act

            var jewelExtra = new JewelryExtra(initJewelExtra, initObj);

            //Assert

            jewelExtra.SS.Description.Should().Be("SSDescription");
        }
Esempio n. 6
0
        public void Constructor_ShouldReturnRightHasSideStones()
        {
            //Arrange
            var initJewelExtra = JewelryExtraInitializerParameterFactory();
            var initObj = fixture.CreateAnonymous<ItemInitializerParameterObject>();
            //Act

            var jewelExtra = new JewelryExtra(initJewelExtra, initObj);

            //Assert

            jewelExtra.HasSideStones.Should().BeTrue();
        }
Esempio n. 7
0
        protected Jewel JewelClassFactory(v_jewel_items item)
        {
            var initObj = new ItemInitializerParameterObject
                              {
                ID = item.id,
                ItemNumber = item.ITEMNUMBER,
                CategoryID = item.CATEGORY_ID,
                SubCategoryID = item.SUBCATEGORY_ID,
                JewelryCategory = item.jeweltype,
                JewelryCategoryID = item.JEWELTYPE_ID,
                JewelrySubCategory = item.jewelsubtype,
                JewelrySubCategoryID = item.JEWELSUBTYPE_ID,
                SpecialPrice = item.SPECIAL_SELL_PRICE ?? 0,
                DealerPrice = item.DEALER_PRICE ?? 0,
                OnSpecial = item.ONSPECIAL ?? false,
                RegularPrice = item.price ?? 0,
                Metal = item.metal,
                Title = item.jeweltitle,
                OnBargain = item.ONBARGAIN ?? false
            };

            var initJewelExtra = new JewelryExtraInitializerParameterObject
                                     {
                                         CS_Clarity = item.clarity,
                                         CS_ClarityFreeText = item.clarity_freetxt,
                                         CS_Color = item.color,
                                         CS_ColorFreeText = item.color_freetxt,
                                         CS_Count = item.cs_count ?? 0,
                                         CS_Cut = item.cs_cut,
                                         CS_Description = item.cs_desc,
                                         CS_Type = item.cs_type,
                                         HasSideStones = item.has_sidestones ?? false,
                                         SS_Clarity = item.ss_clarity,
                                         SS_ClarityFreeText = "",
                                         SS_Color = item.ss_color,
                                         SS_ColorFreeText = "",
                                         SS_Count = item.ss_count ?? 0,
                                         SS_Cut = item.ss_cut,
                                         SS_Description = item.ss_desc,
                                         SS_Type = item.ss_type,
                                         TotalWeight = Convert.ToDouble(item.total_weight ?? 0),
                                         CS_Weight = Convert.ToDouble(item.cs_weight ?? 0),
                                         SS_Weight = Convert.ToDouble(item.ss_weight ?? 0)
                                     };

            var jewelryExtra = new JewelryExtra(initJewelExtra, initObj);

            initObj.Weight = Convert.ToDouble(item.WEIGHT);

            double tryParseJewelWidth;
            initObj.Width = double.TryParse(item.ITEM_SIZE.Trim(), out tryParseJewelWidth) ? tryParseJewelWidth : 0;

            initObj.Price = DecideWhichPriceToUseAsCurrent(initObj);

            var currrentJewelMediaType = WhichMediaDoesThisJewelHas(item.HAS_YELLOW_GOLD ?? false, item.HAS_WHITE_GOLD ?? false);

            var metal = new Metal(requestedJewelMediaTypeByUser, currrentJewelMediaType,item.metal);

            var mediaFactory = new MediaFactory(initObj.ItemNumber, settingManager);

            mediaFactory.ChangeMediaSet(requestedJewelMediaTypeByUser, currrentJewelMediaType);

            var media = mediaFactory.BuildMedia();

            var jewel = new Jewel(initObj, media, metal, jewelryExtra, currrentJewelMediaType);
            return jewel;
        }
Esempio n. 8
0
        protected Jewel JewelClassFactory(v_jewel_items item)
        {
            var initObj = new ItemInitializerParameterObject
            {
                ID                   = item.id,
                ItemNumber           = item.ITEMNUMBER,
                CategoryID           = item.CATEGORY_ID,
                SubCategoryID        = item.SUBCATEGORY_ID,
                JewelryCategory      = item.jeweltype,
                JewelryCategoryID    = item.JEWELTYPE_ID,
                JewelrySubCategory   = item.jewelsubtype,
                JewelrySubCategoryID = item.JEWELSUBTYPE_ID,
                SpecialPrice         = item.SPECIAL_SELL_PRICE ?? 0,
                DealerPrice          = item.DEALER_PRICE ?? 0,
                OnSpecial            = item.ONSPECIAL ?? false,
                RegularPrice         = item.price ?? 0,
                Metal                = item.metal,
                Title                = item.jeweltitle,
                OnBargain            = item.ONBARGAIN ?? false
            };


            var initJewelExtra = new JewelryExtraInitializerParameterObject
            {
                CS_Clarity         = item.clarity,
                CS_ClarityFreeText = item.clarity_freetxt,
                CS_Color           = item.color,
                CS_ColorFreeText   = item.color_freetxt,
                CS_Count           = item.cs_count ?? 0,
                CS_Cut             = item.cs_cut,
                CS_Description     = item.cs_desc,
                CS_Type            = item.cs_type,
                HasSideStones      = item.has_sidestones ?? false,
                SS_Clarity         = item.ss_clarity,
                SS_ClarityFreeText = "",
                SS_Color           = item.ss_color,
                SS_ColorFreeText   = "",
                SS_Count           = item.ss_count ?? 0,
                SS_Cut             = item.ss_cut,
                SS_Description     = item.ss_desc,
                SS_Type            = item.ss_type,
                TotalWeight        = Convert.ToDouble(item.total_weight ?? 0),
                CS_Weight          = Convert.ToDouble(item.cs_weight ?? 0),
                SS_Weight          = Convert.ToDouble(item.ss_weight ?? 0)
            };


            var jewelryExtra = new JewelryExtra(initJewelExtra, initObj);


            initObj.Weight = Convert.ToDouble(item.WEIGHT);

            double tryParseJewelWidth;

            initObj.Width = double.TryParse(item.ITEM_SIZE.Trim(), out tryParseJewelWidth) ? tryParseJewelWidth : 0;

            initObj.Price = DecideWhichPriceToUseAsCurrent(initObj);


            var currrentJewelMediaType = WhichMediaDoesThisJewelHas(item.HAS_YELLOW_GOLD ?? false, item.HAS_WHITE_GOLD ?? false);

            var metal = new Metal(requestedJewelMediaTypeByUser, currrentJewelMediaType, item.metal);

            var mediaFactory = new MediaFactory(initObj.ItemNumber, settingManager);

            mediaFactory.ChangeMediaSet(requestedJewelMediaTypeByUser, currrentJewelMediaType);



            var media = mediaFactory.BuildMedia();



            var jewel = new Jewel(initObj, media, metal, jewelryExtra, currrentJewelMediaType);

            return(jewel);
        }