public void Save(string fileName, string text) { var WPFStaffs = _fileHandler.WPFStaffs; Sequence sequence = new StaffHandler().GetSequenceFromWPFStaffs(WPFStaffs); sequence.Save(fileName); }
private static void PrintStaffHandlerMenu() { Console.Clear(); Console.WriteLine("\t *** Staff *** \n"); StaffHandler.ListAll(); // List all the staff every time string staffMenu = "\nEnter your choice:\n" + "\t0 - Exit \n" + "\t1 - List all\n" + "\t2 - Add\n" + "\t3 - Delete\n" + "\t4 - Edit"; Console.WriteLine(staffMenu); }
public ActionResult AddNewStaff(int id = 0) { if (id > 0) { var data = db.Users.Where(m => m.id == id).FirstOrDefault(); StaffHandler.Update(data.id, data); TempData["deactive"] = "User Succesfully DeActivated"; return(RedirectToAction("StaffList")); } else { int cid = Convert.ToInt32(Session["BranchCompanyid"]); ViewBag.Dept = DropDownHandler.Dept(cid); ViewBag.Designation = DropDownHandler.Designation(cid); return(View()); } }
private static Staff Login(List <Staff> availableStaff) { bool loggedIn = false; Staff staffToLogin = null; Console.Clear(); Console.WriteLine("** Login ** "); availableStaff.ForEach(s => Console.WriteLine(StaffHandler.PrintInfo(s))); while (!loggedIn) { try { Console.WriteLine("Select which Id to log in as. Enter 0 to exit"); Console.Write("Id: "); string userInput = Console.ReadLine(); if (userInput == "0") { return(null); } else { int staffId = int.Parse(userInput); staffToLogin = availableStaff.Find(s => s.Id == staffId); if (staffToLogin != null) { loggedIn = true; } else { Console.WriteLine(String.Format("No staff with id {0} was found - try again.", staffId)); } } } catch (FormatException) { Console.WriteLine("Id must be a number. Try again."); } } return(staffToLogin); }
private static void PrintByStaffMember() { using (CashRegistryModel db = new CashRegistryModel()) { List <Staff> staff = db.Staff .Where(s => s.Transaction.Count > 0) // Only get the staff that has any transactions .ToList(); foreach (Staff s in staff) { Console.WriteLine("\n\n" + StaffHandler.PrintInfo(s)); foreach (Transaction t in s.Transaction.OrderByDescending(t => GetTotalSum(t))) // Order by transaction sum { Console.WriteLine(GetShortSummary(t)); } } } }
private static void OpenStaffHandlerMenu() { bool shouldBeOpen = true; while (shouldBeOpen) { Console.Clear(); PrintStaffHandlerMenu(); string userInput = Console.ReadLine(); if (userInput == "0") { shouldBeOpen = false; } else if (userInput == "1") { StaffHandler.ListAll(); ReturnToMenu(); } else if (userInput == "2") { StaffHandler.Create(); ReturnToMenu(); } else if (userInput == "3") { StaffHandler.Delete(); ReturnToMenu(); } else if (userInput == "4") { StaffHandler.Edit(); ReturnToMenu(); } else { PrintInvalidChoice(); } } }
public void LoadLilypond(string content) { WPFStaffs.Clear(); LilypondText = content.Length > 0 ? content : ""; var tokens = GetTokensFromLilypond(content); var staffCollection = new LilypondClient(tokens).Solve(); WPFStaffs.AddRange(staffCollection); WPFStaffsChanged?.Invoke(this, new WPFStaffsEventArgs() { Symbols = WPFStaffs, Message = "" }); MidiSequence = new StaffHandler().GetSequenceFromWPFStaffs(WPFStaffs); MidiSequenceChanged?.Invoke(this, new MidiSequenceEventArgs() { MidiSequence = MidiSequence }); }
public static void Sell() { bool shouldBeOpen = true; while (shouldBeOpen) { List <Staff> availableStaff = StaffHandler.GetAllStaff(); List <Product> allProducts = ProductHandler.GetAllProducts(); // We must have staff to be able to sell anything: if (availableStaff.Count == 0) { Console.WriteLine("There must be available staff to be able to sell - Please create those first."); Console.ReadKey(); break; // Break the while loop to return to menu } // We also need products to sell: if (allProducts.Count == 0) { Console.WriteLine("There must be products available to be able to sell - Please create those first."); Console.ReadKey(); break; // Break the while loop to return to menu } Staff clerk = Login(availableStaff); Console.Clear(); if (clerk == null) { break; // If we don't have a clerk we abort. } Console.WriteLine("Logged in as " + clerk.FirstName + " " + clerk.LastName); StartSalesMenu(clerk); } }
} // end of EventStaffChange #endregion //-------------------------------------------------------------------------------------------------- // State Change //-------------------------------------------------------------------------------------------------- #region Trigger /// <summary> /// Overrides the state change method, staffing levels will change, for leaving /// staff requests for absence are filed, incoming staff is added to the /// parent control unit /// </summary> /// <param name="time">Time the staffing changes</param> /// <param name="simEngine">SimEngine responsible for simulation execution</param> protected override void StateChange(DateTime time, ISimulationEngine simEngine) { // foreach leaving staff a request to be absent is filed at their control unit // arriving staff is automatically added to the control by the triggering // of the event foreach (ResourceAssignmentStaff staffAssignment in StaffLeaving) { ParentDepartmentControl.AddRequest(new RequestBeAbsent(staffAssignment.Resource, time)); staffAssignment.Resource.StaffOutsideShift = true; } // end foreach foreach (ResourceAssignmentStaff staffAssignment in StaffAriving) { staffAssignment.Resource.StaffOutsideShift = false; staffAssignment.Resource.BlockedForDispatching = false; staffAssignment.Resource.BaseControlUnit = ParentDepartmentControl; staffAssignment.Resource.AssignmentType = staffAssignment.AssignmentType; if (staffAssignment.OrganizationalUnit == "RootDepartment") { ParentDepartmentControl.AddEntity(staffAssignment.Resource); } else { ParentDepartmentControl.OrganizationalUnitPerName[staffAssignment.OrganizationalUnit].AddEntity(staffAssignment.Resource); } SequentialEvents.Add(staffAssignment.Resource.StartWaitingActivity(ParentDepartmentControl.WaitingRoomForStaff(staffAssignment.Resource))); } // end foreach DateTime nextTime; // schedule the next staff change Event nextChange = StaffHandler.GetNextStaffChangingEvent(ParentDepartmentControl, time, out nextTime); simEngine.AddScheduledEvent(nextChange, nextTime); } // end of Trigger