public Good(GoodTypes goodType, string name, int currentPrice, int numInStock)
 {
     this.goodType     = goodType;
     this.name         = name;
     this.currentPrice = currentPrice;
     this.numInStock   = numInStock;
 }
Ejemplo n.º 2
0
        public async Task <PaginatedList <Good> > GetWithSpecificType(GoodTypes type)
        {
            var goods = getSorted().Where(s => s.Contains(SearchString)).AsNoTracking();
            var items = await goods.ToListAsync();

            var newList   = items.Where(x => x.Type == type).ToList();
            var count     = newList.Count;
            var p         = new RepositoryPage(count, PageIndex, PageSize);
            var finalList = newList.Skip(p.FirstItemIndex).Take(p.PageSize).ToList();

            return(createList(finalList, p));
        }
Ejemplo n.º 3
0
 internal long CreateGroup(GoodGroup group)
 {
     using (var db = Base.storeDataBaseContext)
     {
         var groupInserting = new GoodTypes
         {
             imageUrl = group.imageUrl,
             info     = group.info,
             name     = group.name
         };
         db.GoodTypes.InsertOnSubmit(groupInserting);
         db.SubmitChanges();
         group.id = groupInserting.id;
         return(groupInserting.id);
     }
 }
Ejemplo n.º 4
0
        public static Good Create(string id, string name, string code, string description, string price,
                                  GoodTypes type, byte[] imgData = null, string imgName = null, DateTime?validFrom = null, DateTime?validTo = null)
        {
            GoodsData o = new GoodsData
            {
                ID          = id,
                Name        = name,
                Code        = code,
                Description = description,
                Type        = type,
                Price       = price,
                ImgData     = imgData,
                ImgName     = imgName,
                ValidFrom   = validFrom ?? DateTime.MinValue,
                ValidTo     = validTo ?? DateTime.MaxValue
            };

            return(new Good(o));
        }
Ejemplo n.º 5
0
 public DbSet <TEntity> SetOf <TEntity>() where TEntity : Entity
 {
     if (Accounts is IEnumerable <TEntity> )
     {
         return(Accounts as DbSet <TEntity>);
     }
     else if (Bills is IEnumerable <TEntity> )
     {
         Accounts.Load();
         return(Bills as DbSet <TEntity>);
     }
     else if (Goods is IEnumerable <TEntity> )
     {
         Importances.Load();
         GoodTypes.Load();
         return(Goods as DbSet <TEntity>);
     }
     else if (Importances is IEnumerable <TEntity> )
     {
         return(Importances as DbSet <TEntity>);
     }
     else if (GoodTypes is IEnumerable <TEntity> )
     {
         return(GoodTypes as DbSet <TEntity>);
     }
     else if (Users is IEnumerable <TEntity> )
     {
         Bills.Load();
         Goods.Load();
         return(Users as DbSet <TEntity>);
     }
     else
     {
         throw new ArgumentException();
     }
 }
 public Woman(GoodTypes goodType, string name, int currentPrice, int numInStock)
     : base(goodType, name, currentPrice, numInStock)
 {
     goodType        = GoodTypes.Woman;
     cargoSpaceTaken = 10;
 }
Ejemplo n.º 7
0
 public Good(string name, decimal price, GoodTypes type) : this(name, price)
 {
     Type = new GoodType(type);
 }
Ejemplo n.º 8
0
 public GoodType(GoodTypes type)
 {
     Item = type.ToString();
 }