static void Main(string[] args) { AccessPoint accessPoint = null; do { int employeeId = Request.Int("Hvad er dit medarbejder ID?"); try { accessPoint = new AccessPoint(employeeId); } catch (EntryPointNotFoundException) { Console.WriteLine("Kunne ikke finde data for medarbejder ID " + employeeId); Console.ReadKey(); } catch (SqlException e) { Console.WriteLine("Noget gik galt mellem serveren & programmet: " + e); Console.ReadKey(); } } while (accessPoint is null); Department department = accessPoint.Department; SmartMenu smartMenu = new SmartMenu("Afdeling " + department.Id, "Luk programmet"); smartMenu.Attach(new ShowAllCompensations(accessPoint)); smartMenu.Attach(new CreateDriving(accessPoint)); smartMenu.Attach(new CreateTravel(accessPoint)); smartMenu.Activate(); }
static void Main(string[] args) { SmartMenu sm = new SmartMenu("Ex42", "Close program"); sm.Attach(new InsertPet()); sm.Attach(new ShowAllPets()); sm.Attach(new AddAPetOWner()); sm.Attach(new FindOwnerByLastName()); sm.Attach(new FindOwnerByEmail()); sm.Activate(); }
public bool Activate(SmartMenu smartMenu) { string title = Request.String("Kørsels godtgørelse titel"); string numberPlate = Request.String("Nummerplade"); Driving drivingCompensation = new Driving(title, accessPoint.Employee, numberPlate); SmartMenu sm = new SmartMenu(drivingCompensation.Title, "Anullér"); sm.Attach(new AddTrip(drivingCompensation)); sm.Attach(new AddCompensationToDepartment(accessPoint.Department, drivingCompensation)); sm.Activate(); return(false); }
public bool Activate(SmartMenu smartMenu) { string description = string.Format( "{0}\n{1}\n{2}\n{3}\n{4}", Expenditure.Title, Expenditure.ExpenseType, Expenditure.Cash, Expenditure.Date, Expenditure.Amount ); SmartMenu sm = new SmartMenu(Expenditure.Title, "Tilbage", description); sm.Attach(new RemoveExpense(Compensation, Expenditure)); int countExpenses = Compensation.CountAppendices(); sm.Activate(); if (countExpenses > Compensation.CountAppendices()) { smartMenu.Detach(this); } return(false); }
public bool Activate(SmartMenu smartMenu) { string description = string.Format( "{0}\n{1}\n{2}\n{3}\n{4}\n{5}", trip.Title, trip.DepartureDestination, trip.DepartureDate, trip.ArrivalDestination, trip.ArrivalDate, trip.Distance ); SmartMenu sm = new SmartMenu(trip.Title, "Tilbage", description); sm.Attach(new RemoveExpense(Compensation, trip)); int countExpenses = Compensation.CountAppendices(); sm.Activate(); if (countExpenses > Compensation.CountAppendices()) { smartMenu.Detach(this); } return(false); }
public bool Activate(SmartMenu smartMenu) { string title = Request.String("Rejse godtgørelsens titel:"); DateTime departureDate = Request.DateTime("Hvornår tog du afsted?"); DateTime returnDate = Request.DateTime("Hvorn år kom du hjem?"); bool overNightStay = Request.Bool("Overnattede du under rejsen?"); double credit = Request.Double("Hvor meget i kontant havde du med?"); Travel travel = new Travel(title, AccessPoint.Instance.Employee, departureDate, returnDate, overNightStay, credit); SmartMenu sm = new SmartMenu(travel.Title, "Anullér"); sm.Attach(new AddExpenditure(travel)); sm.Attach(new AddCompensationToDepartment(AccessPoint.Instance.Department, travel)); sm.Activate(); return(false); }
public bool Activate(SmartMenu smartMenu) { SmartMenu sm = new SmartMenu(ToString(), "Tilbage"); foreach (Appendix expense in compensation.GetAppendices()) { sm.Attach(new ShowExpense(expense)); } sm.Activate(); return(false); }
public bool Activate(SmartMenu smartMenu) { List <Compensation> compensations = AccessPoint.Instance.GetAllCompensations(); SmartMenu sm = new SmartMenu("Alle godtgørelser", "Tilbage"); foreach (Compensation compensation in compensations) { sm.Attach(new ShowCompensation(compensation)); } sm.Activate(); return(false); }
public bool Activate(SmartMenu smartMenu) { string title = Request.String("Titel på udgiften"); DateTime date = Request.DateTime("Tidspunkt"); double amount = Request.Double(string.Format("Sum af udgiften {0}", title)); Expenditure.Type type = Request.Enum <Expenditure.Type>("Type"); bool cash = Request.Bool("Betalte du med kontant?"); Expenditure expenditure = new Expenditure(title, date, amount, type, cash, Travel); Travel.AddAppendix(expenditure); smartMenu.Attach(new EditExpenditure(Travel, expenditure)); return(false); }
public bool Activate(SmartMenu smartMenu) { string title = Request.String("Titel på bekostningen"); string departureDestination = Request.String("Hvor kørte du fra?"); DateTime departureDate = Request.DateTime(string.Format("Hvornår kørte du fra {0}?", departureDestination)); string arrivalDestination = Request.String("Hvor kørte du til?"); DateTime arrivalDate = Request.DateTime(string.Format("Hvornår kom du til {0}?", arrivalDestination)); int distance = Request.Int("Hvor mange kilometer (i hele tal)?"); Trip drivingExpense = new Trip(title, departureDestination, departureDate, arrivalDestination, arrivalDate, distance, DrivingCompensation); DrivingCompensation.AddAppendix(drivingExpense); smartMenu.Attach(new EditTrip(DrivingCompensation, drivingExpense)); return(false); }