public ProductTypeCollection FetchAll()
 {
     ProductTypeCollection coll = new ProductTypeCollection();
     Query qry = new Query(ProductType.Schema);
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }
Beispiel #2
0
        public void Get()
        {
            // ObservableCollection<Product> list = new ObservableCollection<Product>();

            try
            {
                ProductTypeCollection = db.GetProductType();
                ProductCollection     = db.GetProduct();
            }
            catch (Exception e)
            {
                MessageBox.Show("Błąd podczas pobierania danych z bazy: " + e.Message);
            }

            foreach (Product p in ProductCollection)
            {
                try
                {
                    //fu = _listaSzczegolyFaktur.Where(x => x.IdFaktury == f.Id).First();
                    p.ProductType = ProductTypeCollection.Where(x => x.Id == p.ProductTypeId).First();
                }
                catch (Exception) { }
            }

            // ProductCollectionGridView = ProductCollection;
        }
Beispiel #3
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List <ProductTypeInfo> GetPagedList(int pPageIndex, int pPageSize, SortDirection pOrderBy, string pSortExpression, out int pRecordCount)
        {
            if (pPageIndex <= 1)
            {
                pPageIndex = 1;
            }
            List <ProductTypeInfo> list = new List <ProductTypeInfo>();

            Query q = ProductType.CreateQuery();

            q.PageIndex = pPageIndex;
            q.PageSize  = pPageSize;
            q.ORDER_BY(pSortExpression, pOrderBy.ToString());
            ProductTypeCollection collection = new  ProductTypeCollection();

            collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (ProductType productType  in collection)
            {
                ProductTypeInfo productTypeInfo = new ProductTypeInfo();
                LoadFromDAL(productTypeInfo, productType);
                list.Add(productTypeInfo);
            }
            pRecordCount = q.GetRecordCount();

            return(list);
        }
