Ejemplo n.º 1
0
        private void hyperlink3_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
        {
            DriverFilterWnd pck = new DriverFilterWnd();

            pck.Owner = this;
            pck.conn  = conn;
            pck.ShowDialog();
            if (pck.PeriodSelected)
            {
                startPeriod = pck.startPeriod;
                endPeriod   = pck.endPeriod;
                DrvLicense  = pck.DrvLicense;
                DrvName     = pck.DrvName;
                Deduction   = pck.Deduction;

                NotificationWindow dlg = new NotificationWindow();
                dlg.ShowModal("Please wait as the report is exported and your default mail client started.");
                DispatcherHelper.DoEvents();
                string ext = ".doc";
                string fmt = "WORD";
                if (("Microsoft Word (*.doc)").Equals(comboBox1.Text))
                {
                    ext = ".doc";
                    fmt = "WORD";
                }
                else if (("Microsoft Excel (*.xls)").Equals(comboBox1.Text))
                {
                    ext = ".xls";
                    fmt = "EXCEL";
                }
                else if (("Adobe PDF (*.pdf)").Equals(comboBox1.Text))
                {
                    ext = ".pdf";
                    fmt = "PDF";
                }
                string PathName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
                string FileName = PathName + "\\reports\\" + string.Format("AccByDriver-{0:ddMMyyyy-HHmm}", DateTime.Now) + ext;

                if (ExportReport(ReportType.REPORT_ACCUMULATED_BY_DRIVER, FileName, fmt))
                {
                    MAPI mapi = new MAPI();
                    mapi.AddAttachment(FileName);
                    mapi.SendMailPopup(Config.Subject, Config.BodyText);
                }
                else
                {
                    MessageBox.Show("Failed to export and email the report.", "Express Taxi", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                dlg.CloseModal();
            }
            e.Handled = true;
        }
Ejemplo n.º 2
0
        private void DriverAccumulated_Click(object sender, RoutedEventArgs e)
        {
            DriverFilterWnd wnd = new DriverFilterWnd();

            wnd.Owner = this;
            wnd.conn  = conn;
            wnd.ShowDialog();
            if (wnd.PeriodSelected)
            {
                ViewReport dlg = new ViewReport();
                dlg.type        = ReportType.REPORT_ACCUMULATED_BY_DRIVER;
                dlg.conn        = conn;
                dlg.startPeriod = wnd.startPeriod;
                dlg.endPeriod   = wnd.endPeriod;
                dlg.DrvLicense  = wnd.DrvLicense;
                dlg.DrvName     = wnd.DrvName;
                dlg.Deduction   = wnd.Deduction;
                dlg.ShowDialog();
            }
        }