private void companyContactTaskPicker1_CustomerContactSelected(KundeInfo kundeInfo, KontaktInfo kontaktInfo) { if (kundeInfo != null) { HandleContactSelected(kundeInfo, kontaktInfo); } else { HandleNoContactSelected(); } }
public static bool ArchiveSelectedItem(bool treatAtSentMail, BrugerInfo currentBruger, Outlook.MailItem mailItem, MailItemInfo mailItemInfo, KundeInfo companyInfo, KontaktInfo contactInfo, TaskInfo taskInfo, Outlook.NameSpace sessionNamespace) { var fromBruger = treatAtSentMail ? currentBruger : null; var toBruger = treatAtSentMail ? currentBruger : null; var documentType = treatAtSentMail ? DocumentType.SentMail : DocumentType.ReceivedMail; var documentGuid = Guid.NewGuid(); var companyFolder = TryGetCompanyOutlookFolder(companyInfo.ID, currentBruger, sessionNamespace); // Vi har muligvis ikke rettigheder til at tilgå eller oprette mappen // Brugeren har fået besked så vi kan returnere if (companyFolder == null) { return false; } SetIOfficeProperties(documentGuid, mailItem); dynamic archivedItemDynamic; var itemCopy = (Outlook.MailItem)mailItem.Copy(); archivedItemDynamic = itemCopy.Move(companyFolder); var archivedItem = (Outlook.MailItem)archivedItemDynamic; // Efter move får item nyt entryID og storeID mailItemInfo = new MailItemInfo(archivedItem); var mailItemDocument = new IOfficeOutlookAddIn.Document() { DOC_Body = mailItemInfo.BodyPlainText, DOC_CompanyGUID = companyInfo.ID, DOC_ContactGUID = contactInfo != null ? contactInfo.ID : new Nullable<Guid>(), DOC_CreatedByGUID = currentBruger.ID, DOC_CreatedDate = DateTime.Now, DOC_DocumentType = (int)documentType, DOC_ExchangeEntryID = mailItemInfo.CurrentMailItemEntryID, DOC_ExchangeFolderEntryID = null, // BRUGES IKKE DOC_ExchangeFolderStoreID = null, // BRUGES IKKE DOC_ExchangeStoreID = mailItemInfo.CurrentMailItemFolderStoreID, DOC_FromUserGUID = fromBruger != null ? fromBruger.ID : new Nullable<Guid>(), DOC_GUID = documentGuid, DOC_IsArchived = 1, DOC_IsInstantiated = 1, DOC_IsPrivate = 0, DOC_MailCreatedDatetime = mailItemInfo.Created, DOC_MailReceivedDatetime = mailItemInfo.Received, DOC_MailSentDatetime = mailItemInfo.Sent, DOC_MailUpdatedDatetime = DateTime.Now, // Hvad er det? DOC_MasterDate = DateTime.Now, // Hvad er det? DOC_OriginalFileName = string.Empty, DOC_ProjectGUID = null, DOC_SMTP_From = mailItemInfo.FromEmailAddress, DOC_SMTP_FromDisplayName = string.IsNullOrEmpty(mailItemInfo.FromDisplayName) == false ? mailItemInfo.FromDisplayName : treatAtSentMail == true ? fromBruger.Navn : "(Unknown)", DOC_SMTP_To = mailItemInfo.RecipientsEmailAddress, DOC_SMTP_ToDisplayName = mailItemInfo.RecipientsDisplayName, DOC_Subject = mailItemInfo.Subject, DOC_TaskGUID = taskInfo != null ? taskInfo.ID : new Nullable<Guid>(), DOC_TemplateGUID = null, DOC_Title = null, // Bruges vist ikke hvis mail DOC_ToUserGUID = toBruger != null ? toBruger.ID : new Nullable<Guid>(), DOC_TypeGUID = new Nullable<Guid>(), // BRUGES IKKE DOC_UpdatedByGUID = currentBruger.ID, DOC_UpdatedDate = DateTime.Now, DOC_WebVisible = 0, IsThrash = 0 }; using (var _dc = new iorunEntities()) { _dc.Document.Add(mailItemDocument); _dc.SaveChanges(); } return true; }
private void companyContactTaskPicker2_TaskSelected(KundeInfo kundeInfo, KontaktInfo kontaktInfo, TaskInfo taskInfo) { _currentCompanyInfo = kundeInfo; _currentContactInfo = kontaktInfo; _currentTaskInfo = taskInfo; UpdateComposeMail(); }
private void companyContactTaskPicker1_TaskSelected(KundeInfo kundeInfo, KontaktInfo kontaktInfo, TaskInfo taskInfo) { HandleTaskSelected(kundeInfo, kontaktInfo, taskInfo); }
private void HandleTaskSelected(KundeInfo kundeInfo, KontaktInfo kontaktInfo, TaskInfo taskInfo) { _currentTaskInfo = taskInfo; }
private void archivePanelCompanyContactTaskPicker1_QueryArchive(KundeInfo kundeInfo, KontaktInfo kontaktInfo, TaskInfo taskInfo) { ArchiveSelectedItem(); }
private void HandleContactSelected(KundeInfo kundeInfo, KontaktInfo kontaktInfo) { _currentCompanyInfo = kundeInfo; _currentContactInfo = kontaktInfo; archiveMoveButton.Enabled = true; receivedRadioButton.Enabled = true; sentRadioButton.Enabled = true; }
private void HandleNoContactSelected() { _currentCompanyInfo = null; _currentContactInfo = null; archiveMoveButton.Enabled = false; receivedRadioButton.Enabled = false; sentRadioButton.Enabled = false; }
private void composePanelCompanyContactTaskPicker_CustomerContactSelected(KundeInfo kundeInfo, KontaktInfo kontaktInfo) { _currentCompanyInfo = kundeInfo; _currentContactInfo = kontaktInfo; _currentTaskInfo = null; UpdateComposeMail(); }
private void UpdateTasks(KundeInfo kundeInfo) { using (var dc = new iorunEntities()) { var tasks = dc.Tasks.Where(t => t.Task_CompanyGUID == kundeInfo.ID && t.IsThrash == 0 && t.Task_IsClosed == 0). ToList(). OrderBy(t => t.Task_Caption).ToList(); var lvs = new List<ListViewItem>(); foreach (var thisTask in tasks) { var taskInfo = new TaskInfo(thisTask); var lvi = new ListViewItem(taskInfo.Caption); lvi.SubItems.Add(taskInfo.Description); lvi.Tag = taskInfo; lvs.Add(lvi); } if (tasks.Count > 0) { tasksListView.Enabled = true; } else { tasksListView.Enabled = false; tasksListView.Items.Add(new ListViewItem("(No tasks)")); } tasksListView.Items.AddRange(lvs.ToArray()); } }
private void RaiseTaskSelected(KundeInfo kundeInfo, KontaktInfo kontaktInfo, TaskInfo taskInfo) { if (TaskSelected != null) { TaskSelected(kundeInfo, kontaktInfo, taskInfo); } }
private void RaiseQueryArchive(KundeInfo kundeInfo, KontaktInfo kontaktInfo, TaskInfo taskInfo) { if (QueryArchive != null) { QueryArchive(kundeInfo, kontaktInfo, taskInfo); } }
private void RaiseCustomerContactSelected(KundeInfo kundeInfo, KontaktInfo kontaktInfo) { if (CustomerContactSelected != null) { CustomerContactSelected(kundeInfo, kontaktInfo); } }