예제 #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;
        }
예제 #2
0
        private void hyperlink1_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
        {
            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("CompanyList-{0:ddMMyyyy-HHmm}", DateTime.Now) + ext;

            if (ExportReport(ReportType.REPORT_COMAPNY_LIST, 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;
        }