private void ListOfBranches_CurrentChanged(object sender, EventArgs e) { if (ListOfBranches.CurrentItem != null) { selectedItem = ListOfBranches.CurrentItem as QuantCoBranch; } }
private void OnAddedNewRow(object obj) { GridViewAddingNewEventArgs e = obj as GridViewAddingNewEventArgs; if (e == null) { return; } QuantCoBranch branch = new QuantCoBranch(); branch.GermanPayroll = true; e.NewObject = branch; }
public override void OnNavigatedTo(NavigationContext navigationContext) { quantCoBranches = new ObservableCollection <QuantCoBranch>(dataAccess.GetAllQuantCoBranches()); if (quantCoBranches.Count == 0) { quantCoBranches.Add(new QuantCoBranch()); } ListOfBranches = CollectionViewSource.GetDefaultView(quantCoBranches); ListOfBranches.CurrentChanged -= ListOfBranches_CurrentChanged; ListOfBranches.CurrentChanged += ListOfBranches_CurrentChanged; selectedItem = ListOfBranches.CurrentItem as QuantCoBranch; RaisePropertyChanged("ListOfBranches"); }
private void OnRowEditEnded() { if (selectedItem.Id == 0) { QuantCoBranch e = dataAccess.InsertQuantCoBranch(selectedItem); if (e == null) { // Fehler } else { selectedItem.Id = e.Id; return; } } else { QuantCoBranch e = dataAccess.UpdateQuantCoBranch(selectedItem); if (e == null) { // Fehler } } }
private EmployeeSalaryOverview GetEmployeeSalaryOverview(int id) { EmployeesForTravelExpenses employee = dbAccess.FindEmployeeById(id); List <EmployeePaymentDetail> details = dbAccess.GetAllPaymentDetails(id); QuantCoBranch branch = dbAccess.GetBranchById(employee.QuantCoBranchId); EmployeeSalaryOverview overview = new EmployeeSalaryOverview(); if (details.Count == 0) { return(overview); } overview.EmployeeForTravelExpensesId = id; overview.EmployeeName = employee.FullName; if (branch != null) { overview.OfficeLocation = branch.LocationName; overview.GermanPayroll = branch.GermanPayroll; } overview.CalenderYear = periodfrom.Year.ToString(); foreach (EmployeePaymentDetail detail in details) { if (detail.PaymentType == PaymentType.Bonus && detail.LastPayment == null) { detail.LastPayment = detail.FirstPayment; } else if (detail.LastPayment == null) { detail.LastPayment = periodto; //set LastPayment } if (detail.LastPayment < periodfrom) { continue; // payment was before reporting period } if (detail.FirstPayment > periodto) { continue; // payment is after reporting period } DateTime periodStart = periodfrom; if (detail.PaymentType == PaymentType.Bonus) { AddBonusPayment(overview, detail.FirstPayment, detail.MonthlyAmount); } else if (detail.PaymentType == PaymentType.Salary) { AddSalary(overview, detail.FirstPayment, detail.LastPayment, detail.MonthlyAmount); } else if (detail.PaymentType == PaymentType.CurrentSalary) { AddSalary(overview, detail.FirstPayment, detail.LastPayment, detail.MonthlyAmount); } else { } } return(overview); }