private ServiceReference1.Credentials Credenciales() { var credentials = new ServiceReference1.Credentials(); credentials.UserName = "******"; credentials.Password = "******"; return(credentials); }
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; } } }
internal bool isSameUser(LogIn.Model.User userAtPC, ServiceReference1.Credentials theUser) { byte[] hashSalt = Convert.FromBase64String(theUser.ClientPass); return(validate(userAtPC.UserName, hashSalt, theUser.ClientID)); }
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; } } }