예제 #1
0
        public IPresentableSet<Product> SearchNormal(int? productId, string productName, bool? discontinued, Category category, Supplier supplier)
        {
            IQueryable<Product> queryable = _northwind.GetCurrentSession().Linq<Product>();
            if(productId != default(int?))
            {
                queryable = queryable.Where(x => x.ProductId == productId);
            }
            if(!string.IsNullOrEmpty(productName))
            {
                queryable = queryable.Where(x => x.ProductName.StartsWith(productName));
            }
            if(discontinued != default(bool?))
            {
                queryable = queryable.Where(x => x.Discontinued == discontinued);
            }
            if(category != default(Category))
            {
                queryable = queryable.Where(x => x.Category == category);
            }
            if(supplier != default(Supplier))
            {
                queryable = queryable.Where(x => x.Supplier == supplier);
            }

            return new QueryablePresentableSet<Product>(queryable);
        }
 private object BuildReferenceDto(Supplier item)
 {
     return new{
         StringId = _stringConverter.ToString(item),
         Description = item.ToString(),
     };
 }
예제 #3
0
        public IQueryable<Product> SearchNormal(int? productId, string productName, string quantityPerUnit, decimal? unitPrice, short? unitsInStock, short? unitsOnOrder, short? reorderLevel, bool? discontinued, Category category, Supplier supplier)
        {
            IQueryable<Product> queryable = _Northwind.Linq<Product>();
            if (productId != default(int?))
            {
                queryable = queryable.Where(x => x.ProductId == productId);
            }
            if (productName != default(string))
            {
                queryable = queryable.Where(x => x.ProductName == productName);
            }
            if (quantityPerUnit != default(string))
            {
                queryable = queryable.Where(x => x.QuantityPerUnit == quantityPerUnit);
            }
            if (unitPrice != default(decimal?))
            {
                queryable = queryable.Where(x => x.UnitPrice == unitPrice);
            }
            if (unitsInStock != default(short?))
            {
                queryable = queryable.Where(x => x.UnitsInStock == unitsInStock);
            }
            if (unitsOnOrder != default(short?))
            {
                queryable = queryable.Where(x => x.UnitsOnOrder == unitsOnOrder);
            }
            if (reorderLevel != default(short?))
            {
                queryable = queryable.Where(x => x.ReorderLevel == reorderLevel);
            }
            if (discontinued != default(bool?))
            {
                queryable = queryable.Where(x => x.Discontinued == discontinued);
            }
            if (category != default(Category))
            {
                queryable = queryable.Where(x => x.Category == category);
            }
            if (supplier != default(Supplier))
            {
                queryable = queryable.Where(x => x.Supplier == supplier);
            }

            return queryable;
        }
 private object BuildFullDto(Supplier item)
 {
     return new{
         StringId = _stringConverter.ToString(item),
         item.SupplierId,
         item.CompanyName,
         item.ContactName,
         item.ContactTitle,
         item.Address,
         item.City,
         item.Region,
         item.PostalCode,
         item.Country,
         item.Phone,
         item.Fax,
         item.HomePage,
         // item.Products, // Skip bacause is collection of non detail objects
     };
 }
예제 #5
0
 public void Delete(Supplier v)
 {
     _northwind.GetCurrentSession().Delete(v);
 }
예제 #6
0
 public void Create(Supplier v)
 {
     _northwind.GetCurrentSession().Save(v);
 }
예제 #7
0
 public void Update(Supplier v)
 {
     _northwind.GetCurrentSession().Update(v);
 }
예제 #8
0
 public void Update(Supplier v)
 {
     _Northwind.Update(v);
 }
예제 #9
0
 public void Delete(Supplier v)
 {
     _Northwind.Delete(v);
 }
예제 #10
0
 public void Create(Supplier v)
 {
     _Northwind.Save(v);
 }
 public string ToString(Supplier obj)
 {
     return obj.SupplierId.ToString();
 }
예제 #12
0
 public virtual bool Equals(Supplier other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     if (SupplierId != default(int))
     {
         return other.SupplierId == SupplierId;
     }
     return other.SupplierId == SupplierId && other.CompanyName == CompanyName && other.ContactName == ContactName && other.ContactTitle == ContactTitle && other.Address == Address && other.City == City && other.Region == Region && other.PostalCode == PostalCode && other.Country == Country && other.Phone == Phone && other.Fax == Fax && other.HomePage == HomePage && 1 == 1;
 }