public void ReceiveInteragtionRequest() { var request = new NotificationRequest(); var behavior = new BehaviorMock { NotificationRequest = request }; var page = new PageMock(); page.Behaviors.Add(behavior); request.Raise(); Assert.NotNull(behavior.Sender); Assert.Equal(request, behavior.Sender); Assert.NotNull(behavior.EventArgs); Assert.Equal(EventArgs.Empty, behavior.EventArgs); behavior.Sender = null; behavior.EventArgs = null; page.Behaviors.Clear(); request.Raise(); Assert.Null(behavior.Sender); Assert.Null(behavior.EventArgs); }
private void Detail() { var supplier = SuppliersView.CurrentItem as Supplier; using (var context = new MasterDataContext()) { var existingSupplier = context.Suppliers.Where(s => s.Id == supplier.Id) .Include(s => s.Contacts).FirstOrDefault(); if (existingSupplier != null) { var parameters = new NavigationParameters { { "supplier", existingSupplier } }; IRegionManager regionManager = ServiceLocator.Current.GetInstance <IRegionManager>(); regionManager.RequestNavigate(RegionNames.MAIN_REGION, "SupplierDetail", parameters); } else { NotificationRequest.Raise( new Notification { Content = "供应商 " + supplier.Name + " 不存在。\n可能已删除,请重新查询。", Title = "提示" } ); } } }
private void SendEmailToCEO(string xlsxFile) { string test = Properties.Settings.Default.CEOTo; SendEmailClass sendEmail = new SendEmailClass(); sendEmail.Subject = $"Gehaltsübersicht ({monthlySalaryDate:MMMM yyyy})"; //sendEmail.ToAddress = Properties.Settings.Default.CEOTo; sendEmail.ToAddress = "*****@*****.**"; sendEmail.Attachments.Add(xlsxFile); sendEmail.Body = $"Hallo Johann, {Environment.NewLine}{Environment.NewLine} anbei die Auswertung wie besprochen." + $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen {System.Environment.NewLine} {System.Environment.NewLine} QuantCo Deutschland GmbH"; bool success = sendEmail.SendEmailToServer(); if (!success) { NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = $"Das Email an {sendEmail.ToAddress} konnte nicht gesendet werden" }); } }
private void ListOfDocuments_CurrentChanged(object sender, EventArgs e) { EmployeeDocument document = ListOfDocuments.CurrentItem as EmployeeDocument; if (!string.IsNullOrEmpty(document.DocumentFileName)) { FileInfo fileInfo = new FileInfo(Path.Combine(employeeDirectory, document.DocumentFileName)); if (fileInfo.Exists) { SelectedFileName = fileInfo.FullName; } else { NotificationRequest.Raise(new Notification { Title = "QuantCo Deutschland GmbH", Content = $"Die Datei {fileInfo.FullName} wurde entweder gelöscht oder verschoben" }); SelectedFileName = null; } } else { //SelectedFileName = ""; } }
/// <summary> /// Send E-Mails to Colleagues regarding open vacation days /// </summary> private void OnVacationLiability() { DateTime reportDate = timeFunctions.MonthEnd(timeFunctions.MonthEnd(MonthlySalaryDate)); CreateEmployeeSalaryOverview salaryOverview = new CreateEmployeeSalaryOverview(null, new DateTime(reportDate.Year, 1, 1), reportDate); List <EmployeesMonthlyPayments> monthlyPayments = salaryOverview.GetMonthlyPayments(reportDate.Month); foreach (EmployeesMonthlyPayments payment in monthlyPayments) { EmployeesForTravelExpenses employee = dbAccess.FindEmployeeById(payment.EmployeeForTravelExpensesId); if (employee == null) { continue; } EmployeePaymentDetail salarydetail = dbAccess.GetLatestSalary(payment.EmployeeForTravelExpensesId); // do not send emails to people whos contract expire if (salarydetail.LastPayment != null && salarydetail.LastPayment == reportDate) { continue; } // Send Email SendEmailClass sendEmail = new SendEmailClass(); sendEmail.Subject = "Urlaub / Vacation "; sendEmail.ToAddress = employee.EmailAddress; StringBuilder germanText = new StringBuilder(); germanText.Append($"Liebe(r) {employee.FirstName},{Environment.NewLine}{Environment.NewLine}"); germanText.Append("Wie einmal im Jahr üblich, bitte ich dich mir mitzuteilen, wieviele Urlaubstage zum Jahresende noch offen sein werden. Falls du deinen kompletten Urlaub genommen hast, kannst du diese E-Mail ignorieren." + Environment.NewLine + Environment.NewLine); germanText.Append($"Solltest du im Laufe des Jahres {reportDate.Year} bei QuantCo angefangen haben, errechnen sich die Urlaubstage nach der Formel 28 / 12 * Anzahl Monate bei QuantCo (Ergebnis bitte aufrunden)."); germanText.Append(Environment.NewLine + Environment.NewLine + "Vielen Dank für deine Unterstützung." + Environment.NewLine + Environment.NewLine); StringBuilder englishText = new StringBuilder(); englishText.Append($"Dear {employee.FirstName},{Environment.NewLine}{Environment.NewLine}"); englishText.Append("As usual once a year, I would like to ask you to tell me how many vacation days are left for this calendar year. Should you have taken all your vacation you can ignore this email." + Environment.NewLine + Environment.NewLine); englishText.Append($"In case you have joined QuantCo in {reportDate.Year} you can calculate the number of vacation days using the formula: 28 / 12 * number of months with QuantCo (result can be rounded up)."); englishText.Append(Environment.NewLine + Environment.NewLine + "Thank you for your support." + Environment.NewLine + Environment.NewLine); sendEmail.Body = $"{germanText.ToString()}{englishText.ToString()}" + $"{System.Environment.NewLine} {System.Environment.NewLine} Mit freundlichen Grüßen / Best regards {System.Environment.NewLine} {System.Environment.NewLine} Franz"; bool success = true; if (employee.FirstName.Contains("Sabrina") || employee.FirstName.Contains("Franz")) { success = sendEmail.SendEmailToServer(); } if (!success) { NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = $"Das Email an {sendEmail.ToAddress} konnte nicht gesendet werden" }); } } }
private bool GetFileData(PeFund peFund) { DirectoryHelper.CheckDirectory($"TextFiles"); textFileInfo = DirectoryHelper.GetTextFileName(Fund.Id); if (textFileInfo.Exists) { string fileContent = string.Empty; using (StreamReader sr = new StreamReader(textFileInfo.FullName)) { fileContent = sr.ReadToEnd(); } if (!string.IsNullOrEmpty(fileContent)) { cashFlowInformation = JsonConvert.DeserializeObject <CashFlowInformation>(fileContent); } if (cashFlowInformation == null) { NotificationRequest.Raise(new Notification() { Title = ApplicationNames.NotificationTitle, Content = "Die Ausschüttungsdaten konnten nicht gelesen werden" }); return(false); } return(true); } return(false); }
private void Refresh() { using (var context = new MasterDataContext()) { var supplier = context.Suppliers.Where(s => s.Id == CurrentSupplier.Id) .Include(s => s.Contacts).FirstOrDefault(); if (supplier != null) { CurrentSupplier = supplier; } else { NotificationRequest.Raise( new Notification { Content = "供应商" + supplier.Name + "不存在。\n可能已删除,请重新查询。", Title = "提示" } ); CurrentSupplier = new Supplier { InternalType = "Supplier", Contacts = new ObservableCollection <Contact>(), }; IsExisting = false; } } }
void RaiseNotification() { NotificationRequest.Raise(new Notification { Content = "Notification Message", Title = "Notification" }, r => data = "Notified"); }
private void OnRowDeleting(object obj) { var e = (Telerik.Windows.Controls.GridViewDeletingEventArgs)obj; if (e == null) { return; } if (!dataAccess.IsQuantCoBranchUsed(selectedItem.Id)) { if (dataAccess.RemoveQuantCoBranch(selectedItem)) { return; } } else { NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = "Die Niederlassung kann nicht gelöscht werden. Sie ist noch mind. einem Mitarbeiter zugeordnet" }); // e.Cancel = true ensures the record is not cancelled e.Cancel = true; return; } }
//編集 private void ExecuteUpdate() { //オブジェクト生成 QuestionModel obj = new QuestionModel() { Id = Id, Category = CategoryItem, Content = Content, Correct = Correct, Incorrect1 = Incorrect1, Incorrect2 = Incorrect2, Incorrect3 = Incorrect3, Comment = Comment }; //データベース保存 if (SQL.UpdateQuestion(obj)) { NotificationRequest.Raise(new Notification { Content = "編集しました", Title = "成功" }); _regionManager.Regions["ContentRegion1"].RemoveAll(); _regionManager.RequestNavigate("ContentRegion1", "EditMenuView"); } else { NotificationRequest.Raise(new Notification { Content = "編集に失敗しました", Title = "失敗" }); } }
private void ShowPopup() { NotificationRequest.Raise(new Notification() { Content = "通知消息", Title = "通知" }, r => Title = "通知完成"); }
private void GetTimesheetData() { if ((_tabControlService.TabItemSelected as TimesheetViewModel) != null) { var timeSheetData = _timesheetService.GetTimesheetData(EmailAddress, StartDate, EndDate); _eventAggregator.GetEvent <TimesheetUpdatedEvent>().Publish(timeSheetData); if (timeSheetData.Count() > 0) { _eventAggregator.GetEvent <StatusUpdatedEvent>().Publish(string.Format("Timesheet information for {0} updated. Total Records: {1}", EmailAddress, timeSheetData.Count())); } else { NotificationRequest.Raise(new Notification { Title = "Timesheet data empty", Content = "Response from service doesn't have data to show." }); } } else if ((_tabControlService.TabItemSelected as DailySummaryViewModel) != null) { var dailySummary = _timesheetService.GetDailySummary(EmailAddress, StartDate, EndDate); _eventAggregator.GetEvent <DailySummaryUpdatedEvent>().Publish(dailySummary); if (dailySummary.Count() > 0) { _eventAggregator.GetEvent <StatusUpdatedEvent>().Publish(string.Format("Daily Summary information for {0} updated. Total Records: {1}", EmailAddress, dailySummary.Count())); } else { NotificationRequest.Raise(new Notification { Title = "Daily Summary data empty", Content = "Response from service doesn't have data to show." }); } } }
void RaiseNotification() { // 触发Raised事件 NotificationRequest.Raise(new Notification { Content = "Notification Message", Title = "Notification" }, r => Title = "Notified"); }
private void OnConfirmDeleteCommitment(IConfirmation confirm) { if (!confirm.Confirmed) { return; } // delete Commitment try { investorAccess.DeleteInvestorCommitment(SelectedCommitment); eventAggregator.GetEvent <StatusBarEvent>().Publish($"Das Commitment für den Fonds {SelectedCommitment.PeFund.FundShortName} wurde gelöscht."); Commitments.Remove(SelectedCommitment); } catch (Exception ex) { NotificationRequest.Raise(new Notification { Title = ApplicationNames.NotificationTitle, Content = $"Das Commitment für den Fonds {SelectedCommitment.PeFund.FundShortName} konnte nicht gelöscht werden. " + ex.Message }); } }
public void OnSaveTravelExpense() { // remove travelexpenseitem in case of amount00 and amount07 and amount19 are o for (int i = 0; i < TravelExpense.TravelExpenseItems.Count; i++) { TravelExpenseItem item = travelExpense.TravelExpenseItems.ElementAt(i); if (item.Amount00 == 0 && item.Amount07 == 0 && item.Amount19 == 0) { TravelExpense.TravelExpenseItems.Remove(item); } } TravelExpense.EmployeeForTravelExpensesId = SelectedEmployee.Id; TravelExpense.EmployeeName = SelectedEmployee.FullName; TravelExpense.MonthAndYear = $"{ReportAsOf.ToString("MMMM yyyy")}"; TravelExpense.TravelExpenseItems = expenseItems.ToList(); TravelExpense.ExpenseDate = new DateTime(ReportAsOf.Year, ReportAsOf.Month, 1); if (TravelExpense.Id == 0) { TravelExpense = dbAccess.InsertTravelExpense(TravelExpense); } else { TravelExpense updated = dbAccess.UpdateTravelExpense(TravelExpense); if (updated == null) { NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = "Fehler beim Ändern der Reisekosten" }); } } }
public void ReceiveInteragtionRequestAfterInteractionRequestChanged() { var requestA = new NotificationRequest(); var behavior = new BehaviorMock { NotificationRequest = requestA }; var page = new PageMock(); page.Behaviors.Add(behavior); var requestB = new NotificationRequest(); behavior.NotificationRequest = requestB; requestA.Raise(); Assert.Null(behavior.Sender); Assert.Null(behavior.EventArgs); requestB.Raise(); Assert.NotNull(behavior.Sender); Assert.Equal(requestB, behavior.Sender); Assert.NotNull(behavior.EventArgs); Assert.Equal(EventArgs.Empty, behavior.EventArgs); }
//削除 private void ExecuteDel() { ConfirmationRequest.Raise( new Confirmation() { Title = "確認", Content = "削除しますか?" }, r => { if (r.Confirmed) { if (SQL.DeleteQuestion(Id)) { NotificationRequest.Raise(new Notification { Content = "削除しました", Title = "成功" }); _regionManager.Regions["ContentRegion1"].RemoveAll(); _regionManager.RequestNavigate("ContentRegion1", "EditMenuView"); _regionManager.Regions["ContentRegion2"].RemoveAll(); _regionManager.RequestNavigate("ContentRegion2", "EditFormView"); } else { NotificationRequest.Raise(new Notification { Content = "削除に失敗しました", Title = "失敗" }); } } } ); }
private void OnPrintExpense() { if (TravelExpense.Id == 0) { NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = "Die Reisekosten müssen vor dem Druck erst gespeichert werden" }); return; } NotificationRequest.Raise(new Notification() { Title = "QuantCo Deutschland GmbH", Content = "Nicht gespeicherte Änderungen werden nicht ausgedruckt" }); List <int> idList = new List <int>(); idList.Add(TravelExpense.Id); TypeReportSource source = new TypeReportSource(); source.TypeName = typeof(AccountingHelper.Reporting.TravelExpenses).AssemblyQualifiedName; source.Parameters.Add("TravelExpenseIds", idList); ViewerParameter parameter = new ViewerParameter() { typeReportSource = source }; eventAggregator.GetEvent <ViewerParameterEvent>().Publish(parameter); }
private void Delete() { ConfirmationRequest.Raise(new Confirmation { Content = "删除供应商" + CurrentSupplier.Number + "?", Title = "确认" }, r => { if (r.Confirmed) { using (var context = new MasterDataContext()) { context.Suppliers.Remove(CurrentSupplier); context.SaveChanges(); } IsEdit = false; NotificationRequest.Raise(new Notification { Content = "已删除", Title = "提示" }); CurrentSupplier = new Supplier { InternalType = "Supplier", Contacts = new ObservableCollection <Contact>(), }; Title = "供应商新增"; } }); }
/// <summary> /// This routine calculates capital calls, distribution and other performance numbers and adds information to Commitments /// </summary> private void AddPeResults() { PeFundResults results; InvestorCashFlowComparer cashFlowComparer = new InvestorCashFlowComparer(); foreach (InvestorCommitment commitment in Commitments) { InvestorCashFlowComparer comparer = new InvestorCashFlowComparer(); commitment.InvestorCashFlows.Sort(comparer); try { results = new PeFundResults(commitment, null, null); commitment.Dpi = results.Dpi; commitment.Irr = results.Irr; commitment.OpenCommitment = results.OpenCommitment; commitment.TotalCapitalCalls = results.AmountCalled; commitment.TotalDistributions = results.AmountDistributed; commitment.Tvpi = results.Tvpi; commitment.LastNav = results.ValuationFundCurrency; } catch (Exception ex) { Notification notification = new Notification { Title = ApplicationNames.NotificationTitle, Content = ex.Message }; NotificationRequest.Raise(notification); } } }
private void OnRowEditEnded() { if (Pcaps.CurrentItem == null) { return; } ExtendedPcap epcap = Pcaps.CurrentItem as ExtendedPcap; InvestorPcap pcap = InvestorCommitment.InvestorPcaps.FirstOrDefault(p => p.AsOfDate == epcap.AsOfDate); if (pcap == null) { return; } pcap.FinalPcapAmount = epcap.NavAmount; try { investorAccess.InsertOrUpdateInvestorPcap(pcap); } catch (Exception ex) { NotificationRequest.Raise(new Notification() { Title = ApplicationNames.NotificationTitle, Content = ex.Message }); } }
private void OnDeleteCashFlowConfirmation(IConfirmation obj) { if (obj.Confirmed) { try { int number = investorAccess.DeleteInvestorCashFlows(InvestorCashFlows); NotificationRequest.Raise(new Notification() { Title = ApplicationNames.NotificationTitle, Content = $"Es wurden {number.ToString()} Cashflows gelöscht!" }); // remove CurrentItem from List UniqueCashFlowNumber item = UniqueCashFlows.CurrentItem as UniqueCashFlowNumber; uniqueNumbers.Remove(item); } catch (Exception ex) { NotificationRequest.Raise(new Notification() { Title = ApplicationNames.NotificationTitle, Content = $"Beim Löschen von Cashflows trat ein Fehler auf: {ex.Message}" }); } } }
private void RaiseErrorNotification(string errorMsg, string titleMsg = "Error") { NotificationRequest.Raise( new Notification { Content = errorMsg, Title = titleMsg } ); }
private void RaiseNotification(NotificationMessage obj) { NotificationRequest.Raise( new Notification { Content = obj.Message, Title = obj.Title }, c => { }); }
private void OnCreateCommitmentReport() { NotificationRequest.Raise(new Notification { Title = "Report ", Content = $"Report Commitments" }); }
private void RaiseNotification() { NotificationRequest.Raise( new Notification { Content = ExceededNumberRequests, Title = WarningError }, n => { InteractionResultMessage = UserNotified; }); }
private void OnEditInvestorCommitmentResponse(EditInvestorCommitmentResponse response) { switch (response.ActionType) { case "OK": { if (response.editedCommitment.Id == 0) { Commitments.Add(response.editedCommitment); try { investorAccess.UpdateInvestorCommitments(response.editedCommitment); } catch (Exception ex) { NotificationRequest.Raise(new Notification { Title = "Commitment ", Content = $"Fehler beim Update der Datenbank: {ex.Message}" }); return; } } else { try { investorAccess.UpdateInvestorCommitments(SelectedCommitment); } catch (Exception ex) { NotificationRequest.Raise(new Notification { Title = "Commitment ", Content = $"Fehler beim Update der Datenbank: {ex.Message}" }); return; } } string message = $"Commitment für {SelectedCommitment.PeFund.FundShortName} wurde eingefügt bzw. geändert"; eventAggregator.GetEvent <StatusBarEvent>().Publish(message); break; } case "Cancel": { NotificationRequest.Raise(new Notification { Title = "Commitment ", Content = $"Edit Response was Cancel" }); string message = $"Änderungen wurden nicht gespeichert."; eventAggregator.GetEvent <StatusBarEvent>().Publish(message); break; } } EditCommitmentWindowState = WindowState.Closed; }
private void Delete() { var supplier = SuppliersView.CurrentItem as Supplier; ConfirmationRequest.Raise( new Confirmation { Content = "删除供应商" + supplier.Name + "?", Title = "确认", }, r => { if (r.Confirmed) { using (var context = new MasterDataContext()) { var existingSupplier = context.Suppliers.Where(s => s.Id == supplier.Id) .Include(s => s.Contacts).FirstOrDefault(); if (existingSupplier == null) { NotificationRequest.Raise( new Notification { Content = "供应商" + supplier.Name + "不存在。\n可能已删除,请重新查询。", Title = "提示" } ); return; } context.Remove(existingSupplier); context.SaveChanges(); } NotificationRequest.Raise( new Notification { Content = "已删除。", Title = "提示" } ); Suppliers.Remove(supplier); SuppliersView.Refresh(); TotalRecords -= 1; TotalPages = (int)Math.Ceiling(1.0 * TotalRecords / PageSize); if (TotalPages == 0) { PageIndex = 0; } else if (PageIndex > TotalPages) { PageIndex = TotalPages; SuppliersView = CollectionViewSource.GetDefaultView(Suppliers.Skip((PageIndex - 1) * PageSize).Take(PageSize)); } } } ); }
void RaiseNotification() { NotificationRequest.Raise( new Notification { Title = "Notification", Content = "Notification Message " }, r => Status = "Notified"); }
private void ShowNotification() { NotificationRequest.Raise(new Notification() { Title = "Notification", Content = "This is an example of notificaiton" }, r => { Status = "Notification raised"; }); }