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(); }
/// <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()); }
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(); }
public override void SerializeTo(IDictionary <string, string> serializableInfo) { serializableInfo.Add("GoodsId", GoodsId.ToString()); serializableInfo.Add("ReservationId", ReservationId.ToString()); }