Exemple #1
0
        private void Add()
        {
            Loger.Write("MainVM", "Add scenary record");

            MonitorTxt = DateTime.Now + " | Добавление сценарной записи " + "\n" + MonitorTxt;

            if (!string.IsNullOrEmpty(LotCodeTxt) && !string.IsNullOrEmpty(ClientCodeTxt))
            {
                Loger.Write("MainVM", "Scenary record added");

                MonitorTxt = DateTime.Now + " | Запись добавленна " + "\n" + MonitorTxt;

                ScenaryList.Add(new ScenaryLot()
                {
                    number     = ScenaryList.Count + 1,
                    brokerCode = SelectedBroker.brokerCode,
                    lotCode    = LotCodeTxt,
                    clientCode = ClientCodeTxt,
                    priceOffer = PriceOfferTxt,
                    status     = false
                });
            }
            else
            {
                Loger.Write("MainVM", "Adding scenary record fault, because not fields is set");

                MonitorTxt = DateTime.Now + " | Ошибка добавления записи " + "\n" + MonitorTxt;

                MessageBox.Show("Введены не все данные.");
            }
        }
Exemple #2
0
        private void MoveScenary(int direction)
        {
            if (SelectedScenary != null)
            {
                if (SelectedScenary.number > 1 && direction == 1)
                {
                    ScenaryList.Move(SelectedScenary.number - 1, SelectedScenary.number - 2);
                }
                else if (SelectedScenary.number < ScenaryList.Count - 1 && direction == 2)
                {
                    ScenaryList.Move(SelectedScenary.number - 1, SelectedScenary.number);
                }

                SetSerialNumbers();
            }
            else
            {
                MessageBox.Show("Не выбрана запись");
            }
        }
Exemple #3
0
        private void Load()
        {
            Loger.Write("MainVM", "Scenary loading");

            MonitorTxt = DateTime.Now + " | Загрузка сценария " + "\n" + MonitorTxt;

            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Файлы сценария (*.scn)|*.scn";

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                ObservableCollection <ScenaryLot> tmpSO = new ObservableCollection <ScenaryLot>();
                XmlSerializer xmlSerializer             = new XmlSerializer(typeof(ObservableCollection <ScenaryLot>));
                TextReader    FileStream = new StreamReader(openFileDialog.FileName);

                tmpSO = (ObservableCollection <ScenaryLot>)xmlSerializer.Deserialize(FileStream);

                FileStream.Close();
                ScenaryList.Clear();

                foreach (var item in tmpSO)
                {
                    ScenaryList.Add(item);
                }

                MessageBox.Show("Сценарий загружен.");
                Loger.Write("MainVM", "Scenary loaded");

                MonitorTxt = DateTime.Now + " | Загрузка выполненна " + "\n" + MonitorTxt;
            }
            else
            {
                Loger.Write("MainVM", "Scenary loading canceled");

                MonitorTxt = DateTime.Now + " | Отмена загрузки " + "\n" + MonitorTxt;
            }
        }
Exemple #4
0
        private void Delete()
        {
            Loger.Write("MainVM", "Scenary record deleting");

            MonitorTxt = DateTime.Now + " | Удаление сценарной записи " + "\n" + MonitorTxt;

            if (SelectedScenary != null)
            {
                ScenaryList.Remove(SelectedScenary);
                SetSerialNumbers();

                Loger.Write("MainVM", "Scenary record deleted");

                MonitorTxt = DateTime.Now + " | Запись удалена " + "\n" + MonitorTxt;
            }
            else
            {
                Loger.Write("MainVM", "Scenary record deleting fault because item not selected");

                MonitorTxt = DateTime.Now + " | Ошибка удаления записи " + "\n" + MonitorTxt;

                MessageBox.Show("Нет выбранной записи для удаления.");
            }
        }