예제 #1
0
        public JewelryExtra(JewelryExtraInitializerParameterObject initJewelExtra, ItemInitializerParameterObject item)
        {
            CS = new JewelComponentProperty()
                     {
                         Description = initJewelExtra.CS_Description,
                         Clarity = initJewelExtra.CS_Clarity,
                         ClarityFreeText = initJewelExtra.CS_ClarityFreeText,
                         Color = initJewelExtra.CS_Color,
                         ColorFreeText = initJewelExtra.CS_ColorFreeText,
                         Count = initJewelExtra.CS_Count,
                         Cut = initJewelExtra.CS_Cut,
                         Type = initJewelExtra.CS_Type,
                         Weight = initJewelExtra.CS_Weight

                     };

            SS = new JewelComponentProperty()
                     {
                         Description = initJewelExtra.SS_Description,
                         Clarity = initJewelExtra.SS_Clarity,
                         ClarityFreeText = initJewelExtra.SS_ClarityFreeText,
                         Color = initJewelExtra.SS_Color,
                         ColorFreeText = initJewelExtra.SS_ColorFreeText,
                         Count = initJewelExtra.SS_Count,
                         Cut = initJewelExtra.SS_Cut,
                         Type = initJewelExtra.SS_Type,
                         Weight = initJewelExtra.SS_Weight
                     };

            HasSideStones = initJewelExtra.HasSideStones;
            TotalWeight = initJewelExtra.TotalWeight;
        }
예제 #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;
        }
예제 #3
0
        public JewelryExtra(JewelryExtraInitializerParameterObject initJewelExtra, ItemInitializerParameterObject item)
        {
            CS = new JewelComponentProperty()
            {
                Description     = initJewelExtra.CS_Description,
                Clarity         = initJewelExtra.CS_Clarity,
                ClarityFreeText = initJewelExtra.CS_ClarityFreeText,
                Color           = initJewelExtra.CS_Color,
                ColorFreeText   = initJewelExtra.CS_ColorFreeText,
                Count           = initJewelExtra.CS_Count,
                Cut             = initJewelExtra.CS_Cut,
                Type            = initJewelExtra.CS_Type,
                Weight          = initJewelExtra.CS_Weight
            };

            SS = new JewelComponentProperty()
            {
                Description     = initJewelExtra.SS_Description,
                Clarity         = initJewelExtra.SS_Clarity,
                ClarityFreeText = initJewelExtra.SS_ClarityFreeText,
                Color           = initJewelExtra.SS_Color,
                ColorFreeText   = initJewelExtra.SS_ColorFreeText,
                Count           = initJewelExtra.SS_Count,
                Cut             = initJewelExtra.SS_Cut,
                Type            = initJewelExtra.SS_Type,
                Weight          = initJewelExtra.SS_Weight
            };

            HasSideStones = initJewelExtra.HasSideStones;
            TotalWeight   = initJewelExtra.TotalWeight;
        }
예제 #4
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;
        }
예제 #5
0
 private decimal DecideWhichPriceToUseAsCurrent(ItemInitializerParameterObject initObj)
 {
     if (initObj.OnSpecial)
     {
         return(initObj.SpecialPrice);
     }
     return(initObj.RegularPrice);
 }
예제 #6
0
 private decimal DecideWhichPriceToUseAsCurrent(ItemInitializerParameterObject initObj)
 {
     if (initObj.OnSpecial)
     {
         return initObj.SpecialPrice;
     }
     return initObj.RegularPrice;
 }
예제 #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;
        }
예제 #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);
        }
예제 #9
0
 public void Initialize()
 {
     itemInitializerParameterObject = FakeItemInitializerFactory.ItemInitializerParameterObject;
 }