Esempio n. 1
0
        private bool WritingDocument()
        {
            convertListsToTables();
            WritingResult result = Document.Write();

            if (result != WritingResult.Success)
            {
                if (isEditMode)
                {
                    changeEditMode(false);
                }
                showMessage("Помилка при збережені даних!");

                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        public void CreateMovement()
        {
            long   movementId = getMovementId();
            Moving movement;

            if (movementId == 0)
            {
                WritingResult result = Write();

                if (result == WritingResult.Success)
                {
                    movement = new Moving {
                        PickingPlan = this, State = StatesOfDocument.Planned
                    };
                    movement.AfterWriting += movement_AfterWriting;
                    List <MovementFillingInfo> list = new List <MovementFillingInfo>();

                    foreach (DataRow row in NomenclatureInfo.Rows)
                    {
                        long nomenclature = Convert.ToInt64(row[Nomenclature]);

                        long   party = Convert.ToInt64(row[Party]);
                        double count = Convert.ToDouble(row[Quantity]);
                        bool   find  = false;

                        foreach (MovementFillingInfo info in list)
                        {
                            if (info.Nomenclature == nomenclature && info.Party == party)
                            {
                                info.Count += count;
                                find        = true;
                                break;
                            }
                        }

                        if (!find)
                        {
                            list.Add(new MovementFillingInfo
                            {
                                Count        = count,
                                Nomenclature = nomenclature,
                                Party        = party
                            });
                        }
                    }

                    fillMovement(movement, list);
                }
                else
                {
                    return;
                }
            }
            else
            {
                movement = new Moving()
                {
                    ReadingId = movementId
                };
            }

            UserInterface.Current.ShowItem(movement);
        }