public WorkHourVM( IRibbonService ribbonService, IWorkCodeService workCodeService, IEmployeeService employeeService, IWorkHourService workHourService ) { this.ribbonService = ribbonService; this.saveCommand = new DelegateCommand <bool?>(this.Save, this.CanSave); this.deleteCommand = new DelegateCommand <bool?>(this.Delete, this.CanDelete); this.workCodeService = workCodeService; this.workHourService = workHourService; WorkCodes = new ObservableCollection <BasicWorkCodeVM>(); employees = new ObservableCollection <BasicEmployeeVM>(); workHours = new ObservableCollection <BasicWorkHourVM>(); DeletedWorkHours = new List <BasicWorkHourVM>(); Mapper.CreateMap <Employee, BasicEmployeeVM>(); Mapper.CreateMap <BasicEmployeeVM, Employee>(); Mapper.CreateMap <ICollection <Employee>, ICollection <BasicEmployeeVM> >(); Mapper.CreateMap <ICollection <BasicEmployeeVM>, ICollection <Employee> >(); Mapper.CreateMap <WorkCode, BasicWorkCodeVM>(); Mapper.CreateMap <ICollection <WorkCode>, ICollection <BasicWorkCodeVM> >(); Mapper.CreateMap <BasicWorkCodeVM, WorkCode>(); Mapper.CreateMap <ICollection <BasicWorkCodeVM>, ICollection <WorkCode> >(); Mapper.CreateMap <WorkHour, BasicWorkHourVM>(); Mapper.CreateMap <BasicWorkHourVM, WorkHour>(); Mapper.CreateMap <ICollection <WorkHour>, ICollection <BasicWorkHourVM> >(); Mapper.CreateMap <ICollection <BasicWorkHourVM>, ICollection <WorkHour> >(); foreach (Employee data in employeeService.GetAll()) { employees.Add(Mapper.Map <Employee, BasicEmployeeVM>(data)); } foreach (WorkCode data in workCodeService.GetAll()) { WorkCodes.Add(Mapper.Map <WorkCode, BasicWorkCodeVM>(data)); } foreach (WorkHour data in workHourService.GetAll()) { data.ObjectState = ObjectState.Unchanged; workHours.Add(Mapper.Map <WorkHour, BasicWorkHourVM>(data)); } WorkHoursCV = new ListCollectionView(WorkHours); WorkHoursCV.CurrentChanged += WorkHoursCV_CurrentChanged; }
public WorkCodeVM( IRibbonService ribbonService, IWorkCodeService workCodeService ) { EntityType = typeof(BasicWorkCodeVM); this.ribbonService = ribbonService; this.saveCommand = new DelegateCommand <bool?>(this.Save, this.CanSave); this.deleteCommand = new DelegateCommand <bool?>(this.Delete, this.CanDelete); this.workCodeService = workCodeService; WorkCodes = new ObservableCollection <BasicWorkCodeVM>(); DeletedWorkCodes = new List <BasicWorkCodeVM>(); Mapper.CreateMap <WorkCode, BasicWorkCodeVM>(); foreach (WorkCode data in workCodeService.GetAll()) { data.ObjectState = ObjectState.Unchanged; WorkCodes.Add(Mapper.Map <WorkCode, BasicWorkCodeVM>(data)); } WorkCodesCV = new ListCollectionView(WorkCodes); WorkCodesCV.CurrentChanged += WorkCodesCV_CurrentChanged; }
public WorkCodeVM( IRibbonService ribbonService, IWorkCodeService workCodeService ) { EntityType =typeof(BasicWorkCodeVM); this.ribbonService = ribbonService; this.saveCommand = new DelegateCommand<bool?>(this.Save, this.CanSave); this.deleteCommand = new DelegateCommand<bool?>(this.Delete, this.CanDelete); this.workCodeService=workCodeService; WorkCodes = new ObservableCollection<BasicWorkCodeVM>(); DeletedWorkCodes = new List<BasicWorkCodeVM>(); Mapper.CreateMap<WorkCode, BasicWorkCodeVM>(); foreach (WorkCode data in workCodeService.GetAll()) { data.ObjectState = ObjectState.Unchanged; WorkCodes.Add(Mapper.Map<WorkCode, BasicWorkCodeVM>(data)); } WorkCodesCV = new ListCollectionView(WorkCodes); WorkCodesCV.CurrentChanged += WorkCodesCV_CurrentChanged; }
public WorkHourVM( IRibbonService ribbonService, IWorkCodeService workCodeService, IEmployeeService employeeService, IWorkHourService workHourService ) { this.ribbonService = ribbonService; this.saveCommand = new DelegateCommand<bool?>(this.Save, this.CanSave); this.deleteCommand = new DelegateCommand<bool?>(this.Delete, this.CanDelete); this.workCodeService=workCodeService; this.workHourService = workHourService; WorkCodes = new ObservableCollection<BasicWorkCodeVM>(); employees = new ObservableCollection<BasicEmployeeVM>(); workHours = new ObservableCollection<BasicWorkHourVM>(); DeletedWorkHours = new List<BasicWorkHourVM>(); Mapper.CreateMap<Employee, BasicEmployeeVM>(); Mapper.CreateMap<BasicEmployeeVM, Employee>(); Mapper.CreateMap<ICollection<Employee>, ICollection<BasicEmployeeVM>>(); Mapper.CreateMap<ICollection<BasicEmployeeVM>, ICollection<Employee>>(); Mapper.CreateMap<WorkCode, BasicWorkCodeVM>(); Mapper.CreateMap<ICollection<WorkCode>, ICollection<BasicWorkCodeVM>>(); Mapper.CreateMap<BasicWorkCodeVM, WorkCode>(); Mapper.CreateMap<ICollection<BasicWorkCodeVM>, ICollection<WorkCode>>(); Mapper.CreateMap<WorkHour, BasicWorkHourVM>(); Mapper.CreateMap<BasicWorkHourVM, WorkHour>(); Mapper.CreateMap<ICollection<WorkHour>, ICollection<BasicWorkHourVM>>(); Mapper.CreateMap<ICollection<BasicWorkHourVM>, ICollection<WorkHour>>(); foreach (Employee data in employeeService.GetAll()) { employees.Add(Mapper.Map<Employee, BasicEmployeeVM>(data)); } foreach (WorkCode data in workCodeService.GetAll()) { WorkCodes.Add(Mapper.Map<WorkCode, BasicWorkCodeVM>(data)); } foreach (WorkHour data in workHourService.GetAll()) { data.ObjectState = ObjectState.Unchanged; workHours.Add(Mapper.Map<WorkHour, BasicWorkHourVM>(data)); } WorkHoursCV = new ListCollectionView(WorkHours); WorkHoursCV.CurrentChanged += WorkHoursCV_CurrentChanged; }