Example #1
0
        private void BackSale_Click(object sender, RoutedEventArgs e)
        {
            FileClass file = new FileClass();

            DataBaseClass.DataBase dataBase = new DataBaseClass.DataBase(DataBaseOption.dataBaseOption);

            OpenFileDialog openFile = new OpenFileDialog();

            openFile.Title  = "Выбрать чек";
            openFile.Filter = "Word documents(*.docx)|*.docx";

            string       saleNumber   = string.Empty;
            TextFromFile textFromFile = file.GetTextDocWord;

            if (openFile.ShowDialog() == true)
            {
                if (dataBase.IssueRefund(textFromFile(openFile.FileName), ref saleNumber))
                {
                    dataBase.DeleteSale(saleNumber);
                    MessageBox.Show("Возврат выполнен");

                    dataBase.OutputTable(salesDataBase, typeList.SelectedIndex);

                    FileInfo fileInf = new FileInfo(openFile.FileName);

                    if (fileInf.Exists)
                    {
                        fileInf.Delete();
                    }
                }

                else
                {
                    MessageBox.Show("Истёк срок");
                }
            }
        }