private void ShowOrderItemState()
        {
            if (UpdatingItem != null)
            {
                List <string> sheets = new List <string>();
                sheets.Add((UpdatingItem as Order).ID);
                OrderItemRecordSearchCondition con = new OrderItemRecordSearchCondition();
                con.SheetNo = sheets;
                List <OrderItemRecord> states = (new OrderBLL(AppSettings.Current.ConnStr)).GetRecords(con).QueryObjects;
                if (states != null && states.Count > 0)
                {
                    foreach (DataGridViewRow row in ItemsGrid.Rows)
                    {
                        OrderItem oi = row.Tag as OrderItem;
                        if (oi != null)
                        {
                            OrderItemRecord st = states.SingleOrDefault(item => item.ID == oi.ID);
                            row.Cells["colShipped"].Value = st != null?st.Shipped.Trim().ToString() : null;

                            row.Cells["colOnway"].Value = st != null?st.OnWay.Trim().ToString() : null;
                        }
                    }
                }
            }
        }
예제 #2
0
 protected override List <object> GetDataSource()
 {
     _Inventories = (new ProductInventoryBLL(AppSettings.Current.ConnStr)).GetItems(null).QueryObjects;
     if (SearchCondition == null)
     {
         OrderItemRecordSearchCondition con = new OrderItemRecordSearchCondition();
         con.LastActiveDate = new DateTimeRange(DateTime.Today.AddYears(-1), DateTime.Now); //获取最后一年产生的订单
         _Records           = (new OrderBLL(AppSettings.Current.ConnStr)).GetRecords(con).QueryObjects;
     }
     else
     {
         _Records = (new OrderBLL(AppSettings.Current.ConnStr)).GetRecords(SearchCondition).QueryObjects;
     }
     return(FilterData());
 }
        private void cMnu_AddOrderRecord_Click(object sender, EventArgs e)
        {
            FrmOrderRecordView frm = new FrmOrderRecordView();

            frm.ForSelect = true;
            OrderItemRecordSearchCondition con = new OrderItemRecordSearchCondition();

            con.States = new List <SheetState>();
            con.States.Add(SheetState.Add);
            con.States.Add(SheetState.Approved);
            con.HasToPurchase   = true;
            frm.SearchCondition = con;
            if (frm.ShowDialog() == DialogResult.OK)
            {
                OrderItemRecord oi = frm.SelectedItem as OrderItemRecord;
                AddPurchaseSheettem(oi);
            }
        }
예제 #4
0
 private void mnu_AddOrderItem_Click(object sender, EventArgs e)
 {
     if (Customer != null)
     {
         FrmOrderRecordView frm = new FrmOrderRecordView();
         frm.ForSelect = true;
         OrderItemRecordSearchCondition con = new OrderItemRecordSearchCondition();
         con.CustomerID = Customer.ID;
         con.States     = new List <SheetState>();
         con.States.Add(SheetState.Approved);
         con.HasToDelivery   = true;
         frm.SearchCondition = con;
         if (frm.ShowDialog() == DialogResult.OK)
         {
             OrderItemRecord oi = frm.SelectedItem as OrderItemRecord;
             AddDeliveryItem(oi);
         }
     }
 }
예제 #5
0
        protected override List <OrderItemRecord> GetingItems(System.Data.Linq.DataContext dc, SearchCondition search)
        {
            DataLoadOptions opt = new DataLoadOptions();

            opt.LoadWith <OrderItemRecord>(item => item.Customer);
            opt.LoadWith <OrderItemRecord>(item => item.Product);
            dc.LoadOptions = opt;
            IQueryable <OrderItemRecord> ret = dc.GetTable <OrderItemRecord>();

            if (search is SheetSearchCondition)
            {
                SheetSearchCondition con = search as SheetSearchCondition;
                if (con.LastActiveDate != null)
                {
                    ret = ret.Where(item => item.LastActiveDate >= con.LastActiveDate.Begin && item.LastActiveDate <= con.LastActiveDate.End);
                }
                if (con.SheetNo != null && con.SheetNo.Count > 0)
                {
                    ret = ret.Where(item => con.SheetNo.Contains(item.SheetNo));
                }
                if (con.States != null && con.States.Count > 0)
                {
                    ret = ret.Where(item => con.States.Contains(item.State));
                }
            }
            if (search is OrderSearchCondition)
            {
                OrderSearchCondition con = search as OrderSearchCondition;
                if (!string.IsNullOrEmpty(con.CustomerID))
                {
                    ret = ret.Where(item => item.CustomerID == con.CustomerID);
                }
                if (!string.IsNullOrEmpty(con.Sales))
                {
                    ret = ret.Where(item => item.SalesPerson == con.Sales);
                }
                if (con.WithTax != null)
                {
                    if (con.WithTax.Value)
                    {
                        ret = ret.Where(item => item.WithTax == true);
                    }
                    else
                    {
                        ret = ret.Where(item => item.WithTax == false);
                    }
                }
            }
            if (search is OrderItemRecordSearchCondition)
            {
                OrderItemRecordSearchCondition con = search as OrderItemRecordSearchCondition;
                if (!string.IsNullOrEmpty(con.ProductID))
                {
                    ret = ret.Where(item => item.ProductID == con.ProductID);
                }
                if (!string.IsNullOrEmpty(con.CategoryID))
                {
                    ret = ret.Where(item => item.Product.CategoryID == con.CategoryID);
                }
            }
            List <OrderItemRecord> items = ret.ToList();

            if (search is OrderItemRecordSearchCondition) //从数据库获取回来数据后再筛选
            {
                OrderItemRecordSearchCondition con = search as OrderItemRecordSearchCondition;
                if (con.HasToDelivery != null)
                {
                    if (con.HasToDelivery.Value)
                    {
                        items = items.Where(item => item.NotShipped > 0).ToList();
                    }
                    else
                    {
                        items = items.Where(item => item.NotShipped == 0).ToList();
                    }
                }
                if (con.HasToPurchase != null)
                {
                    if (con.HasToPurchase.Value)
                    {
                        items = items.Where(item => item.NotPurchased > 0).ToList();
                    }
                    else
                    {
                        items = items.Where(item => item.NotPurchased == 0).ToList();
                    }
                }
            }
            return(items);
        }