Ejemplo n.º 1
0
        public List <MaintenanceView> GetServiceList()
        {
            try
            {
                //var services = new List<MaintenanceDTO>();
                var services = this.DatabaseMaintenance.GetServiceList();

                var maintenanceDTO = new List <MaintenanceDTO>();
                maintenanceDTO = OrganiseServiceList(services);
                var serviceView = new List <MaintenanceView>();
                foreach (MaintenanceDTO DTO in maintenanceDTO)
                {
                    var service = new MaintenanceView();
                    service.Key              = DTO.AuthKey;
                    service.TargetNumber     = DTO.TramNumber;
                    service.TargetAnnotation = DTO.Annotation;
                    serviceView.Add(service);
                }

                if (serviceView.Any())
                {
                    return(serviceView);
                }
                else
                {
                    throw new Exception("No services");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// This method checks if username and password valid.
 /// </summary>
 /// <param name="password">User input for password.</param>
 public void LogInExecute(object password)
 {
     Password = (password as PasswordBox).Password;
     if (Username == MasterUsername && Password == MasterPassword)
     {
         MasterView masterView = new MasterView(Username, Password);
         masterView.ShowDialog();
     }
     else if (users.FindAdministrator(Username, Password) != null)
     {
         Administrator = users.FindAdministrator(Username, Password);
         if (clinic.CheckIfClinicExists())
         {
             AdministratorView administratorView = new AdministratorView();
             administratorView.ShowDialog();
         }
         else
         {
             CreateClinicView clinicView = new CreateClinicView();
             clinicView.ShowDialog();
         }
     }
     else if (users.FindMaintenance(Username, Password) != null)
     {
         Maintenance = users.FindMaintenance(Username, Password);
         MaintenanceView maintenanceView = new MaintenanceView(Maintenance);
         maintenanceView.ShowDialog();
     }
     else if (users.FindManager(Username, Password) != null)
     {
         Manager = users.FindManager(Username, Password);
         ManagerView managerView = new ManagerView();
         managerView.ShowDialog();
     }
     else if (users.FindDoctor(Username, Password) != null)
     {
         Doctor = users.FindDoctor(Username, Password);
         DoctorView doctorView = new DoctorView();
         doctorView.ShowDialog();
     }
     else if (users.FindPatient(Username, Password) != null)
     {
         Patient = users.FindPatient(Username, Password);
         PatientView patientView = new PatientView();
         patientView.ShowDialog();
     }
     else
     {
         MessageBox.Show("Wrong username or password. Please, try again.", "Notification");
     }
 }
Ejemplo n.º 3
0
 public IActionResult Index(MaintenanceView Model)
 {
     try
     {
         string authKey = HttpContext.Request.Cookies["key"];
         Model.Key = authKey;
         maintenanceLogic.IndicateCompleteService(Model);
         return(Index());
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Ejemplo n.º 4
0
 private bool RemoveService(MaintenanceView maintenanceView)
 {
     try
     {
         var service = new MaintenanceDTO();
         service.TramNumber = maintenanceView.TargetNumber;
         service.AuthKey    = maintenanceView.Key;
         if (this.DatabaseMaintenance.RemoveService(service))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
Ejemplo n.º 5
0
 public bool IndicateCompleteService(MaintenanceView maintenanceView)
 {
     try
     {
         MaintenanceDTO service = new MaintenanceDTO();
         service.TramNumber = maintenanceView.TargetNumber;
         service.AuthKey    = maintenanceView.Key;
         service.Annotation = maintenanceView.TargetAnnotation;
         if (this.DatabaseMaintenance.IndicateCompleteService(service))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         throw;
     }
 }
 public MaintenanceViewModel(MaintenanceView maintenanceView, vwClinicMaintenance maintenance)
 {
     this.maintenanceView = maintenanceView;
     Maintenance          = maintenance;
 }
Ejemplo n.º 7
0
        public App()
        {
            InitializeComponent();

            MainPage = new MaintenanceView();
        }
        public void MaintenanceExecute()
        {
            MaintenanceView maintenanceView = new MaintenanceView();

            maintenanceView.ShowDialog();
        }