Ejemplo n.º 1
0
        /// <summary>
        /// Retrieve all data from Products table. Used to fill combo box.
        /// </summary>
        /// <returns>List of Products</returns>
        public List <ModelNotifiedForProducts> GetAll_Products(out string error)
        {
            error = null;
            ProductsBsn                     bsn           = new ProductsBsn(wpfConfig);
            List <ProductsInfo>             dbItems       = bsn.GetAll();
            List <ModelNotifiedForProducts> notifiedItems = new List <ModelNotifiedForProducts>();

            foreach (ProductsInfo dbItem in dbItems)
            {
                ModelNotifiedForProducts itemToAdd = new ModelNotifiedForProducts();
                Cloner.CopyAllTo(typeof(ProductsInfo), dbItem, typeof(ModelNotifiedForProducts), itemToAdd);
                notifiedItems.Add(itemToAdd);
            }
            return(notifiedItems);
        }
Ejemplo n.º 2
0
        private List <ModelNotifiedForOrderDetails> FilterGrid(string filterValue)
        {
            filterValue = filterValue.ToLower();
            List <ModelNotifiedForOrderDetails> filteredList = new List <ModelNotifiedForOrderDetails>();

            foreach (ModelNotifiedForOrderDetails item in OrderDetailsDataContext.modelNotifiedForOrderDetailsMain)
            {
                if (item.OrderID.ToString().ToLower().Contains(filterValue))
                {
                    filteredList.Add(item);
                    continue;
                }

                if (item.ProductID.ToString().ToLower().Contains(filterValue))
                {
                    filteredList.Add(item);
                    continue;
                }

//Filter FK values.
                if (item.OrderID != null)
                {
                    ModelNotifiedForOrders comboItem = OrderDetailsDataContext.modelNotifiedForOrders.Where(x => x.OrderID == item.OrderID).FirstOrDefault();
                    if ((comboItem != null) && (comboItem.ShipName != null) && (comboItem.ShipName.ToLower().Contains(filterValue)))
                    {
                        filteredList.Add(item);
                        continue;
                    }
                }

                if (item.ProductID != null)
                {
                    ModelNotifiedForProducts comboItem = OrderDetailsDataContext.modelNotifiedForProducts.Where(x => x.ProductID == item.ProductID).FirstOrDefault();
                    if ((comboItem != null) && (comboItem.ProductName != null) && (comboItem.ProductName.ToLower().Contains(filterValue)))
                    {
                        filteredList.Add(item);
                        continue;
                    }
                }
            }
            return(filteredList);
        }