void EmployeesCV_CurrentChanged(object sender, EventArgs e) { BasicEmployeeVM current = EmployeesCV.CurrentItem as BasicEmployeeVM; if (current != null && current.ObjectState != ObjectState.Added) { current.ObjectState = ObjectState.Modified; } }
private void Edit(bool?obj) { BasicEmployeeVM current = EmployeesCV.CurrentItem as BasicEmployeeVM; if (current != null) { var navigationParameters = new NavigationParameters(); navigationParameters.Add("Id", current.Id); RegionManager.RequestNavigate(RegionNames.WorkingArea, new Uri("EmployeeView" + navigationParameters.ToString(), UriKind.Relative)); } }
public EmployeeVM( IRibbonService ribbonService, IEmployeeService employeeService ) { this.ribbonService = ribbonService; this.saveCommand = new DelegateCommand <bool?>(this.Save, this.CanSave); employee = new BasicEmployeeVM(); Mapper.CreateMap <WorkCode, BasicWorkCodeVM>(); this.employeeService = employeeService; }
public EmployeeVM( IRibbonService ribbonService, IEmployeeService employeeService ) { this.ribbonService = ribbonService; this.saveCommand = new DelegateCommand<bool?>(this.Save, this.CanSave); employee = new BasicEmployeeVM(); Mapper.CreateMap<WorkCode, BasicWorkCodeVM>(); this.employeeService = employeeService; }
public void OnNavigatedTo(NavigationContext navigationContext) { menu = new RTIEmployeeView(); menu.SaveButton.Command = saveCommand; ribbonService.AddRibbonItem(menu, true); Mapper.CreateMap <Employee, BasicEmployeeVM>(); if (navigationContext.Parameters["Id"] == null) { IsNew = true; employee = new BasicEmployeeVM(); } else { int id = 0; int.TryParse(navigationContext.Parameters["Id"].ToString(), out id); IsNew = false; employee = Mapper.Map <Employee, BasicEmployeeVM>(employeeService.GetFiltered(a => a.Id == id).FirstOrDefault()); } }
private void Delete(bool?obj) { BasicEmployeeVM current = EmployeesCV.CurrentItem as BasicEmployeeVM; if (current != null) { try { employeeService.Remove(current.Id); employeeService.Save(); employees.Remove(current); } catch { this.ViewRequest.Raise( new Notification { Title = "Error" }); } } }
public void OnNavigatedTo(NavigationContext navigationContext) { menu = new RTIEmployeeView(); menu.SaveButton.Command = saveCommand; ribbonService.AddRibbonItem(menu, true); Mapper.CreateMap<Employee, BasicEmployeeVM>(); if (navigationContext.Parameters["Id"] ==null) { IsNew = true; employee = new BasicEmployeeVM(); } else { int id =0; int.TryParse(navigationContext.Parameters["Id"].ToString(),out id); IsNew = false; employee =Mapper.Map<Employee,BasicEmployeeVM>(employeeService.GetFiltered(a => a.Id == id).FirstOrDefault()); } }