예제 #1
0
        public void CheckGetUserName()
        {
            var unitOfWork = new UnitOfWork(new bastelei_ws());
              string name = unitOfWork.Users.GetName(_mail);

              Assert.AreEqual(name, _name);
        }
예제 #2
0
        public void CheckGetPassword()
        {
            var unitOfWork = new UnitOfWork(new bastelei_ws());
              string psw = unitOfWork.Users.GetPassword(_mail);

              Assert.AreEqual(psw, Tools.EncryptPassword(_mail,_password));
        }
예제 #3
0
 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();
 }
예제 #4
0
        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 {

              }
        }
예제 #5
0
 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);
       }
 }
예제 #8
0
        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) {

              }
        }
예제 #9
0
 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);
       }
 }
예제 #10
0
 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) {
       }
 }
예제 #11
0
 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);
       }
 }