コード例 #1
0
        private void btnRemerge_Click(object sender, RoutedEventArgs e)
        {
            RadButton         _button = (RadButton)sender;
            int               ID      = ((DealerMailingList)_button.DataContext).ID;
            DealerMailingList _selectedDealerMailingList = DealerMailingListService.GetByID(ID);

            try
            {
                if (txtReprintTemplateFilePath.Text != _selectedDealerMailingList.TemplateFilePath && txtReprintTemplateFilePath.Text.Length != 0)
                {
                    if (MessageBox.Show("You are selecting a different template than was originally used for this Mailing.  A New Mailing record and Mail Merge will be created using the original CSV file.", "Create New Mail Merge Record?", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                    {
                        _selectedDealerMailingList.TemplateFilePath = txtReprintTemplateFilePath.Text;
                        _selectedDealerMailingList.CreationDate     = DateTime.Parse(DateTime.Now.ToShortDateString());
                        _selectedDealerMailingList.ID = 0;
                        //get the New ID as it is used in the mail merge
                        DealerMailingListService.Save(_selectedDealerMailingList);
                        MailMergeHelper _helper = new MailMergeHelper(_selectedDealer, _selectedDealerMailingList);
                        //process but don't merge
                        _helper.ProcessWordMailMerge(true);
                        LoadPreviousMailings();
                        MessageBox.Show("Mail Merge Created!");
                    }
                }
                else
                {
                    MailMergeHelper _helper = new MailMergeHelper(_selectedDealer, _selectedDealerMailingList);
                    //process but don't merge
                    _helper.ProcessWordMailMerge(true);
                    LoadPreviousMailings();
                    MessageBox.Show("Mail Merge Created!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("The mail merge failed: " + ex.ToString());
            }
        }
コード例 #2
0
        private void btn2StepProcessOpenMailMerge_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                MailMergeHelper _helper = new MailMergeHelper(_dealer, _dealerMailingList);
                //process but don't merge
                try
                {
                    _helper.ProcessWordMailMerge(true);
                    MessageBox.Show("Mail Merge Created!");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error Processing Mail merge: " + ex.ToString(), "Error");
                }

                LoadPreviousMailings();
                LoadMailingTotals();
            }
            catch (Exception ex)
            {
                MessageBox.Show("The Mail Merge failed: " + ex.ToString());
            }
        }