protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.Parameter != null) { location = (e.Parameter as PayrollCore.Entities.Location); return; } }
private async Task <bool> SaveLocation() { bool IsSuccess; loadGrid.Visibility = Visibility.Visible; if (location == null) { location = new PayrollCore.Entities.Location(); location.isNewLocation = true; specialTask = new Shift() { shiftName = "Special Task", isDisabled = true }; shiftless = new Shift() { shiftName = "Normal sign in", isDisabled = true }; } location.locationName = locationName.Text; location.enableGM = enableMeetingSwitch.IsOn; specialTask.DefaultRate = defaultSpecialTaskRateBox.SelectedItem as Rate; shiftless.DefaultRate = defaultRateBox.SelectedItem as Rate; location.Shiftless = enableShiftlessMode.IsOn; if (location.isNewLocation == true) { int locationID = await SettingsHelper.Instance.op2.AddNewLocation(location); specialTask.locationID = locationID; shiftless.locationID = locationID; location.locationID = locationID; IsSuccess = await SettingsHelper.Instance.op2.AddNewShift(specialTask); IsSuccess = await SettingsHelper.Instance.op2.AddNewShift(shiftless); } else { IsSuccess = await SettingsHelper.Instance.op2.UpdateLocation(location); if (IsSuccess) { IsSuccess = await SettingsHelper.Instance.op2.UpdateShift(specialTask); IsSuccess = await SettingsHelper.Instance.op2.UpdateShift(shiftless); } } return(IsSuccess); }