Ejemplo n.º 1
0
        public void AddApplyUserOrderDetail(T_ApplyUseOrderDetail detail)
        {
            T_StockMaterial stockMaterial = StockMaterialList.Find(o => o.MatCode == detail.MatCode && o.Unit == detail.Unit);

            ApplyUseOrderDetailList.Add(detail);

            if (stockMaterial != null)
            {
                stockMaterial.AvailableQuantity -= detail.Quantity;
            }
        }
Ejemplo n.º 2
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            StockMaterialsSearchWindow window = new StockMaterialsSearchWindow();
            window.FormClosed += (o, ee) =>
                {
                    foreach (T_StockMaterial stockMaterail in window.SelectedStockMaterails)
                    {
                        if (_ApplyUseOrderDetails.Where(d => d.MatCode == stockMaterail.MatCode).Count() == 0)
                        {
                            T_ApplyUseOrderDetail detail = new T_ApplyUseOrderDetail()
                            {
                                Id = Guid.NewGuid().ToString(),
                                ApplyUseNo = ApplyUseOrder.ApplyUseNo,
                                Unit = stockMaterail.Unit,
                                MatCode = stockMaterail.MatCode,
                                MatDesc = stockMaterail.MatDesc,
                                MatTypeCode = stockMaterail.MatTypeCode,
                                MatModeCode = stockMaterail.MatModeCode,
                                AvailableQuantity = stockMaterail.AvailableQuantity
                            };

                            _ApplyUseOrderDetails.Add(detail);
                            _AddList.Add(detail.Id);
                        }
                    }

                    this.gvApplyUseOrderDetails.RefreshData();
                };

            window.ShowDialog();
        }