Beispiel #4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        /// <returns></returns>
        public static List <ProductTypeInfo> GetList()
        {
            string cacheKey = GetCacheKey();

            //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
            if (CachedEntityCommander.IsTypeRegistered(typeof(ProductTypeInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
            {
                return(CachedEntityCommander.GetCache(cacheKey) as List <ProductTypeInfo>);
            }
            else
            {
                List <ProductTypeInfo> list       = new List <ProductTypeInfo>();
                ProductTypeCollection  collection = new  ProductTypeCollection();
                Query qry = new Query(ProductType.Schema);
                collection.LoadAndCloseReader(qry.ExecuteReader());
                foreach (ProductType productType in collection)
                {
                    ProductTypeInfo productTypeInfo = new ProductTypeInfo();
                    LoadFromDAL(productTypeInfo, productType);
                    list.Add(productTypeInfo);
                }
                //生成缓存
                if (CachedEntityCommander.IsTypeRegistered(typeof(ProductTypeInfo)))
                {
                    CachedEntityCommander.SetCache(cacheKey, list);
                }
                return(list);
            }
        }
        public void GetProductSellingPagesFull()
        {
            Assert.IsNotNull(TestData.ProductSearchResults2);
            ProductTypeCollection al = new ProductTypeCollection();

            ProductFamilyTypeCollection fm = TestData.ProductSearchResults2[0].AttributeSet[0].ProductFamilies;
            for(int i = 0; i < fm.Count; i++ )
            {
                if( fm[i].FamilyMembers != null &&
                    fm[i].FamilyMembers.Count > 0 )
                {
                    ProductType pt = fm[i].FamilyMembers[0];
                    pt.ProductReferenceID = null;
                    pt.stockPhotoURL = null;
                    al.Add(pt);
                }
            }

            GetProductSellingPagesCall api = new GetProductSellingPagesCall(this.apiContext);
            api.ProductList = al;
            api.UseCase = ProductUseCaseCodeType.AddItem;
            // Make API call.
            api.Execute();
            //check whether the call is success.
            Assert.IsTrue(api.ApiResponse.Ack==AckCodeType.Success || api.ApiResponse.Ack==AckCodeType.Warning,"do not success!");
            Assert.IsNotNull(api.ApiResponse.ProductSellingPagesData);
            Assert.Greater(api.ApiResponse.ProductSellingPagesData.Length,0);
        }
        public void GetProductSellingPages()
        {
            Assert.IsNotNull(TestData.ProductSearchResults);
            ProductTypeCollection al = new ProductTypeCollection();

            ProductFamilyTypeCollection fm = TestData.ProductSearchResults[0].AttributeSet[0].ProductFamilies;
            for(int i = 0; i < fm.Count; i++ )
            {
                if( fm[i].FamilyMembers != null &&
                    fm[i].FamilyMembers.Count > 0 )
                {
                    ProductType pt = fm[i].FamilyMembers[0];
                    pt.ProductReferenceID = null;
                    pt.stockPhotoURL = null;
                    al.Add(pt);
                    // Only retrieve 3 pages
                    if( al.Count >= 1 )
                        break;
                }
            }

            GetProductSellingPagesCall api = new GetProductSellingPagesCall(this.apiContext);
            api.ProductList = al;
            api.UseCase = ProductUseCaseCodeType.AddItem;
            // Make API call.
            String sellingPage = api.GetProductSellingPages(api.UseCase, api.ProductList);
            Assert.IsNotNull(sellingPage);
        }
Beispiel #7
0
        /// <summary>
        /// his type is deprecated as the call is no longer available.
        /// </summary>
        ///
        /// <param name="UseCase">
        /// Specifies the context in which the call is being executed, which will imply
        /// certain validation rules. Use this property to make sure you retrieve the
        /// appropriate version of product information and attribute meta-data
        /// when you are listing, revising, or relisting an item with Pre-filled Item Information.
        /// </param>
        ///
        /// <param name="ProductList">
        /// A catalog product identifies a prototype description
        /// of a well-known type of item, such as a popular book.
        /// As this call supports batch requests, you can pass in an array of products
        /// to retrieve data for several products at the same time.
        /// </param>
        ///
        public string GetProductSellingPages(ProductUseCaseCodeType UseCase, ProductTypeCollection ProductList)
        {
            this.UseCase     = UseCase;
            this.ProductList = ProductList;

            Execute();
            return(ApiResponse.ProductSellingPagesData);
        }
		/// <summary>
		/// his type is deprecated as the call is no longer available.
		/// </summary>
		/// 
		/// <param name="UseCase">
		/// Specifies the context in which the call is being executed, which will imply
		/// certain validation rules. Use this property to make sure you retrieve the
		/// appropriate version of product information and attribute meta-data
		/// when you are listing, revising, or relisting an item with Pre-filled Item Information.
		/// </param>
		///
		/// <param name="ProductList">
		/// A catalog product identifies a prototype description
		/// of a well-known type of item, such as a popular book.
		/// As this call supports batch requests, you can pass in an array of products
		/// to retrieve data for several products at the same time.
		/// </param>
		///
		public string GetProductSellingPages(ProductUseCaseCodeType UseCase, ProductTypeCollection ProductList)
		{
			this.UseCase = UseCase;
			this.ProductList = ProductList;

			Execute();
			return ApiResponse.ProductSellingPagesData;
		}
Beispiel #9
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List <ProductTypeInfo> pList, ProductTypeCollection pCollection)
 {
     foreach (ProductType productType in pCollection)
     {
         ProductTypeInfo productTypeInfo = new ProductTypeInfo();
         LoadFromDAL(productTypeInfo, productType);
         pList.Add(productTypeInfo);
     }
 }
        protected override async Task <bool> GetDataAsync()
        {
            var resource = new ProductTypeResource(Context);

            _results = await resource.GetProductTypesAsync(startIndex : StartIndex, pageSize : PageSize, sortBy : SortBy, filter : Filter, responseFields : ResponseFields);

            TotalCount = _results.TotalCount;
            PageCount  = _results.PageCount;
            PageSize   = _results.PageSize;
            return(_results.Items != null && _results.Items.Count > 0);
        }
Beispiel #11
0
        private void FillDropDowns()
        {
            CommonHelper.FillDropDownWithEnum(this.ddlDownloadActivationType, typeof(DownloadActivationTypeEnum));

            CommonHelper.FillDropDownWithEnum(this.ddlCyclePeriod, typeof(RecurringProductCyclePeriodEnum));

            this.ddlTemplate.Items.Clear();
            ProductTemplateCollection productTemplateCollection = TemplateManager.GetAllProductTemplates();

            foreach (ProductTemplate productTemplate in productTemplateCollection)
            {
                ListItem item2 = new ListItem(productTemplate.Name, productTemplate.ProductTemplateId.ToString());
                this.ddlTemplate.Items.Add(item2);
            }

            this.ddlProductType.Items.Clear();
            ProductTypeCollection productTypeCollection = ProductManager.GetAllProductTypes();

            foreach (ProductType productType in productTypeCollection)
            {
                ListItem item2 = new ListItem(productType.Name, productType.ProductTypeId.ToString());
                this.ddlProductType.Items.Add(item2);
            }

            this.ddlTaxCategory.Items.Clear();
            ListItem itemTaxCategory = new ListItem("---", "0");

            this.ddlTaxCategory.Items.Add(itemTaxCategory);
            TaxCategoryCollection taxCategoryCollection = TaxCategoryManager.GetAllTaxCategories();

            foreach (TaxCategory taxCategory in taxCategoryCollection)
            {
                ListItem item2 = new ListItem(taxCategory.Name, taxCategory.TaxCategoryId.ToString());
                this.ddlTaxCategory.Items.Add(item2);
            }

            this.ddlWarehouse.Items.Clear();
            ListItem itemWarehouse = new ListItem("---", "0");

            this.ddlWarehouse.Items.Add(itemWarehouse);
            WarehouseCollection warehouseCollection = WarehouseManager.GetAllWarehouses();

            foreach (Warehouse warehouse in warehouseCollection)
            {
                ListItem item2 = new ListItem(warehouse.Name, warehouse.WarehouseId.ToString());
                this.ddlWarehouse.Items.Add(item2);
            }

            CommonHelper.FillDropDownWithEnum(this.ddlLowStockActivity, typeof(LowStockActivityEnum));
        }
Beispiel #12
0
        void ShowWindowEditProduct() // Wyświetlenie okna dialogowego do edycji typu produktu
        {
            if (SelectedProduct != null)
            {
                NewProductVM             = new AddProductViewModel();
                NewProductVM.Prod        = SelectedProduct;
                NewProductVM.ProductType = ProductTypeCollection.Where(x => x.Id == SelectedProduct.ProductTypeId).First();
                NewProductVM.IdVisible   = Visibility.Visible;
                NewProductVM.IsEnabled   = false;

                _addProductWindow             = new AddProductWindow();
                _addProductWindow.DataContext = NewProductVM;
                _addProductWindow.Title       = "Edycja produktu";
                _addProductWindow.ShowDialog();
            }
        }
        private void FillDropDowns()
        {
            this.ddlTemplate.Items.Clear();
            ProductTemplateCollection productTemplateCollection = TemplateManager.GetAllProductTemplates();

            foreach (ProductTemplate productTemplate in productTemplateCollection)
            {
                ListItem item2 = new ListItem(productTemplate.Name, productTemplate.ProductTemplateID.ToString());
                this.ddlTemplate.Items.Add(item2);
            }

            this.ddlProductType.Items.Clear();
            ProductTypeCollection productTypeCollection = ProductManager.GetAllProductTypes();

            foreach (ProductType productType in productTypeCollection)
            {
                ListItem item2 = new ListItem(productType.Name, productType.ProductTypeID.ToString());
                this.ddlProductType.Items.Add(item2);
            }
        }
Beispiel #14
0
 /// <summary>
 /// 批量装载
 /// </summary>
 internal static void LoadFromDALPatch(List< ProductTypeInfo> pList, ProductTypeCollection pCollection)
 {
     foreach (ProductType productType in pCollection)
     {
         ProductTypeInfo productTypeInfo = new ProductTypeInfo();
         LoadFromDAL(productTypeInfo, productType );
         pList.Add(productTypeInfo);
     }
 }
Beispiel #15
0
        /// <summary>
        /// 获得分页列表,无论是否是缓存实体都从数据库直接拿取数据
        /// </summary>
        /// <param name="pPageIndex">页数</param>
        /// <param name="pPageSize">每页列表</param>
        /// <param name="pOrderBy">排序</param>
        /// <param name="pSortExpression">排序字段</param>
        /// <param name="pRecordCount">列表行数</param>
        /// <returns>数据分页</returns>
        public static List<ProductTypeInfo> GetPagedList(int pPageIndex,int pPageSize,SortDirection pOrderBy,string pSortExpression,out int pRecordCount)
        {
            if(pPageIndex<=1)
            pPageIndex=1;
            List< ProductTypeInfo> list = new List< ProductTypeInfo>();

            Query q = ProductType .CreateQuery();
            q.PageIndex = pPageIndex;
            q.PageSize = pPageSize;
            q.ORDER_BY(pSortExpression,pOrderBy.ToString());
            ProductTypeCollection  collection=new  ProductTypeCollection();
             	collection.LoadAndCloseReader(q.ExecuteReader());

            foreach (ProductType  productType  in collection)
            {
                ProductTypeInfo productTypeInfo = new ProductTypeInfo();
                LoadFromDAL(productTypeInfo,   productType);
                list.Add(productTypeInfo);
            }
            pRecordCount=q.GetRecordCount();

            return list;
        }
Beispiel #16
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <returns></returns>
 public static List<ProductTypeInfo> GetList()
 {
     string cacheKey = GetCacheKey();
     //本实体已经注册成缓存实体,并且缓存存在的时候,直接从缓存取
     if (CachedEntityCommander.IsTypeRegistered(typeof(ProductTypeInfo)) && CachedEntityCommander.GetCache(cacheKey) != null)
     {
         return CachedEntityCommander.GetCache(cacheKey) as List< ProductTypeInfo>;
     }
     else
     {
         List< ProductTypeInfo>  list =new List< ProductTypeInfo>();
         ProductTypeCollection  collection=new  ProductTypeCollection();
         Query qry = new Query(ProductType.Schema);
         collection.LoadAndCloseReader(qry.ExecuteReader());
         foreach(ProductType productType in collection)
         {
             ProductTypeInfo productTypeInfo= new ProductTypeInfo();
             LoadFromDAL(productTypeInfo,productType);
             list.Add(productTypeInfo);
         }
       	//生成缓存
         if (CachedEntityCommander.IsTypeRegistered(typeof(ProductTypeInfo)))
         {
             CachedEntityCommander.SetCache(cacheKey, list);
         }
         return list;
     }
 }
        private static ProductTypeCollection DBMapping(DBProductTypeCollection dbCollection)
        {
            if (dbCollection == null)
                return null;

            ProductTypeCollection collection = new ProductTypeCollection();
            foreach (DBProductType dbItem in dbCollection)
            {
                ProductType item = DBMapping(dbItem);
                collection.Add(item);
            }

            return collection;
        }
 public ProductTypeCollection FetchByID(object ProductTypeId)
 {
     ProductTypeCollection coll = new ProductTypeCollection().Where("ProductTypeId", ProductTypeId).Load();
     return coll;
 }
 public ProductTypeCollection FetchByQuery(Query qry)
 {
     ProductTypeCollection coll = new ProductTypeCollection();
     coll.LoadAndCloseReader(qry.ExecuteReader());
     return coll;
 }