private void AddKundenkontakte(string kundenNr) { var list = new SortableBindingList <Kundenkontakt>(); foreach (var kRow in DataManager.ContactDataService.GetKundenkontaktRows(kundenNr)) { var contact = new Kundenkontakt(kRow); list.Add(contact); } this.myContactDictionary.Add(kundenNr, list); }
void dgvContacts_RowEnter(object sender, DataGridViewCellEventArgs e) { var kontakt = this.dgvContacts.Rows[e.RowIndex].DataBoundItem as Kundenkontakt; if (kontakt != null) { foreach (ToolStripMenuItem item in ctxGrid.Items) { if (item.Tag != null) { item.Click -= (System.EventHandler)item.Tag; item.Tag = null; } } this.ctxGrid.Items.Clear(); this.mySelectedKontakt = kontakt; if (!string.IsNullOrEmpty(kontakt.Telefon)) { var xmnuFestAnrufen = new ToolStripMenuItem(); xmnuFestAnrufen.Text = string.Format("Büro: {0} anrufen", kontakt.Telefon); this.ctxGrid.Items.Add(xmnuFestAnrufen); var festHandler = new System.EventHandler(xmnuFestAnrufen_Click); xmnuFestAnrufen.Tag = festHandler; xmnuFestAnrufen.Click += festHandler; } if (!string.IsNullOrEmpty(kontakt.Handy)) { var xmnuMobilAnrufen = new ToolStripMenuItem(); xmnuMobilAnrufen.Text = string.Format("Mobil: {0} anrufen", kontakt.Handy); this.ctxGrid.Items.Add(xmnuMobilAnrufen); var mobilHandler = new System.EventHandler(xmnuMobilAnrufen_Click); xmnuMobilAnrufen.Tag = mobilHandler; xmnuMobilAnrufen.Click += mobilHandler; } if (!string.IsNullOrEmpty(kontakt.E_Mail)) { var xmnuSendMail = new ToolStripMenuItem(); xmnuSendMail.Text = string.Format("E-Mail an: {0}", kontakt.E_Mail); this.ctxGrid.Items.Add(xmnuSendMail); var mailHandler = new System.EventHandler(xmnuSendMail_Click); xmnuSendMail.Tag = mailHandler; xmnuSendMail.Click += mailHandler; } } }
// Delegate function that's called by the SomeoneIsCalling event handler. private void ShowCustomerDashboardView(string theCallersId) { var customerId = Data.DataManager.AllDataService.GetCustomerIdByFonNumber(theCallersId); if (!string.IsNullOrEmpty(customerId)) { var customer = ModelManager.CustomerService.GetKunde(customerId, true); Kundenkontakt contact = null; if (customer != null) { if (contact != null) { var kmv = new KundeMainView(customer, contact); kmv.Show(); } else { var kmv = new KundeMainView(customer); kmv.Show(); } } } }
void MailToCustomer() { Kundenkontakt contact = null; var clv = new ContactListView(this.myOffer.Customer); if (clv.ShowDialog() == DialogResult.OK && clv.SelectedContact != null) { contact = clv.SelectedContact; var pdfFile = PdfMaker.PdfManager.PdfService.CreateOfferDocument(this.myOffer, false, false); var nl = Environment.NewLine; var bodyParams = new string[6]; bodyParams[0] = nl; bodyParams[1] = "Sehr geehrte(r)"; bodyParams[2] = contact.Kontaktname; bodyParams[3] = "Vielen Dank für Ihre Anfrage."; bodyParams[4] = "Sie finden Ihr Angebot als PDF Datei im Anhang dieser Nachricht."; bodyParams[5] = ModelManager.UserService.CurrentUser.Signature; var body = string.Format("{1} {2}{0}{0}{3}{0}{4}{0}{0}{5}", bodyParams); var newMessage = ModelManager.PostBuedel.CreateMailMessage(contact.E_Mail, "Angebot", body, pdfFile); var ev = new EmailView(newMessage, this.myOffer.Customer); ev.ShowDialog(); this.myOffer.SetPrintDateOffer(); } }
public void CallContact(Kundenkontakt contact) { Agfeo.FonManager.FonService.MakeCall(contact.Telefon); }
void mbtnSetAutoProperties_Click(object sender, EventArgs e) { Kunde customer = null; Lieferant supplier = null; Kundenkontakt contact = null; Kundenmaschine machine = null; var msg = string.Empty; var msgBoxTitle = "Ausfüllen der Termineigenschaften" + Environment.NewLine; var subject = string.Empty; var location = string.Empty; var body = string.Empty; foreach (var lItem in ModelManager.AppointmentService.GetLinkedItemsList(this.myAppointment)) { if (lItem is Kunde) { customer = lItem as Kunde; } else if (lItem is Kundenkontakt) { contact = lItem as Kundenkontakt; } else if (lItem is Kundenmaschine) { machine = lItem as Kundenmaschine; } else if (lItem is Lieferant) { supplier = lItem as Lieferant; } } if (customer == null && supplier == null) { msg = "Bitte vorher den Termin zumindest mit einem Kunden oder einem Lieferanten verknüpfen."; MetroMessageBox.Show(this, msg, msgBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } msg = "Ich trage die Eigenschaften dieses Termins automatisch ein."; if (MetroMessageBox.Show(this, msg, msgBoxTitle, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != System.Windows.Forms.DialogResult.OK) { return; } switch (this.myAppointment.AppointmentType) { case "Kundenbesuch": if (customer != null) { subject = string.Format("{0}: Besuchstermin", customer.Matchcode); location = string.Format("{0}, {1} {2}", customer.Street, customer.ZipCode, customer.City); if (myCurrentUser.CalendarSettings.AddCustomerInfo) { body = customer.GetCustomerInfoHtml(contact); } if (myCurrentUser.CalendarSettings.AddCustomerNotes) { body += customer.GetNotesHtml(); } if (myCurrentUser.CalendarSettings.AddCustomerPriceList) { body += customer.GetSpecialPriceListHtml(); } } break; case "Schulung": if (supplier != null) { subject = string.Format("{0}: Schulung", supplier.Matchcode); location = string.Format("{0}, {1} {2}", supplier.Strasse, supplier.Postleitzahl, supplier.Ort); } break; case "Wartungstermin": if (machine != null) { subject = string.Format("{0}: Wartung {1} ({2})", customer.Matchcode, machine.Modellbezeichnung, machine.Seriennummer); } else { subject = string.Format("{0}: Wartung ", customer.Matchcode); } if (myCurrentUser.CalendarSettings.AddCustomerAddress) { location = string.Format("{0}, {1} {2}", customer.Street, customer.ZipCode, customer.City); } if (myCurrentUser.CalendarSettings.AddCustomerInfo) { body = customer.GetCustomerInfoHtml(contact); } if (myCurrentUser.CalendarSettings.AddCustomerNotes) { body += customer.GetNotesHtml(); } if (myCurrentUser.CalendarSettings.AddCustomerPriceList) { body += customer.GetSpecialPriceListHtml(); } break; case "Servicetermin": if (machine != null) { subject = string.Format("{0}: Service {1} ({2})", customer.Matchcode, machine.Modellbezeichnung, machine.Seriennummer); } else { subject = string.Format("{0}: Wartung ", customer.Matchcode); } if (myCurrentUser.CalendarSettings.AddCustomerAddress) { location = string.Format("{0}, {1} {2}", customer.Street, customer.ZipCode, customer.City); } if (myCurrentUser.CalendarSettings.AddCustomerInfo) { body = customer.GetCustomerInfoHtml(contact); } if (myCurrentUser.CalendarSettings.AddCustomerNotes) { body += customer.GetNotesHtml(); } if (myCurrentUser.CalendarSettings.AddCustomerPriceList) { body += customer.GetSpecialPriceListHtml(); } break; case "Fernwartung": subject = string.Format("{0}: Fernwartung", customer.Matchcode); location = "Technik CPM"; if (myCurrentUser.CalendarSettings.AddCustomerInfo) { body = customer.GetCustomerInfoHtml(contact); } break; case "Maschinenlieferung": if (machine != null) { subject = string.Format("{0}: Auslieferung {1} ({2})", customer.Matchcode, machine.Modellbezeichnung, machine.Seriennummer); } else { subject = string.Format("{0}: Auslieferung ", customer.Matchcode); } if (myCurrentUser.CalendarSettings.AddCustomerAddress) { location = string.Format("{0}, {1} {2}", customer.Street, customer.ZipCode, customer.City); } if (myCurrentUser.CalendarSettings.AddCustomerInfo) { body = customer.GetCustomerInfoHtml(contact); } if (myCurrentUser.CalendarSettings.AddCustomerNotes) { body += customer.GetNotesHtml(); } if (myCurrentUser.CalendarSettings.AddCustomerPriceList) { body += customer.GetSpecialPriceListHtml(); } break; case "Maschinenabholung": if (machine != null) { subject = string.Format("{0}: Abholung {1} ({2})", customer.Matchcode, machine.Modellbezeichnung, machine.Seriennummer); } else { subject = string.Format("{0}: Auslieferung ", customer.Matchcode); } location = "Technik CPM"; if (myCurrentUser.CalendarSettings.AddCustomerInfo) { body = customer.GetCustomerInfoHtml(contact); } if (myCurrentUser.CalendarSettings.AddCustomerNotes) { body += customer.GetNotesHtml(); } if (myCurrentUser.CalendarSettings.AddCustomerPriceList) { body += customer.GetSpecialPriceListHtml(); } break; case "Telefonat": subject = string.Format("{0}: Telefonat", customer.Matchcode); location = "Technik CPM"; if (myCurrentUser.CalendarSettings.AddCustomerInfo) { body = customer.GetCustomerInfoHtml(contact); } if (myCurrentUser.CalendarSettings.AddCustomerNotes) { body += customer.GetNotesHtml(); } if (myCurrentUser.CalendarSettings.AddCustomerPriceList) { body += customer.GetSpecialPriceListHtml(); } break; case "Undefiniert": subject = string.Format("{0}: Undefinierter Termin", customer.Matchcode); if (myCurrentUser.CalendarSettings.AddCustomerAddress) { location = string.Format("{0}, {1} {2}", customer.Street, customer.ZipCode, customer.City); } if (myCurrentUser.CalendarSettings.AddCustomerInfo) { body = customer.GetCustomerInfoHtml(contact); } if (myCurrentUser.CalendarSettings.AddCustomerNotes) { body += customer.GetNotesHtml(); } if (myCurrentUser.CalendarSettings.AddCustomerPriceList) { body += customer.GetSpecialPriceListHtml(); } break; case "Demo": if (machine != null) { subject = string.Format("{0}: Abholung {1} ({2})", customer.Matchcode, machine.Modellbezeichnung, machine.Seriennummer); } else { subject = string.Format("{0}: Demo ", customer.Matchcode); } if (myCurrentUser.CalendarSettings.AddCustomerInfo) { body = customer.GetCustomerInfoHtml(contact); } if (myCurrentUser.CalendarSettings.AddCustomerNotes) { body += customer.GetNotesHtml(); } if (myCurrentUser.CalendarSettings.AddCustomerPriceList) { body += customer.GetSpecialPriceListHtml(); } break; case "Besprechung": subject = "Besprechung"; location = "Empfang CPM"; body = string.Format(@"<p><strong><u>Teilnehmer</u></strong></p><ul>{0}</ul>", myCurrentUser.CalendarSettings.TargetUser.NameFull); break; default: subject = string.Format("{0}: {1}", customer.Matchcode, myAppointment.AppointmentType); if (myCurrentUser.CalendarSettings.AddCustomerAddress) { location = string.Format("{0}, {1} {2}", customer.Street, customer.ZipCode, customer.City); } if (myCurrentUser.CalendarSettings.AddCustomerInfo) { body = customer.GetCustomerInfoHtml(contact); } if (myCurrentUser.CalendarSettings.AddCustomerNotes) { body += customer.GetNotesHtml(); } if (myCurrentUser.CalendarSettings.AddCustomerPriceList) { body += customer.GetSpecialPriceListHtml(); } break; } this.myAppointment.Subject = subject; this.myAppointment.Location = location; this.myAppointment.BodyHtml = body; this.RefreshDataBindings(); }