internal TimeSpan getTimeForLogIn(LogIn.ServiceReference1.Booking booking) { DateTime now = DateTime.Now; TimeSpan t = now.Subtract(booking.BookingEnd); return(t); }
internal ServiceReference1.Credentials getUserFBooking(LogIn.ServiceReference1.Booking booking, long libId) { if (booking != null) { if (!booking.ClientPass.Equals(string.Empty)) { LogIn.ServiceReference1.PrinchService1SoapClient soap = new LogIn.ServiceReference1.PrinchService1SoapClient(binding, endpointAddress); return(soap.getUserForBooking(booking.BookingID, libId)); } } return(null); }
private void checkAvailability() { booking = service.checkIfAvailable(libID, resourceID); if (booking == null) { AVAILABLE = true; } else { try { // if more than two hours returns 2 hours TIME_TO_NEXT_BOOKING = service.getTimeToBooking(booking); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("There has been a problem in calculating the time to the next booking"); } if (TIME_TO_NEXT_BOOKING.Minutes == -15) { System.Windows.Forms.MessageBox.Show("In 15 minutes a new booking will start "); } else if (TIME_TO_NEXT_BOOKING.Minutes == -30) { System.Windows.Forms.MessageBox.Show("In 30 minutes a new booking will start "); } else if (TIME_TO_NEXT_BOOKING.Minutes > -10)// preebooking prevented 10 min before start of other booking { btnStart.Visibility = Visibility.Hidden; knownUser = service.getUserFBooking(booking, libID); if (TIME_TO_NEXT_BOOKING.Minutes > -1) { timerPanel.Visibility = Visibility.Visible; timerToLogIn = new System.Windows.Forms.Timer(); timerToLogIn.Interval = 1000; timerToLogIn.Tick += new EventHandler(timerToLogIn_Tick); initiateTimer(); timerToLogIn.Start(); } AVAILABLE = false; } } }
//returns booking if time difference -15 minutes until start of other booking or time.now-time_booking_end=>0 internal LogIn.ServiceReference1.Booking checkIfAvailable(long libID, string resourceID) { try { DateTime now = DateTime.Now; LogIn.ServiceReference1.PrinchService1SoapClient soap = new LogIn.ServiceReference1.PrinchService1SoapClient(binding, endpointAddress); booking1 = soap.checkIfAvailable(libID, resourceID, now); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Check if available??" + ex); } return booking1; }
//returns booking if time difference -15 minutes until start of other booking or time.now-time_booking_end=>0 internal LogIn.ServiceReference1.Booking checkIfAvailable(long libID, string resourceID) { try { DateTime now = DateTime.Now; LogIn.ServiceReference1.PrinchService1SoapClient soap = new LogIn.ServiceReference1.PrinchService1SoapClient(binding, endpointAddress); booking1 = soap.checkIfAvailable(libID, resourceID, now); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("Check if available??" + ex); } return(booking1); }
internal Tuple <bool, TimeSpan> LogIn(LogIn.Model.User userAtComputer, ServiceReference1.Credentials knownUser, LogIn.ServiceReference1.Booking booking) { TimeSpan time = new TimeSpan(0, 0, 0); if (knownUser != null) { if (isSameUser(userAtComputer, knownUser)) { return(Tuple.Create <bool, TimeSpan>(true, getTimeForLogIn(booking))); } } return(Tuple.Create <bool, TimeSpan>(false, time)); }
private void checkAvailability() { booking = service.checkIfAvailable(libID, resourceID); if (booking == null) { AVAILABLE = true; } else { try { // if more than two hours returns 2 hours TIME_TO_NEXT_BOOKING= service.getTimeToBooking(booking); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show("There has been a problem in calculating the time to the next booking"); } if (TIME_TO_NEXT_BOOKING.Minutes == -15) { System.Windows.Forms.MessageBox.Show("In 15 minutes a new booking will start "); } else if (TIME_TO_NEXT_BOOKING.Minutes == -30) { System.Windows.Forms.MessageBox.Show("In 30 minutes a new booking will start "); } else if (TIME_TO_NEXT_BOOKING.Minutes > -10)// preebooking prevented 10 min before start of other booking { btnStart.Visibility = Visibility.Hidden; knownUser = service.getUserFBooking(booking, libID); if (TIME_TO_NEXT_BOOKING.Minutes > -1) { timerPanel.Visibility = Visibility.Visible; timerToLogIn = new System.Windows.Forms.Timer(); timerToLogIn.Interval = 1000; timerToLogIn.Tick += new EventHandler(timerToLogIn_Tick); initiateTimer(); timerToLogIn.Start(); } AVAILABLE = false; } } }