예제 #1
0
        public static AvailableListing CreateAvailableListing(ApplicationDbContext db, IPrincipal user, string itemDescription, ItemCategoryEnum itemCategory, ItemTypeEnum itemType, decimal quantityRequired, string uom, DateTime?availableFrom, DateTime?availableTo, ItemConditionEnum itemCondition, DateTime?displayUntilDate, DateTime?sellByDate, DateTime?useByDate, bool?deliveryAvailable, ItemRequiredListingStatusEnum listingStatus)
        {
            BranchUser branchUser = BranchUserHelpers.GetBranchUserCurrentForUser(db, user);
            Branch     branch     = BranchHelpers.GetBranch(db, branchUser.BranchId);

            AvailableListing AvailableListing = new AvailableListing()
            {
                ListingId           = Guid.NewGuid(),
                ItemDescription     = itemDescription,
                ItemCategory        = itemCategory,
                ItemType            = itemType,
                QuantityRequired    = quantityRequired,
                QuantityFulfilled   = 0,
                QuantityOutstanding = quantityRequired,
                UoM                        = uom,
                AvailableFrom              = availableFrom,
                AvailableTo                = availableTo,
                ItemCondition              = itemCondition,
                DisplayUntilDate           = displayUntilDate,
                SellByDate                 = sellByDate,
                UseByDate                  = useByDate,
                DeliveryAvailable          = deliveryAvailable ?? false,
                ListingBranchPostcode      = branch.AddressPostcode,
                ListingOriginatorAppUserId = branchUser.UserId,
                ListingOriginatorBranchId  = branchUser.BranchId,
                ListingOriginatorCompanyId = branchUser.CompanyId,
                ListingOriginatorDateTime  = DateTime.Now,
                ListingStatus              = ItemRequiredListingStatusEnum.Open
            };

            db.AvailableListings.Add(AvailableListing);
            db.SaveChanges();

            return(AvailableListing);
        }
예제 #2
0
 public Armour(string _name, uint _basePrice, uint _encumbrance, uint _rarity, ItemConditionEnum _condition,
               Dictionary <ItemQuality, uint> _qualities, List <GenreEnum> _availableGenres, string _descriptionKey, bool _isEquipped,
               Value _soak, Defense _defense)
     : base(_name, _basePrice, _encumbrance, _rarity, _condition, _qualities, _availableGenres, _descriptionKey, _isEquipped, _soak, _defense)
 {
     WfLogger.Log(this, LogLevel.DETAILED, "Created new Armour " + this._nameKey);
 }
예제 #3
0
        public static AvailableListing CreateAvailableListing(IPrincipal user, string itemDescription, ItemCategoryEnum itemCategory, ItemTypeEnum itemType, decimal quantityRequired, string uom, DateTime?availableFrom, DateTime?availableTo, ItemConditionEnum itemCondition, DateTime?displayUntilDate, DateTime?sellByDate, DateTime?useByDate, bool?deliveryAvailable, ItemRequiredListingStatusEnum listingStatus)
        {
            ApplicationDbContext db = new ApplicationDbContext();
            AvailableListing     newAvailableListing = CreateAvailableListing(db, user, itemDescription, itemCategory, itemType, quantityRequired, uom, availableFrom, availableTo, itemCondition, displayUntilDate, sellByDate, useByDate, deliveryAvailable, listingStatus);

            db.Dispose();
            return(newAvailableListing);
        }
예제 #4
0
        public EquipmentItem(string _nameKey, uint _basePrice, uint _encumbrance, uint _rarity, ItemConditionEnum _condition,
                             Dictionary <ItemQuality, uint> _qualities, List <GenreEnum> _availableGenres, string _descriptionKey, bool _isEquipped)
            : base(_nameKey, _basePrice, _encumbrance, _rarity, _condition, _qualities, _availableGenres, _descriptionKey)
        {
            this._isEquipped = _isEquipped;

            WfLogger.Log(this, LogLevel.DETAILED, "Created new EquipmentItem " + this._nameKey);
        }
예제 #5
0
        public PAPIItem(string _nameKey, uint _basePrice, uint _encumbrance, uint _rarity, ItemConditionEnum _condition, Dictionary <ItemQuality, uint> _qualities,
                        List <GenreEnum> _availableGenres, string _descriptionKey)
        {
            this._nameKey         = (_nameKey == null || _nameKey == "") ? "INVALID_ITEM" : _nameKey;
            this._basePrice       = _basePrice;
            this._encumbrance     = _encumbrance;
            this._rarity          = (_rarity > 5) ? 5 : _rarity;
            this._condition       = _condition;
            this._qualities       = (_qualities == null) ? new Dictionary <ItemQuality, uint>() : _qualities;
            this._availableGenres = (_availableGenres == null || _availableGenres.Count == 0) ?
                                    new List <GenreEnum>(PAPIApplication.GetAllGenres()) : _availableGenres;
            this._descriptionKey = (_descriptionKey == null) ? "INVALIID_DESCRIPTION" : _descriptionKey;

            WfLogger.Log(this, LogLevel.DETAILED, "PAPIItem '" + this._nameKey + "' was created");
        }
예제 #6
0
        public Weapon(string _name, uint _basePrice, uint _encumbrance, uint _rarity, ItemConditionEnum _condition, Dictionary <ItemQuality, uint> _qualities,
                      List <GenreEnum> _availableGenres, string _descriptionKey, bool _isEquipped, WeaponHandTypeEnum _handType, SkillEnum _requiredSkill, uint _damage,
                      uint _critialRating, RangeEnum _range)
            : base(_name, _basePrice, _encumbrance, _rarity, _condition, _qualities, _availableGenres, _descriptionKey, _isEquipped)
        {
            this._handType       = _handType;
            this._requiredSkill  = _requiredSkill;
            this._damage         = _damage;
            this._criticalRating = _criticalRating;
            this._range          = _range;

            WfLogger.Log(this, LogLevel.DETAILED, "Created new Weapon " + this._nameKey);
        }
예제 #7
0
        public Backpack(string _name, uint _basePrice, uint _encumbrance, uint _rarity, ItemConditionEnum _condition, Dictionary <ItemQuality, uint> _qualities,
                        List <GenreEnum> _availableGenres, string _descriptionKey, uint _capacity) :
            base(_name, _basePrice, _encumbrance, _rarity, _condition, _qualities, _availableGenres, _descriptionKey)
        {
            this._capacity = _capacity;

            WfLogger.Log(this, LogLevel.DETAILED, "A new backpack with capacity " + this._capacity + " was created");
        }