private void Save(object ignored) { SendState = SavingStateKey; var data = this.ReasonData; try { var reason = ReasonServices.GetReason(data.ID); if (reason != null) { reason.ReasonDesc = ReasonDescAlias; reason.ModifiedOn = DateTime.Now; reason.ModifiedBy = AuthenticatedUser; } else { reason = new Reason(); reason.ReasonDesc = ReasonDescAlias; reason.CreatedOn = DateTime.Now; reason.CreatedBy = AuthenticatedUser; reason.ModifiedOn = DateTime.Now; reason.ModifiedBy = AuthenticatedUser; } if (ReasonServices.Save(reason)) { this.SendState = SavedStateKey; if (this.navigationJournal != null) { this.navigationJournal.GoBack(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Notification", MessageBoxButton.OK); this.SendState = NormalStateKey; } }
public void OnNavigatedTo(NavigationContext navigationContext) { AuthenticatedUser = (!string.IsNullOrEmpty((string)navigationContext.Parameters["AuthenticatedUser"]) ? (string)navigationContext.Parameters["AuthenticatedUser"] : string.Empty); var id = GetRequestedReasonID(navigationContext); if (id.HasValue) { this.Reason = ReasonServices.GetReason(id.Value); } this.navigationJournal = navigationContext.NavigationService.Journal; }
private List <Reason> Update(List <ReasonExt> toUpdateList) { List <Reason> updateObj = new List <Reason>(); foreach (var u in toUpdateList) { var reason = ReasonServices.GetReason(u.ID); if (reason != null && reason.ReasonDesc != u.ReasonDesc) { reason.ReasonDesc = u.ReasonDesc; reason.ModifiedOn = DateTime.Now; reason.ModifiedBy = AuthenticatedUser; } updateObj.Add(reason); } return(updateObj); }