Exemple #1
0
 void CheckPurchaseType(PurchaseTypes purchaseType, short purchaseGroupId)
 {
     if (PurchaseType != purchaseType || PurchaseGroupId != purchaseGroupId)
     {
         throw new ArgumentException("Invalid purchase type");
     }
 }
 PurchaseInfo(PurchaseTypes purchaseType, int itemId, string description, short purchaseId, long price)
 {
     PurchaseType    = purchaseType;
     PurchaseItemId  = itemId;
     PurchaseGroupId = purchaseId;
     Description     = description;
     Price           = price;
 }
Exemple #3
0
        protected AccountPurchase(PurchaseTypes purchaseType, PurchaseInfo purchase)
        {
            PurchaseType    = purchaseType;
            PurchaseGroupId = purchase.PurchaseGroupId;

            if (purchase.PurchaseType != PurchaseType)
            {
                throw new ArgumentException("Invalid purchase type");
            }
        }
Exemple #4
0
 public void SetTypes(IEnumerable <PurchaseType> purchaseType)
 {
     foreach (var p in purchaseType)
     {
         PurchaseTypes.Add(new SelectListItem()
         {
             Value = p.PurchaseTypeId.ToString(),
             Text  = p.Description
         });
     }
 }
Exemple #5
0
 public void SetPurchaseTypes(IEnumerable <PurchaseType> purchaseTypes)
 {
     foreach (var purchaseType in purchaseTypes)
     {
         PurchaseTypes.Add(new SelectListItem()
         {
             Value = purchaseType.PurchaseTypeId.ToString(),
             Text  = purchaseType.Type
         });
     }
 }
 public PurchaseInfo(Unpacker unpacker)
 {
     unpacker.UnpackUshort(); // version
     PurchaseType = (PurchaseTypes)unpacker.UnpackByte();
     unpacker.Unpack(out PurchaseItemId);
     unpacker.Unpack(out PurchaseGroupId);
     unpacker.Unpack(out Description);
     unpacker.Unpack(out Price);
     if (PurchaseType == PurchaseTypes.Subscription)
     {
         unpacker.Unpack(out Duration);
     }
 }
Exemple #7
0
        public PurchaseVehicleModel CreatePurchaseVehicleModel(int Id)
        {
            PurchaseVehicleModel model = new PurchaseVehicleModel();

            model.PurchaseViewModel = new PurchaseViewModel();
            model.States            = new List <string>();
            model.PurchaseTypes     = new List <string>();

            model.PurchaseTypes         = PurchaseTypes.GetPurchaseTypes();
            model.States                = States.GetStates();
            model.CarId                 = Id;
            model.PurchaseViewModel.Car = _carsRepo.GetCarById(Id);
            model.SalePrice             = model.PurchaseViewModel.Car.SalePrice;
            model.MSRP = model.PurchaseViewModel.Car.MSRP;
            model.PurchaseViewModel.Model        = _modelRepo.GetModelById(model.PurchaseViewModel.Car.ModelId).ModelName;
            model.PurchaseViewModel.Make         = _makeRepo.GetMakeById(model.PurchaseViewModel.Car.MakeId.ToString()).MakeName;
            model.PurchaseViewModel.IntColor     = _colorRepo.GetColorById(model.PurchaseViewModel.Car.InteriorColorId).ColorName;
            model.PurchaseViewModel.BodyColor    = _colorRepo.GetColorById(model.PurchaseViewModel.Car.BodyColorId).ColorName;
            model.PurchaseViewModel.BodyStyle    = _bodyStyleRepository.GetBodyStyleById(model.PurchaseViewModel.Car.BodyStyleId).BodyStyleType;
            model.PurchaseViewModel.Transmission = _transmissionRepository.GetTransmissionById(model.PurchaseViewModel.Car.TransmissionId).TransmissionType;

            return(model);
        }
 public override void UnpackTransactionData(Unpacker unpacker, ushort size)
 {
     base.UnpackTransactionData(unpacker, size);
     RequiredPurchaseType    = (PurchaseTypes)unpacker.UnpackByte();
     RequiredPurchaseGroupId = unpacker.UnpackShort();
 }
 public PurchaseType GetPurchaseType(int id) => PurchaseTypes.Single(p => p.Id == id);
 public List <PurchaseType> GetAllPurchaseTypes() => PurchaseTypes.ToList();