示例#1
0
        // создает новый товарный остаток
        public IEnumerable <IResult> AddFromCatalog()
        {
            while (true)
            {
                var search = new AddStockFromCatalog(Address);
                yield return(new DialogResult(search));

                var edit = new EditStock(search.Item)
                {
                    EditMode = EditStock.Mode.EditAll
                };
                yield return(new DialogResult(edit));

                var stock    = edit.Stock;
                var quantity = stock.Quantity;
                stock.Quantity = 0;
                stock.Status   = StockStatus.InTransit;
                Session.Save(stock);
                var line = new InventoryLine(Doc, stock, quantity, Session, true);
                Lines.Add(line);
                Doc.Lines.Add(line);
                Doc.UpdateStat();
                Save();
            }
        }
        public IEnumerable <IResult> Add()
        {
            while (true)
            {
                if (!IsValide(Doc))
                {
                    yield break;
                }

                var search = new StockSearch();
                yield return(new DialogResult(search, false, true));

                var edit = new EditStock(search.CurrentItem)
                {
                    EditMode = EditStock.Mode.EditQuantity
                };
                yield return(new DialogResult(edit));

                var srcStock = Session.Load <Stock>(edit.Stock.Id);
                var dstStock = srcStock.Copy();
                dstStock.Address  = Doc.DstAddress;
                dstStock.Quantity = dstStock.ReservedQuantity = dstStock.SupplyQuantity = 0;
                Session.Save(dstStock);

                var line = new DisplacementLine(srcStock, dstStock, edit.Stock.Quantity);
                Lines.Add(line);
                Doc.Lines.Add(line);
                Doc.UpdateStat();
                Save();
            }
        }
        public IEnumerable <IResult> EditLine()
        {
            if (!CanEditLine)
            {
                yield break;
            }
            var stock = Env.Query(s => s.Get <Stock>(CurrentLine.Value.Stock.Id)).Result;

            stock.Quantity = CurrentLine.Value.Quantity;
            var edit = new EditStock(stock)
            {
                EditMode = EditStock.Mode.EditQuantity
            };

            yield return(new DialogResult(edit));

            CurrentLine.Value.UpdateQuantity(edit.Stock.Quantity);
            Doc.UpdateStat();
        }
        public IEnumerable <IResult> Add()
        {
            var search = new StockSearch();

            yield return(new DialogResult(search, resizable: true));

            var edit = new EditStock(search.CurrentItem)
            {
                EditMode = EditStock.Mode.EditQuantity
            };

            yield return(new DialogResult(edit));

            var line = new WriteoffLine(Session.Load <Stock>(edit.Stock.Id), edit.Stock.Quantity);

            Lines.Add(line);
            Doc.Lines.Add(line);
            Doc.UpdateStat();
        }
示例#5
0
        public IEnumerable <IResult> EditLine()
        {
            if (!CanEditLine)
            {
                yield break;
            }
            var line  = CurrentLine.Value;
            var stock = line.DstStock.Copy();

            stock.Quantity = line.Quantity;
            var edit = new EditStock(stock)
            {
                EditMode = EditStock.Mode.EditRetailCostAndQuantity
            };

            yield return(new DialogResult(edit));

            line.UpdateDst(edit.Stock);
            Doc.UpdateStat();
        }
示例#6
0
        public IEnumerable <IResult> Add()
        {
            var search = new StockSearch();

            yield return(new DialogResult(search, resizable: true));

            var srcStock = Session.Load <Stock>(search.CurrentItem.Value.Id);
            var dstStock = srcStock.Copy();
            var edit     = new EditStock(dstStock)
            {
                EditMode = EditStock.Mode.EditRetailCostAndQuantity
            };

            yield return(new DialogResult(edit));

            var line = new ReassessmentLine(srcStock, dstStock);

            Lines.Add(line);
            Doc.Lines.Add(line);
            Doc.UpdateStat();
        }
        private void editRecordbtn_Click(object sender, EventArgs e)
        {
            try
            {
                EditStock editStock = new EditStock();
                editStock.bookID = Int32.Parse(stocksDataGridView.Rows[stocksDataGridView.SelectedRows[0].Index].Cells[0].Value.ToString());
                editStock.ShowDialog();

                if (isChanged)
                {
                    InformationForm information = new InformationForm("Selected stock record is edited.", "Info");
                    information.Show();
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                MessageBox.Show("Please select a row first!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                this.ViewStocks_Load(sender, e);
            }
        }
        public IEnumerable <IResult> Add()
        {
            if (Doc.Supplier == null)
            {
                Manager.Warning("Укажите поставщика");
                yield break;
            }
            while (true)
            {
                var search = new StockSearch(Doc.Supplier.Id);
                yield return(new DialogResult(search, false, true));

                var edit = new EditStock(search.CurrentItem)
                {
                    EditMode = EditStock.Mode.EditQuantity
                };
                yield return(new DialogResult(edit));

                var line = new ReturnLine(Session.Load <Stock>(edit.Stock.Id), edit.Stock.Quantity);
                Lines.Add(line);
                Doc.Lines.Add(line);
                Doc.UpdateStat();
            }
        }