public void CheckGetUserName() { var unitOfWork = new UnitOfWork(new bastelei_ws()); string name = unitOfWork.Users.GetName(_mail); Assert.AreEqual(name, _name); }
public void CheckGetPassword() { var unitOfWork = new UnitOfWork(new bastelei_ws()); string psw = unitOfWork.Users.GetPassword(_mail); Assert.AreEqual(psw, Tools.EncryptPassword(_mail,_password)); }
public void Verify() { UnitOfWork unitOfWork = new UnitOfWork(new bastelei_ws()); if (SelectedProbe != null) { unitOfWork.Probes.VerifyProbeByLocation(SelectedProbe.LocationName); unitOfWork.Complete(); //TODO Information Text } else { //Todo Information nicht erfolgreich } LoadProbes(); }
public void LoadProbes() { try { ProbeList.Clear(); UnitOfWork unitOfWork = new UnitOfWork(new bastelei_ws()); var probes = unitOfWork.Probes.GetUnverifiedProbes(); foreach (UnverifiedProbe item in probes) { ProbeList.Add(item); } unitOfWork.Complete(); } catch { } }
public void Login() { try { var unitOfWork = new UnitOfWork(new bastelei_ws()); string password = unitOfWork.Users.GetPassword(MailAdress); string passwordToTest = Tools.EncryptPassword(MailAdress, Password); if (Tools.PasswordsMatch(password, passwordToTest)) { Information = "You are logged in."; _windowManager.ShowWindow(new MainViewModel(MailAdress)); TryClose(); } } catch (Exception ex) { Information = "Wrong mail adress or password or no connection to database."; } }
private void RefreshDataTask() { ProgessRingIsActive = true; ITimespan timespan = new TimespanFactory().GetTimespanObject(SelectedTimeSpan); int timeIntervalInMinutes = timespan.CalculateTimespan(); DateTime fromTime = timespan.CalculateFromTime(); Diagrams.Clear(); try { var unitOfWork = new UnitOfWork(new bastelei_ws()); var probeID = unitOfWork.Probes.GetProbeIDByName(SelectedLocation.LocationBtn); Diagrams.Add(new DiagramViewModel("humidity", unitOfWork.Measurements.GetDateValuePairs(probeID, fromTime, "humidity", timeIntervalInMinutes))); Diagrams.Add(new DiagramViewModel("temperature", unitOfWork.Measurements.GetDateValuePairs(probeID, fromTime, "temperature", timeIntervalInMinutes))); Diagrams.Add(new DiagramViewModel("pressure", unitOfWork.Measurements.GetDateValuePairs(probeID, fromTime, "airpressure", timeIntervalInMinutes))); } catch (Exception ex) { } GetLocations(); ProgessRingIsActive = false; }
private void GetLocations() { try { if(Locations.Count != 0) { Locations.Clear(); } var unitOfWork = new UnitOfWork(new bastelei_ws()); var locNames = unitOfWork.Probes.GetLocationNames(); foreach (var name in locNames) { Locations.Add(new LocationViewModel(name)); } unitOfWork.Complete(); } catch (Exception ex) { throw new SystemException("Couldn't connect to DB", ex); } }
private void RegisterProbe() { try { var unitOfWork = new UnitOfWork(new bastelei_ws()); if (unitOfWork.Users.MailExists(_mailAddress)) { int uid = unitOfWork.Users.GetUserIDbyMail(_mailAddress); unitOfWork.Probes.AddProbe(uid, LocationName, Comment); unitOfWork.Complete(); Information = "Probe registration successful."; } else { Information = "No Database Connection"; } } catch (Exception ex) { } }
public void Submit() { try { var unitOfWork = new UnitOfWork(new bastelei_ws()); unitOfWork.Probes.ChangeLocationNames(SelectedLocation.LocationBtn, NewLocationName); unitOfWork.Probes.UnverifyProbeByLocation(SelectedLocation.LocationBtn); unitOfWork.Complete(); Information = "Location Name changed. Please wait for varification"; } catch (Exception ex) { throw new SystemException("Couldn't connect to DB", ex); } }
private void RegisterUser() { if(PasswordOne != PasswordTwo) { Information = "Your passwords don't match."; return; } try { var unitOfWork = new UnitOfWork(new bastelei_ws()); if (!unitOfWork.Users.MailExists(MailAdress)) { string encryptedPassword = Tools.EncryptPassword(MailAdress, PasswordOne); unitOfWork.Users.AddUser(Name, Surname, MailAdress, encryptedPassword); unitOfWork.Complete(); TryClose(); } else { Information = "Mail adress does already exist."; } } catch (Exception ex) { } }
private int FetchUserRights(string userAdress) { try { var unitOfWork = new UnitOfWork(new bastelei_ws()); return unitOfWork.Users.GetUserRights(userAdress); } catch (Exception ex) { throw new SystemException("Couldn't connect to DB", ex); } }