Пример #1
0
        void EmployeesCV_CurrentChanged(object sender, EventArgs e)
        {
            BasicEmployeeVM current = EmployeesCV.CurrentItem as BasicEmployeeVM;

            if (current != null && current.ObjectState != ObjectState.Added)
            {
                current.ObjectState = ObjectState.Modified;
            }
        }
Пример #2
0
        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));
            }
        }
Пример #3
0
        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;
        }
Пример #4
0
        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;

        }
Пример #5
0
        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());
            }
        }
Пример #6
0
        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"
                    });
                }
            }
        }
Пример #7
0
 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());
     }
 }