internal vwManager FindManagerCredentials(string userName, string password)
 {
     try
     {
         using (CompanyDBEntities context = new CompanyDBEntities())
         {
             string    encryptedPassword = EncryptionHelper.Encrypt(password);
             vwManager managerToFind     = (from m in context.vwManagers where m.Username == userName && m.UserPassword == encryptedPassword select m).First();
             return(managerToFind);
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("Doctor not found!" + ex.Message.ToString());
         return(null);
     }
 }
 internal vwManager AddManager(vwManager manager)
 {
     try
     {
         using (CompanyDBEntities context = new CompanyDBEntities())
         {
             tblUser newUser = new tblUser();
             newUser.FirstName      = manager.FirstName;
             newUser.LastName       = manager.LastName;
             newUser.JMBG           = manager.JMBG;
             newUser.Gender         = manager.Gender;
             newUser.Residence      = manager.Residence;
             newUser.MarriageStatus = manager.MarriageStatus;
             newUser.Username       = manager.Username;
             newUser.UserPassword   = manager.UserPassword;
             context.tblUsers.Add(newUser);
             context.SaveChanges();
             manager.UserID = newUser.UserID;
             tblManager newManager = new tblManager();
             newManager.Email              = manager.Email;
             newManager.ReservedPassword   = manager.ReservedPassword;
             newManager.SuccessfulProjects = manager.SuccessfulProjects;
             newManager.OfficeNumber       = manager.OfficeNumber;
             newManager.UserID             = manager.UserID;
             context.tblManagers.Add(newManager);
             context.SaveChanges();
             manager.ManagerID = newManager.ManagerID;
             return(manager);
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("Exception" + ex.Message.ToString());
         return(null);
     }
 }