Пример #1
0
 internal tblDoctor AddDoctor(tblDoctor doctor)
 {
     try
     {
         using (MedicalServiceEntities context = new MedicalServiceEntities())
         {
             tblDoctor newDoctor = new tblDoctor();
             newDoctor.FirstName         = doctor.FirstName;
             newDoctor.LastName          = doctor.LastName;
             newDoctor.JMBG              = doctor.JMBG;
             newDoctor.BankAccountNumber = doctor.BankAccountNumber;
             newDoctor.JMBG              = doctor.JMBG;
             newDoctor.UserName          = doctor.UserName;
             newDoctor.Password          = doctor.Password;
             context.tblDoctors.Add(newDoctor);
             context.SaveChanges();
             doctor.ID = newDoctor.ID;
             return(doctor);
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("Exception" + ex.Message.ToString());
         return(null);
     }
 }
Пример #2
0
 internal tblDoctor FindDoctorCredentials(string userName, string password)
 {
     try
     {
         using (MedicalServiceEntities context = new MedicalServiceEntities())
         {
             string    encryptedPassword = EncryptionHelper.Encrypt(password);
             tblDoctor doctorToFind      = (from d in context.tblDoctors where d.UserName == userName && d.Password == encryptedPassword select d).First();
             return(doctorToFind);
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("Doctor not found!" + ex.Message.ToString());
         return(null);
     }
 }