Example #1
0
        /// <summary>
        /// Retrieve all data from Orders table. Used to fill combo box.
        /// </summary>
        /// <returns>List of Orders</returns>
        public List <ModelNotifiedForOrders> GetAll_Orders(out string error)
        {
            error = null;
            OrdersBsn                     bsn           = new OrdersBsn(wpfConfig);
            List <OrdersInfo>             dbItems       = bsn.GetAll();
            List <ModelNotifiedForOrders> notifiedItems = new List <ModelNotifiedForOrders>();

            foreach (OrdersInfo dbItem in dbItems)
            {
                ModelNotifiedForOrders itemToAdd = new ModelNotifiedForOrders();
                Cloner.CopyAllTo(typeof(OrdersInfo), dbItem, typeof(ModelNotifiedForOrders), itemToAdd);
                notifiedItems.Add(itemToAdd);
            }
            return(notifiedItems);
        }
Example #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);
        }