예제 #1
0
파일: DTO_Ribbon.cs 프로젝트: oerb/DTO
        private void CreateMail(Frm_MSG frm_MSG)
        {
            Outlook.Application application = Globals.ThisAddIn.Application;
            Outlook.ExchangeUser currentUser = application.Session.CurrentUser.AddressEntry.GetExchangeUser();
            Outlook.MailItem myMailItem = (Outlook.MailItem)application.CreateItem(Outlook.OlItemType.olMailItem);
            try
            {
                // load a Outlook Predesign by an Outlook Filetyp MSG
                Outlook.MailItem myStorageItem = (Outlook.MailItem)application.Session.OpenSharedItem(frm_MSG.filelocation);
                myMailItem.HTMLBody = myStorageItem.HTMLBody;
                // Parsing a nice Subject String out of the Form
                string subject = frm_MSG.mandant.ToString() + "/ " + frm_MSG.txt_objekt.Text + "/ " +
                    frm_MSG.HausNr.ToString()  + "/ " + frm_MSG.wohnung.ToString()
                    + " : " + frm_MSG.Mieter.ToString() + " - " +
                    frm_MSG.lbl_mieter_txt.Text +
                    " : " + frm_MSG.kreditor.ToString() + " - " +
                    frm_MSG.lbl_kreditor_txt.Text + " : " + myStorageItem.Subject + " : " +
                    frm_MSG.txb_Subject.Text;
                myMailItem.Subject = subject;

            }
            catch //(Exception e)
            {
                string msgtxt = "MSG-TYP Dateipfad ist nicht korrekt. Exeption: ";// +e.ToString();
                MessageBox.Show(msgtxt);
            }

            myMailItem.To = frm_MSG.eMail;
            // Desplay the Mail form with all Inherited
            Globals.ThisAddIn.MailItem = myMailItem;
            myMailItem.Display();
        }
예제 #2
0
파일: DTO_Ribbon.cs 프로젝트: oerb/DTO
        private void btn_schadensmeldung_Click(object sender, RibbonControlEventArgs e)
        {
            //opens Schadensmeldung dialog form
            //Schadensmeldung sam = new Schadensmeldung();
            //DialogResult result = sam.ShowDialog();

            // TODO: TESTING BUTTON REMOVE
            Frm_MSG frm_MSG = new Frm_MSG();
            DialogResult result = frm_MSG.ShowDialog();
            if (result == DialogResult.OK)
            {
                CreateMail(frm_MSG);
            }
        }
예제 #3
0
파일: Derr-Tools.cs 프로젝트: oerb/DTO
 // All Parameters from Frm_MSG.cs to use im Mailboddy
 private Outlook.MailItem replaceFormfields(Outlook.MailItem myMailItem, Frm_MSG frm_MSG, MSG_Parameter msg_parameter)
 {
     string datum1 = msg_parameter.datum1.ToString("dd.MM.yyyy");
     string datum2 = msg_parameter.datum2.ToString("dd.MM.yyyy");
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[Mandant]", msg_parameter.Mandant.ToString());
     myMailItem.Subject = myMailItem.Subject.Replace("[Mandant]", msg_parameter.Mandant.ToString());
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[Unternehmen]", msg_parameter.Unternehmen.ToString());
     myMailItem.Subject = myMailItem.Subject.Replace("[Unternehmen]", msg_parameter.Unternehmen.ToString());
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[WE]", msg_parameter.WE.ToString());
     myMailItem.Subject = myMailItem.Subject.Replace("[WE]", msg_parameter.WE.ToString());
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[HAUSNR]", msg_parameter.HausNr.ToString());
     myMailItem.Subject = myMailItem.Subject.Replace("[HAUSNR]", msg_parameter.HausNr.ToString());
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[NE]", msg_parameter.Wohnung.ToString());
     myMailItem.Subject = myMailItem.Subject.Replace("[NE]", msg_parameter.Wohnung.ToString());
     string adr = Globals.ThisAddIn.msg_parameter.AdresseNr.ToString();
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[ADRNR]", adr);
     myMailItem.Subject = myMailItem.Subject.Replace("[ADRNR]", adr);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[DOKUART]", msg_parameter.DokuArt);
     myMailItem.Subject = myMailItem.Subject.Replace("[DOKUART]", msg_parameter.DokuArt);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[VORGANGKZ]", msg_parameter.VorgangKZ);
     myMailItem.Subject = myMailItem.Subject.Replace("[VORGANGKZ]", msg_parameter.VorgangKZ);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[FOLGENR]", msg_parameter.FolgeNr.ToString());
     myMailItem.Subject = myMailItem.Subject.Replace("[FOLGENR]", msg_parameter.FolgeNr.ToString());
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[Name]", msg_parameter.Name);
     myMailItem.Subject = myMailItem.Subject.Replace("[Name]", msg_parameter.Name);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[Vorname]", msg_parameter.Vorname);
     myMailItem.Subject = myMailItem.Subject.Replace("[Vorname]", msg_parameter.Vorname);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[Sachbearbeiter]", Globals.ThisAddIn.SachBearb);
     myMailItem.Subject = myMailItem.Subject.Replace("[Sachbearbeiter]", Globals.ThisAddIn.SachBearb);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[Datum1]", datum1);
     myMailItem.Subject = myMailItem.Subject.Replace("[Datum1]", datum1);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[Datum2]", datum2 );
     myMailItem.Subject = myMailItem.Subject.Replace("[Datum2]", datum2);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[WEBEZEICHNUNG]", msg_parameter.WeBeszeichnung);
     myMailItem.Subject = myMailItem.Subject.Replace("[WEBEZEICHNUNG]", msg_parameter.WeBeszeichnung);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[NESTRASSE]", msg_parameter.NeStrasse);
     myMailItem.Subject = myMailItem.Subject.Replace("[NESTRASSE]", msg_parameter.NeStrasse);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[NEORT]", msg_parameter.NeOrt);
     myMailItem.Subject = myMailItem.Subject.Replace("[NEORT]", msg_parameter.NeOrt);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[NEETAGE]", msg_parameter.NeEtage);
     myMailItem.Subject = myMailItem.Subject.Replace("[NEETAGE]", msg_parameter.NeEtage);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[MITEL]", msg_parameter.MiTel);
     myMailItem.Subject = myMailItem.Subject.Replace("[MITEL]", msg_parameter.MiTel);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[MITEL2]", msg_parameter.MiTel2);
     myMailItem.Subject = myMailItem.Subject.Replace("[MITEL2]", msg_parameter.MiTel2);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[MIMOB]", msg_parameter.MiMob);
     myMailItem.Subject = myMailItem.Subject.Replace("[MIMOB]", msg_parameter.MiMob);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[KREDITORNAME]", msg_parameter.KreditorName);
     myMailItem.Subject = myMailItem.Subject.Replace("[KREDITORNAME]", msg_parameter.KreditorName);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[KREDITOR]", msg_parameter.KreditorAdr.ToString());
     myMailItem.Subject = myMailItem.Subject.Replace("[KREDITOR]", msg_parameter.KreditorAdr.ToString());
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[BRIEFANREDE]", msg_parameter.BriefAnrede);
     myMailItem.Subject = myMailItem.Subject.Replace("[BRIEFANREDE]", msg_parameter.BriefAnrede);
     myMailItem.HTMLBody = myMailItem.HTMLBody.Replace("[KREDITORBRIEFANREDE]", msg_parameter.KreditorBriefAnrede);
     myMailItem.Subject = myMailItem.Subject.Replace("[KREDITORBRIEFANREDE]", msg_parameter.KreditorBriefAnrede);
     // TODO: Remove this Helper MSGBox
     //string msgtext = "Datum1 ist: " + datum1 + " Datum2 ist: " + datum2 + " AdresseNr: " + adr;
     //MessageBox.Show(msgtext);
     return myMailItem;
 }
