Ejemplo n.º 1
0
        public OrderCalculationGoodsModel(SingleGoods model, int quantity)
        {
            GoodsId        = model.GoodsId;
            SingleGoodsId  = model.Id;
            Quantity       = quantity;
            GoodsName      = model.Goods.Name;
            GoodsAttribute = string.Join(",", model.Attributes.Select(me => me.AttributeValue).ToList());
            Price          = model.Goods.IsGroupon ? ((model.Goods.GrouponStartTime <= DateTime.Now && DateTime.Now <= model.Goods.GrouponEndTime) ? model.GrouponPrice : model.Price) : model.Price;

            var fileService = HostConstObject.Container.Resolve <IStorageFileService>();

            var goodsImage = fileService.GetFiles(SingleGoodsId, MallModule.Instance.InnerKey, GoodsId.ToString()).FirstOrDefault() ??
                             fileService.GetFiles(GoodsId, MallModule.Key, "MainImage").FirstOrDefault();

            GoodsImage = goodsImage?.Simplified();
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            if (GoodsId == Guid.Empty)
            {
                return(base.GetHashCode());
            }
            string stringRepresentation = System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName + "#" + GoodsId.ToString();

            return(stringRepresentation.GetHashCode());
        }
Ejemplo n.º 3
0
        public OrderCalculationGoodsModel(Cart model)
        {
            GoodsId        = model.GoodsId;
            SingleGoodsId  = model.SingleGoodsId;
            Quantity       = model.Quantity;
            GoodsName      = model.GoodsName;
            GoodsAttribute = model.GoodsAttribute;
            Price          = model.Price;

            var fileService = HostConstObject.Container.Resolve <IStorageFileService>();

            var goodsImage = fileService.GetFiles(SingleGoodsId, MallModule.Instance.InnerKey, GoodsId.ToString()).FirstOrDefault() ??
                             fileService.GetFiles(GoodsId, MallModule.Key, "MainImage").FirstOrDefault();

            GoodsImage = goodsImage?.Simplified();
        }
Ejemplo n.º 4
0
 public override void SerializeTo(IDictionary <string, string> serializableInfo)
 {
     serializableInfo.Add("GoodsId", GoodsId.ToString());
     serializableInfo.Add("ReservationId", ReservationId.ToString());
 }