예제 #1
0
        /// <summary>
        /// Кнопка сканирования почты для импорта отчетов провайдера
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonScanTransportTable_Click(object sender, RibbonControlEventArgs e)
        {
            try
            {
                ShefflerWB.ExcelOptimizateOn();
                if (Properties.Settings.Default.OutlookFolders == "")
                {
                    MessageBox.Show("Задайте папки для сканирования почты", "Необходима настройка программы", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                ScanMail scanMail = new ScanMail();

                if (scanMail.SaveAttachments() == 0)
                {
                    MessageBox.Show("Письма не обнаружены", "Сканирование почты", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    TransportTable transportTable = new TransportTable();
                    transportTable.GetDataFromProviderFiles();
                    transportTable.SaveAndClose();
                    MessageBox.Show("Данные импортированы. Изменения выделены цветом.", "Импорт данных", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                ShefflerWB.ExcelOptimizateOff();
            }
        }
예제 #2
0
 /// <summary>
 /// Кнопка сканирования писем от провайдеров
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnReadCarrierInvoice_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ShefflerWB.ExcelOptimizateOn();
         if (Properties.Settings.Default.OutlookFolders == "")
         {
             MessageBox.Show("Задайте папки для сканирования почты", "Необходима настройка программы", MessageBoxButtons.OK, MessageBoxIcon.Information);
             return;
         }
         ScanMail scanMail = new ScanMail();
         if (scanMail.SaveAttachments() == 0)
         {
             MessageBox.Show("Письма не обнаружены", "Сканирование почты", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             scanMail.GetDataFromProviderFiles();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         ShefflerWB.ExcelOptimizateOff();
     }
 }
예제 #3
0
        private void Лист2_SelectionChange(Range Target)
        {
            try
            {
                ShefflerWB.ExcelOptimizateOn();
                Worksheet  deliverySheet = Globals.ThisWorkbook.Sheets["Delivery"];
                ListObject carrierTable  = deliverySheet?.ListObjects["TableCarrier"];
                ListObject OrdersTable   = deliverySheet?.ListObjects["TableOrders"];
                if (carrierTable == null || OrdersTable == null)
                {
                    return;
                }

                Range commonOrdrrRng = Globals.ThisWorkbook.Application.Intersect(Target, OrdersTable.Range);
                if (carrierTable?.DataBodyRange == null)
                {
                    return;
                }

                Range commonRng = Globals.ThisWorkbook.Application.Intersect(Target, carrierTable.DataBodyRange);
                if (commonRng == null && commonOrdrrRng == null)
                {
                    OrdersTable.Range.AutoFilter(Field: 1);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                ShefflerWB.ExcelOptimizateOff();
            }
        }
예제 #4
0
        /// <summary>
        /// Отправка таблицы Отгрузка провайдерам
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonTotalToProviders_Click(object sender, RibbonControlEventArgs e)
        {
            try
            {
                SelectProvider selectProvider = new SelectProvider();
                selectProvider.ShowDialog();
                if (selectProvider.DialogResult != DialogResult.OK)
                {
                    return;
                }
                ShefflerWB.ExcelOptimizateOn();

                if (selectProvider.Provider == "Отправить всем")
                {
                    new Functions().SendEmailToProviderAdoutAdding();
                }
                else
                {
                    new Functions().SendEmailToProviderAdoutAdding(selectProvider.Provider);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                ShefflerWB.ExcelOptimizateOff();
            }
        }
예제 #5
0
 private void BtnSettings_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ShefflerWB.ExcelOptimizateOn();
         new Settings().ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         ShefflerWB.ExcelOptimizateOff();
     }
 }
예제 #6
0
 /// <summary>
 /// Сохранение временного архива в TransportTable
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SaveToTransportTable_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ShefflerWB.ExcelOptimizateOn();
         Archive.ToTransportTableAndShepments();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         ShefflerWB.ExcelOptimizateOff();
     }
 }
예제 #7
0
 /// <summary>
 /// Сохранение листа отгрузки во временный архив
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SaveToArchive_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ShefflerWB.ExcelOptimizateOn();
         Archive.LoadToArhive();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         ShefflerWB.ExcelOptimizateOff();
     }
 }
예제 #8
0
 /// <summary>
 /// Кнопка Export from SAP
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnExportFromSap_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ShefflerWB.ExcelOptimizateOn();
         new Functions().ExportFromSAP();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         ShefflerWB.ExcelOptimizateOff();
     }
 }
