コード例 #1
0
 private void frmCoverSheetPath_Load(object sender, EventArgs e)
 {
     try
     {
         if (ObjBProject == null)
         {
             ObjBProject = new BProject();
         }
         if (ObjEProject == null)
         {
             ObjEProject = new EProject();
         }
         ObjEProject            = ObjBProject.GetPath(ObjEProject);
         txtCoverSheetPath.Text = ObjEProject.CoverSheetPath;
         txtTemplatePath.Text   = ObjEProject.TemplatePath;
     }
     catch (Exception ex)
     {
         Utility.ShowError(ex);
     }
 }
コード例 #2
0
        private void bbAngebot_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
                SplashScreenManager.Default.SetWaitFormDescription("Bitte warten…");

                if (ObjEProject == null)
                {
                    ObjEProject = new EProject();
                }
                if (ObjBProject == null)
                {
                    ObjBProject = new BProject();
                }
                ObjEProject = ObjBProject.GetPath(ObjEProject);
                var    FolderPath    = new DirectoryInfo(ObjEProject.TemplatePath).GetFiles("V-011*.dotx", SearchOption.AllDirectories).OrderByDescending(d => d.LastWriteTimeUtc).First();
                Object oTemplatePath = ObjEProject.TemplatePath + "\\" + FolderPath;
                if (File.Exists(Convert.ToString(oTemplatePath)))
                {
                    if (!Utility.fileIsOpen(Convert.ToString(oTemplatePath)))
                    {
                        Microsoft.Office.Interop.Word.Application ap = new Microsoft.Office.Interop.Word.Application();
                        ap.Documents.Open(oTemplatePath);
                        ap.Visible = true;
                        ap.Activate();
                    }
                    else
                    {
                        throw new Exception("Bitte schließen Sie die Angebots-Dokumente aller Projekte");
                    }
                }
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("Sequence contains no elements"))
                {
                    XtraMessageBox.Show("Die erforderliche Dokumentenvorlage ist nicht eingestellt!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            finally { SplashScreenManager.CloseForm(false); }
        }