Exemple #1
0
        private void LoginButtonPictureBox_Click(object sender, EventArgs e)
        {
            // Account logInAccount = this.Service.ReadAccount("username","password");

            #region REMOVE THIS
            UnitEmployee unitEmployee = new UnitEmployee(0, "UE_Surname", "UE_Forename", DateTime.Today, WorkingUnit.ICU);
            Account      unitAccount  = new Account(0, "unit", "", "", unitEmployee);

            PharmacyEmployee pharmacyEmployee = new PharmacyEmployee(1, "PH_Surname", "PH_Forename", DateTime.Today);
            Account          pharmacyAccount  = new Account(0, "pharm", "", "", pharmacyEmployee);
            #endregion

            if (usernameTextBox.Text.Equals("unit"))
            {
                var UnitMenu = new UnitMenu(unitAccount);
                UnitMenu.FormClosed += UnitMenu_FormClosed;
                UnitMenu.Show();
                this.Hide();
            }
            else if (usernameTextBox.Text.Equals("pharm"))
            {
                var PharmacyMenu = new PharmacyMenu(pharmacyAccount);
                PharmacyMenu.FormClosed += PharmacyMenu_FormClosed;
                PharmacyMenu.Show();
                this.Hide();
            }
            else
            {
                this.errorLabel.Text += "Invalid credentials. ";
            }
        }
 private void AddUnitEmployee(string personId)
 {
     foreach (var selectedUnit in SelectedUnits)
     {
         //Assumes that assigning physicians to their respective facilities are on the same date/time
         //as their registration to the system
         var newUnitEmployee = new UnitEmployee
         {
             WorkUnitId   = selectedUnit.WorkUnitId,
             EmployeeId   = personId,
             DateAssigned = DateTime.Now
         };
         _unitEmployeeService.AddUnitEmployee(newUnitEmployee);
     }
 }
 public void UpdateUnitEmployee(UnitEmployee unitEmployee)
 {
     _context.UnitEmployees.Update(unitEmployee);
     _context.SaveChanges();
 }
 public void AddUnitEmployee(UnitEmployee unitEmployee)
 {
     _context.UnitEmployees.Add(unitEmployee);
     _context.SaveChanges();
 }