예제 #9
0
 /// <summary>
 /// Кнопка отправки писем провайдерам
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnSendShippingCompany_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ShefflerWB.ExcelOptimizateOn();
         new Functions().SendEmailToProviderAdoutOrders();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         ShefflerWB.ExcelOptimizateOff();
     }
 }
예제 #10
0
 /// <summary>
 /// Сквозное нумерование доставок
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void NunerateDeliveries(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ShefflerWB.ExcelOptimizateOn();
         new Functions().RenumberDeliveries();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         ShefflerWB.ExcelOptimizateOff();
     }
 }
예제 #11
0
 /// <summary>
 /// Отправка файла отгрузки в CS
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ButtonSendToCS_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ShefflerWB.ExcelOptimizateOn();
         new Functions().CreateLetterToCS();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         ShefflerWB.ExcelOptimizateOff();
     }
 }
예제 #12
0
 /// <summary>
 /// Выбор папки для сканирования писем от провайдеров
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ButtonSelectFoldersOutlook_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ShefflerWB.ExcelOptimizateOn();
         new OutlookFoldersSelect().ShowDialog();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         ShefflerWB.ExcelOptimizateOff();
     }
 }
예제 #13
0
 /// <summary>
 /// Кнопка перенести в отгрузки
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnFillTable_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ShefflerWB.ExcelOptimizateOn();
         new Functions().UpdateTotal();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         ShefflerWB.ExcelOptimizateOff();
     }
 }
예제 #14
0
 /// <summary>
 /// Кнопка удаления авто
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ButtonDeleteAuto_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ShefflerWB.ExcelOptimizateOn();
         new Functions().DeleteAuto();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         ShefflerWB.ExcelOptimizateOff();
     }
 }
예제 #15
0
 /// <summary>
 /// Кнопка пересчитать стоимость
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BtnChangeRoute_Click(object sender, RibbonControlEventArgs e)
 {
     try
     {
         ShefflerWB.ExcelOptimizateOn();
         new Functions().СhangeDelivery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     finally
     {
         ShefflerWB.ExcelOptimizateOff();
     }
 }
예제 #16
0
        /// <summary>
        /// Фильтр заказов по активной доставке
        /// </summary>
        /// <param name="Target"></param>
        private void TableCarrier_SelectionChange(Range Target)
        {
            try
            {
                ShefflerWB.ExcelOptimizateOn();
                Worksheet  deliverySheet = Globals.ThisWorkbook.Sheets["Delivery"];
                ListObject carrierTable  = deliverySheet.ListObjects["TableCarrier"];
                ListObject OrdersTable   = deliverySheet.ListObjects["TableOrders"];
                Range      TargetCell    = Globals.ThisWorkbook.Application.ActiveCell;
                OrdersTable.Range.AutoFilter(Field: 1);
                if (TargetCell == null)
                {
                    return;
                }
                if (carrierTable.DataBodyRange == null)
                {
                    return;
                }

                Range commonRng = Globals.ThisWorkbook.Application.Intersect(TargetCell, carrierTable.DataBodyRange);

                if (commonRng != null)
                {
                    string numberDelivery = deliverySheet.Cells[TargetCell.Row, carrierTable.ListColumns[1].Range.Column].Text;
                    OrdersTable.Range.AutoFilter(Field: 1, Criteria1: numberDelivery);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            finally
            {
                ShefflerWB.ExcelOptimizateOff();
            }
        }
예제 #17
0
        /// <summary>
        /// Кнопка отправки очета провайдеру
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonSendTransportTable_Click(object sender, RibbonControlEventArgs e)
        {
            TransportTableSending tableSending = new TransportTableSending();

            tableSending.ShowDialog();
            if (tableSending.DialogResult != DialogResult.OK)
            {
                return;
            }

            try
            {
                ShefflerWB.ExcelOptimizateOn();
                new TransportTable().MessageProvider(tableSending.DateStart, tableSending.DateEnd, tableSending.Provider);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                ShefflerWB.ExcelOptimizateOff();
            }
        }