public static void ViewAllMethod(IManageStaff manager) { List <dynamic> Staffs = manager.GetAll(); for (int i = 0; i < Staffs.Count; i++) { PrintDetails(Staffs[i]); } }
public AccountViewModel(IManageStaff manageStaff, IEventAggregator eventAggregator) { _manageStaff = manageStaff; ChangeView = new DelegateCommand <object>(ChangeViewCommand); _eventAggregator = eventAggregator; this._eventAggregator.GetEvent <EventAggregationRaisEvent>().Subscribe(this.RaiseEventAggregationEvent, true); CurrentItem = new EntityBase(); CurrentItem.Title = "AccountView"; }
public static void DeleteMethod(IManageStaff manager) { Console.WriteLine("Enter Emp Code : "); int empCode = int.Parse(Console.ReadLine()); if (manager.Delete(empCode)) { Console.WriteLine("Successfully Deleted"); } else { Console.WriteLine("Failed"); } }
public static void ViewSpecificMethod(IManageStaff manager) { Console.WriteLine("Enter Emp Code : "); int empCode = int.Parse(Console.ReadLine()); try { dynamic staff = manager.GetOne(empCode); PrintDetails(staff); } catch (Exception) { Console.WriteLine("Staff with given code doesn't exists"); } }
public StaffDetailsViewModel(IManageStaff managerStaff, AllCommandProxy commandProxy) { _manageStaff = managerStaff; ChangeView = new DelegateCommand(LodeViewfromModule); LoadChild = new DelegateCommand(LoadChildCommand); ThumbnailPath = "WIN_20150804_135055.JPG"; StaffList = new ObservableCollection <Model.Models.Staff>(_manageStaff.GetStaffsTest()); _CommandProxy = commandProxy; _CommandProxy.FireCompositeCommand.RegisterCommand(LoadChild); IUnityContainer unityContainer = ServiceLocator.Current.GetInstance <IUnityContainer>(); var regionManager = unityContainer.Resolve <IRegionManager>(); Microsoft.Practices.Prism.Regions.IRegion rgn = regionManager.Regions["MainRegion"]; rgn.Context = Guid.NewGuid();; }
public static IManageStaff GetManager() { //get and build configuration file IConfiguration config = new ConfigurationBuilder() .AddJsonFile("appsettings.json", true, true) .Build(); //fetch managerClass string managerClassTypeString = config["managerClass"]; //get the type of the class Type managerClassType = Type.GetType("school." + managerClassTypeString + ",school", true); //build an instance of the class IManageStaff manager = Activator.CreateInstance(managerClassType) as IManageStaff; return(manager); }
public static void UpdateMethod(IManageStaff manager) { Console.WriteLine("Enter Emp Code : "); int empCode = int.Parse(Console.ReadLine()); try { dynamic staff = manager.GetOne(empCode); Console.WriteLine("Enter new name : "); string newName = Console.ReadLine(); Console.WriteLine("Enter new email : "); string newEmail = Console.ReadLine(); if (staff.Type == school.StaffType.teacher) { Console.WriteLine("Enter new subject : "); } else if (staff.Type == school.StaffType.support) { Console.WriteLine("Enter new deparment : "); } else if (staff.Type == school.StaffType.administrator) { Console.WriteLine("Enter new role : "); } string extra = Console.ReadLine(); if (manager.Update(empCode, newName, newEmail, extra)) { Console.WriteLine("Updated Successfully"); } else { Console.WriteLine("Failed"); } } catch (Exception) { Console.WriteLine("Staff with given code doesn't exists"); } }
public StaffViewModel(IManageStaff manageStaff, IEventAggregator eventAggregator, AllCommandProxy commandProxy) { regionManager = Microsoft.Practices.ServiceLocation.ServiceLocator.Current.GetInstance <Microsoft.Practices.Prism.Regions.IRegionManager>(); _manageStaff = manageStaff; SubmitCommand = new DelegateCommand <object>(OnSubmit); LoadWindow = new DelegateCommand(LoadWindowCommand); this.confirmExitInteractionRequest = new InteractionRequest <Confirmation>(); _eventAggregator = eventAggregator; LoadAccountCommand = new DelegateCommand <object>(LoadAccount); _CommandProxy = commandProxy; _CommandProxy.FireCompositeCommand.RegisterCommand(LoadWindow); StartProgress = new DelegateCommand(StartProgressComand); StudentCommand = new DelegateCommand(GetStudent); AsyncCommand = new DelegateCommand(AsyncCall); //add RoutedEventArgs remove TriggerParameterPath ButtonClickCommand = new DelegateCommand <RoutedEvent>(ClickCommand); ////var staffobj = RegionManager.Regions["MainRegion"].Context; ////int staffIdId = (int)RegionContext.GetObservableContext(StaffView).Value; ////RegionManager.Regions["MainRegion"].Context = regionManager.Regions["MainRegion"].Context; }
public static void AddStaffMethod(IManageStaff manager) { Console.Write("Name : "); string name = Console.ReadLine(); Console.Write("Email : "); string email = Console.ReadLine(); Console.Write("emp id : "); int id = int.Parse(Console.ReadLine()); Console.WriteLine(); Console.WriteLine("Staff Type : "); Console.WriteLine("1. Teacher"); Console.WriteLine("2. Administrator"); Console.WriteLine("3. Support"); int type = int.Parse(Console.ReadLine()); if (type == 1) { Console.WriteLine(); Console.Write("Enter Subject : "); string subject = Console.ReadLine(); manager.AddStaff(school.StaffType.teacher, name, email, id, subject); } else if (type == 2) { Console.WriteLine(); Console.Write("Enter Role : "); string role = Console.ReadLine(); manager.AddStaff(school.StaffType.administrator, name, email, id, role); } else if (type == 3) { Console.WriteLine(); Console.Write("Enter Department : "); string dept = Console.ReadLine(); manager.AddStaff(school.StaffType.support, name, email, id, dept); } }
public static void ShowConsoleMenu() { IManageStaff manager = GetManager(); while (true) { Console.WriteLine(); Console.WriteLine("1. Add New Staff"); Console.WriteLine("2. View All Staff Details"); Console.WriteLine("3. View Specific Staff Detail"); Console.WriteLine("4. Update Details"); Console.WriteLine("5. Delete Staff"); Console.WriteLine("6. Bulk Add Staff"); Console.WriteLine("7. exit"); Console.WriteLine(); int option = int.Parse(Console.ReadLine()); //add if (option == 1) { AddStaffMethod(manager); } //view all else if (option == 2) { ViewAllMethod(manager); } //view specific one else if (option == 3) { ViewSpecificMethod(manager); } //update else if (option == 4) { UpdateMethod(manager); } //delete else if (option == 5) { DeleteMethod(manager); } //bulk add else if (option == 6) { BulkAddStaffMethod(manager); } else { Environment.Exit(0); } Console.WriteLine(); Console.WriteLine("Go again ?"); Console.WriteLine("1. No"); Console.WriteLine("2. Yes"); option = int.Parse(Console.ReadLine()); if (option == 1) { Environment.Exit(0); } else { Console.Clear(); } } }
public LoginViewModel(IManageStaff managerStaff) { _managerStaff = managerStaff; LoginCommand = new DelegateCommand(SubmitLoginDetails); }
public AccountDetailViewModel(IManageStaff manageStaff) { _manageStaff = manageStaff; }