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

            pck.Owner = this;
            pck.conn  = conn;
            pck.ShowDialog();
            if (pck.PeriodSelected)
            {
                startPeriod = pck.startPeriod;
                endPeriod   = pck.endPeriod;
                HotelInfo   = pck.CmpName;
                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("HotelInfo-{0:ddMMyyyy-HHmm}", DateTime.Now) + ext;

                if (ExportReport(ReportType.REPORT_HOTEL_INFORMATION, 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 Hotel_Click(object sender, RoutedEventArgs e)
        {
            CompanyFilter dlg2 = new CompanyFilter();

            dlg2.Owner = this;
            dlg2.conn  = conn;
            dlg2.ShowDialog();
            if (dlg2.PeriodSelected)
            {
                ViewReport dlg = new ViewReport();
                dlg.type        = ReportType.REPORT_HOTEL_INFORMATION;
                dlg.HotelInfo   = dlg2.CmpName;
                dlg.conn        = conn;
                dlg.startPeriod = dlg2.startPeriod;
                dlg.endPeriod   = dlg2.endPeriod;
                dlg.ShowDialog();
            }
        }