public void GetAllOveralObjectiveList(Action<List<SummeryOveralObjective>, Exception> action, SummeryOveralObjective selectedOveralObjectiveList) { if (overalObjectiveList.Count == 0) { var summeryOveralObjective = overalObjectiveList.Select(t => new SummeryOveralObjective { PeriorityTypeTitle = periorityTypeList.Single(c => c.Id == t.PeriorityTypeId).Title, Id = t.Id, Description = t.Description, Title = t.Title }).ToList(); action(summeryOveralObjective, null); } else { var minid = overalObjectiveList.Min(c => c.Id); var sel = overalObjectiveList.Single(c => c.Id == minid); selectedOveralObjectiveList.Id = sel.Id; selectedOveralObjectiveList.Title = sel.Title; selectedOveralObjectiveList.PeriorityTypeTitle = periorityTypeList.Single(c => c.Id == sel.PeriorityTypeId).Title; selectedOveralObjectiveList.Description = sel.Description; var summeryOveralObjective = overalObjectiveList.Select(t => new SummeryOveralObjective { PeriorityTypeTitle = periorityTypeList.Single(c => c.Id == t.PeriorityTypeId).Title, Id = t.Id, Description = t.Description, Title = t.Title }).ToList(); action(summeryOveralObjective, null); } }
private void init() { DisplayName = "اهداف کلی"; PeriorityTypeList=new ObservableCollection<PeriorityType>(); SelectedPeriorityType=new PeriorityType(); SelectedOveralObjective=new CrudOveralObjective(); SelectedOveralObjectiveList=new SummeryOveralObjective(); }
private void modify() { if (SelectedOveralObjectiveList.Id == 0) { controller.ShowOveralObjectiveListView(); MessageBox.Show("سطری برای ویرایش وجود ندارد"); } else { //controller.ShowOveralObjectiveView(SelectedOveralObjectiveList); overalObjectiveService.UpdateSelectedOveralObjective( (res, exp) => { HideBusyIndicator(); if (exp==null) { SelectedOveralObjectiveList=new SummeryOveralObjective(); } else controller.HandleException(exp); },SelectedOveralObjectiveList,SelectedPeriorityType); } }
private void delete() { overalObjectiveService.RemoveOveralObjective( (res, exp) => { HideBusyIndicator(); if (exp == null) { SelectedOveralObjectiveList = new SummeryOveralObjective(); } }, SelectedOveralObjectiveList); controller.ShowOveralObjectiveListView(); }
public void Load(SummeryOveralObjective item) { overalObjectiveService.GetOveralObjective( (res, exp) => { HideBusyIndicator(); if (exp == null) { SelectedOveralObjective = res; } },item.Id); overalObjectiveService.PeriorityTypeList((res, exp) => { HideBusyIndicator(); if (exp == null) { PeriorityTypeList = new ObservableCollection<PeriorityType>(res); } else { controller.HandleException(exp); } }, SelectedPeriorityType); }
public void UpdateSelectedOveralObjective(Action<SummeryOveralObjective, Exception> action, SummeryOveralObjective selectedOveralObjectiveList, PeriorityType selectedPeriorityType) { var task = overalObjectiveList.Single(c => c.Id == selectedOveralObjectiveList.Id); task.Title = selectedOveralObjectiveList.Title; task.Description = selectedOveralObjectiveList.Description; }
public void RemoveOveralObjective(Action<SummeryOveralObjective, Exception> action, SummeryOveralObjective selectedOveralObjectiveList) { if (overalObjectiveList.Count == 0) { MessageBox.Show("سطری برای حذف کردن وجود ندارد"); } else { MessageBox.Show("حذف اطلاعات کاربر " + Environment.NewLine + "((" + selectedOveralObjectiveList.Title + "))" + Environment.NewLine + "با موفقیت انجام شود"); // //MessageBox.Show("حذف اطلاعات کاربر " + Environment.NewLine + "((" + selectedTaskItem.Title + "))" + // // Environment.NewLine + "با موفقیت انجام شود", "حذف یادداشت//قرار ملاقات", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.None, MessageBoxOptions.RightAlign); overalObjectiveList.Remove(overalObjectiveList.Single(c => c.Id == selectedOveralObjectiveList.Id)); } }