예제 #4
0
파일: Derr-Tools.cs 프로젝트: oerb/DTO
        private void CreateMail(Frm_MSG frm_MSG)
        {
            Outlook.UserProperties mailUserProperties = null;
            Outlook.UserProperty mailUserProperty = null;
            //Globals.ThisAddIn.msg_parameter = frm_MSG.msg_parameter;
            Outlook.Application application = Globals.ThisAddIn.Application;
            Outlook.ExchangeUser currentUser = application.Session.CurrentUser.AddressEntry.GetExchangeUser();
            Outlook.MailItem myMailItem = (Outlook.MailItem)application.CreateItem(Outlook.OlItemType.olMailItem);
            try
            {
                // load a Outlook Predesign by an Outlook Filetyp MSG
                Outlook.MailItem myStorageItem = (Outlook.MailItem)application.Session.OpenSharedItem(frm_MSG.filelocation);
                myMailItem.HTMLBody = myStorageItem.HTMLBody;

                // give the MailItem a new Property that marks it for archiving
                mailUserProperties = myMailItem.UserProperties;
                mailUserProperty = mailUserProperties.Add("Saperion", Outlook.OlUserPropertyType.olYesNo, false);
                mailUserProperty.Value = true;
                // proof if Kreditor or Mieter is Set an Preset the String Var in common
                string kreditor = "";
                if(frm_MSG.kreditor != 0)
                {
                    kreditor = " : " + frm_MSG.kreditor.ToString() + " - " +
                    frm_MSG.lbl_kreditor_txt.Text;
                }
                string mieter = "";
                if(frm_MSG.Mieter != 0)
                {
                    mieter = " : " + frm_MSG.Mieter.ToString() + " - " +
                    frm_MSG.lbl_mieter_txt.Text;
                }
                string wohnung = "";
                if (frm_MSG.wohnung != 0)
                {
                    wohnung = "/ " + frm_MSG.wohnung.ToString() + " - " + frm_MSG.txt_objekt.Text + " - " +
                        frm_MSG.lbl_haus_txt.Text;
                }
                // Parsing a nice Subject String out of the Form
                string subject = "";
                //if (true)
                //{
                //    subject = "U/W/H/WO:" + frm_MSG.mandant.ToString() + "/ " + frm_MSG.txt_objekt.Text + "/ " +
                //    frm_MSG.HausNr.ToString() + wohnung
                //     + mieter + kreditor +
                //     " : " + myStorageItem.Subject + " : " +
                //    frm_MSG.txb_Subject.Text;
                //}
                subject = myStorageItem.Subject + " : " + frm_MSG.txb_Subject.Text;
                myMailItem.Subject = subject;
                // set prefillifo about E-Mail in Mail-TO:
                myMailItem.To = frm_MSG.eMail;
                myMailItem = this.replaceFormfields(myMailItem, frm_MSG, Globals.ThisAddIn.msg_parameter);
                // Desplay the Mail form with all Inherited
                Globals.ThisAddIn.msg_parameter.MailItem = myMailItem;
                myMailItem.Display();
            }
            catch (Exception e)
            {
                string msgtxt = "Meldungstyp nicht gesetzt oder Dateipfad ist nicht korrekt. Exeption: " +e.ToString();
                MessageBox.Show(msgtxt);
            }
        }