public Task <TaskResult> SavePPEExamBlank(PPEExamBlank content, ModifyType modify, int old_aud = -1) { Task <TaskResult> res = null; if (modify == ModifyType.Update) { res = ServiceRunTask(service => { service.UpdatePPEExamBlank(content, old_aud); return(null); }); } else if (modify == ModifyType.Insert) { res = ServiceRunTask(service => { content.ppe_exam_id = CurrentPPEExamContent.ppe_exam_id; return(service.InsertPPEExamBlank(content)); }); } else if (modify == ModifyType.Delete) { res = ServiceRunTask(service => { return(service.DeletePPEExamBlank(content)); }); } return(res); }
private async void RefreshPPEExamContent(RadGridView grid, int aud = -1) { IsBusy = true; try { PPEExamBlank grid_item = (PPEExamBlank)grid.SelectedItem; string col_name = grid.CurrentCellInfo != null && grid.CurrentCellInfo.Column != null ? grid.CurrentCellInfo.Column.UniqueName : ""; TaskResult res = await service.SetCurrentPPEExam(CurrentPPEExamContent.exam_date_id, CurrentPPEExamContent.ppe_id); if (res.fault != null) { service.CurrentJournalContent = null; AddError("error", res.fault.Message); } else { UpdatePPEExamContent(); PPEExamBlank prev_item = null; if (aud > 0) { prev_item = service.CurrentPPEExamBlanks.Where(x => x.aud == aud).SingleOrDefault(); } else if (grid_item != null && col_name != "") { prev_item = service.CurrentPPEExamBlanks.Where(x => x.aud == grid_item.aud).SingleOrDefault(); } else { prev_item = (PPEExamBlank)grid.CurrentItem; } grid.CurrentCellInfo = new GridViewCellInfo(prev_item, grid.Columns[col_name]); grid.Focus(); if (prev_item != null) { grid.SelectedItem = prev_item; grid.ScrollIntoView(prev_item); } } IsBusy = false; } catch (System.Exception e) { IsBusy = false; AddError("error", e.Message); } }