Пример #1
0
        private void ActionWithConsiderationOrder(object sender, SelectedCellsChangedEventArgs e)
        {
            var datas = (DataGrid)sender;

            if (datas.SelectedCells.Count == 0)
            {
                return;
            }
            var dialogResult = MessageBox.Show("Add order?", "Adding order to base", MessageBoxButton.YesNoCancel);

            if (dialogResult == MessageBoxResult.Yes)
            {
                if (ordersInProgress != null)
                {
                    ordersInProgress.Add(ordersForConsideration[datas.SelectedIndex]);
                }
                WindowForClient.AddToDatabase(ordersForConsideration[datas.SelectedIndex], workBook.Sheets[2]);
                SetGridOrders(ref progressGid, workBook.Sheets[2], (SelectedCellsChangedEventHandler)ActionWithOrderInProgress, ref ordersInProgress);
                RemoveOrderAt(datas.SelectedIndex, workBook.Sheets[1]);
            }
            else if (dialogResult == MessageBoxResult.No)
            {
                RemoveOrderAt(datas.SelectedIndex, workBook.Sheets[1]);
            }
            workBook.Save();
        }
Пример #2
0
        private void ActionWithOrderInProgress(object sender, SelectedCellsChangedEventArgs e)
        {
            var datas = (DataGrid)sender;

            if (datas.SelectedCells.Count == 0)
            {
                return;
            }
            var dialogResult = MessageBox.Show("Are you complete order?", "Compliting order", MessageBoxButton.YesNo);

            if (dialogResult == MessageBoxResult.Yes)
            {
                MessageBox.Show("Call to : " + ordersInProgress[datas.SelectedIndex].Client);
                WindowForClient.AddToDatabase(ordersInProgress[datas.SelectedIndex], workBook.Sheets[3]);
                RemoveOrderAt(datas.SelectedIndex, workBook.Sheets[2]);
            }
            datas.UnselectAll();
            workBook.Save();
        }