protected Document(User Sender, List<Professional> Receivers, Patient Patient, string Title) { _receivers = Receivers; _patient = Patient; _sender = Sender; _date = DateTime.Now; _title = Title; }
/// <summary> /// Add a patient into the database /// </summary> /// <param name="user"> user can't be null and all property of an user can be null exept userId who it must be null</param> /// <returns></returns> public Patient AddPatient(User user) { if (user == null) throw new ArgumentNullException("user", "user can't be null"); if (user.Adress == null || user.Birthdate == null || user.City == null || user.FirstName == null || user.LastName == null || user.Password == null || user.PhoneNumber == 0 || user.Photo == null || user.Postcode == 0 || user.Pseudo == "null" || user.UserId != 0) throw new ArgumentException("All property of an user can't be null exept userId who it must be null"); Patient p = new Patient() { User = user }; _context.User.Add(user); _context.Patient.Add(p); _context.SaveChanges(); return p; }
/// <summary> /// Add a patient into the database /// </summary> /// <param name="user"> User can't be null and all property of an user can be null exept userId who it must be null </param> /// <param name="role"> Role can't be null and it's the role of the professional </param> /// <returns></returns> public Professional AddProfessional(User user, string role) { if (user == null || role == null) throw new ArgumentNullException("user or ", "user can't be null"); if (user.Adress == null || user.Birthdate == null || user.City == null || user.FirstName == null || user.LastName == null || user.Password == null || user.PhoneNumber == 0 || user.Photo == null || user.Postcode == 0 || user.Pseudo == "null" || user.UserId != 0) throw new ArgumentException("All property of an user can't be null exept userId who it must be null"); Professional p = new Professional() { Role = role, User = user }; _context.User.Add(user); _context.Professional.Add(p); _context.SaveChanges(); return p; }
/// <summary> /// Methode use for update an user if just one thing change one gonna change /// </summary> /// <param name="FirstName"> new FirstName </param> /// <param name="LastName"> new LastName </param> /// <param name="Adress"> new Adress </param> /// <param name="Birthdate"> new Birthdate </param> /// <param name="City"> new City </param> /// <param name="Email"> new Email </param> /// <param name="PostCode"> new PostCode </param> /// <param name="PhoneNumber"> new PhoneNumber </param> /// <param name="user"> User to modifie </param> public void CheckUserInfo(User user) { var selectQuery = _context.User.Where(s => s.UserId.Equals(user.UserId)).FirstOrDefault(); if (selectQuery != null) { if (selectQuery.FirstName != user.FirstName) UpdateFirstName(user.FirstName, selectQuery); if (selectQuery.LastName != user.LastName) UpdateLastName(user.LastName, selectQuery); if (selectQuery.Adress != user.Adress) UpdateAdress(user.Adress, selectQuery); if (selectQuery.Birthdate != user.Birthdate) UpdateBirthDate(user.Birthdate, selectQuery); if (selectQuery.City != user.City) UpdateCity(user.City, selectQuery); if (selectQuery.Pseudo != user.Pseudo) UpdateEmail(user.Pseudo, selectQuery); if (selectQuery.Postcode != user.Postcode) UpdatePostcode(user.Postcode, selectQuery); if (selectQuery.PhoneNumber != user.PhoneNumber) UpdatePhoneNumber(user.PhoneNumber, selectQuery); if (selectQuery.Photo != user.Photo) UpdatePhoto(user.Photo, selectQuery); _context.Entry(selectQuery).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); } }
private UserXML CreateUser(User user) { UserXML u = new UserXML() { Adress = user.Adress, Birthdate = user.Birthdate, City = user.City, FirstName = user.FirstName, LastName = user.LastName, Password = user.Password, PhoneNumber = user.PhoneNumber, PhotoPath = user.Photo, Photo = _img.ImageCoverter(_img.LoadImage(user.Photo)), Postcode = user.Postcode, Pseudo = user.Pseudo, UserId = user.UserId }; return u; }
public void PostUser(User user) { _db.UpdateRequest.CheckUserInfo(user); }
private void UpdateAdress(string Adress, User User) { User.Adress = Adress; }
private void UpdateBirthDate(DateTime Birthdate, User User) { User.Birthdate = Birthdate; }
private void UpdateCity(string City, User User) { User.City = City; }
private void UpdateEmail(string Email, User User) { User.Pseudo = Email; }
public PatientCreation(User user) { _user = user; }
public void CreateMessage(List<Professional> Receivers, User Sender, string Title, string Contents, Patient Patient) { Message m = new Message(Title, Contents, Sender, Receivers, Patient); CreateDoc(m); }
public void PutAndDeleteProfessional() { using (ArchiViteContext context = new ArchiViteContext()) { _doc = new DocumentManager(context); User userTest = new User() { FirstName = "TEST", LastName = "TEST", Birthdate = DateTime.Now, Adress = "72 avenue maurice thorez", City = "Ivry-sur-Seine", Postcode = 12345, PhoneNumber = 0606066606, Pseudo = "test", Password = "******", Photo = "yolo" }; ProfessionalCreation newPro = new ProfessionalCreation(userTest, "testeur"); _professionalService.putProfessional(newPro); Assert.IsNotNull(context.SelectRequest.SelectProfessional("test", "mdp")); _professionalService.DeleteProfessionalCheck(context.SelectRequest.SelectProfessional("test", "mdp").ProfessionalId); Assert.IsNull(context.SelectRequest.SelectProfessional("test", "mdp")); } }
public void UpdateFirstName(string FirstName, User User) { User.FirstName = FirstName; }
private void UpdateLastName(string LastName, User User) { User.LastName = LastName; }
public ProfessionalCreation(User user, string role) { _user = user; _role = role; }
public void UserSuppression( User user ) { _context.User.Remove(user); _context.SaveChanges(); }
public void CreatePrescription(List<Professional> Receivers, User Sender, Patient Patient, string Title, string DocPath) { Prescription p = new Prescription(Title, DocPath, Sender, Receivers, Patient); CreateDoc(p); }
private void UpdatePostcode(int PostCode, User User) { User.Postcode = PostCode; }
private void UpdatePhoto(string Photo, User User) { User.Photo = Photo; }
public Message(string Title, string Contents, User Sender, List<Professional> Receivers, Patient Patient) : base(Sender, Receivers, Patient, Title) { contents = Contents; }
public Prescription(string Title, string DocPath, User Sender, List<Professional> Receivers, Patient Patient) : base(Sender, Receivers, Patient, Title) { this.DocPath = DocPath; }
private void UpdatePhoneNumber(int PhoneNumber, User User) { User.PhoneNumber = PhoneNumber; }