public bool storeTest(Test test) { if (Authenticated_AorC()) { try { Movement.Database.User newUser = new Movement.Database.User(test.user.userID); Movement.Database.Patient newPatient = new Movement.Database.Patient(test.patient.ID); Movement.Database.TestScript newScript = new Movement.Database.TestScript(test.script.scriptID); IEnumerable <Movement.Database.TestDataSample> data; data = test.data.ConvertAll <TestDataSample>(new Converter <Data, TestDataSample>( delegate(Data filler) { return(new TestDataSample(filler.time, filler.x, filler.y, filler.pressure)); })); Movement.Database.Test.CreateTest(newUser, newPatient, test.hand, newScript, test.mode, data, test.avg_X, test.avg_Y, test.rotation); return(true); } catch (Exception e) { Log(e); return(false); } } else { throw new UnauthorizedAccessException("You are not authorized to perform that action!"); } }
public UserObject logIn(string userName, string password) { //eventually this will start a session and populate session variables UserObject user = new UserObject(); try { Movement.Database.User newUser = Movement.Database.User.Login(userName, password); if (newUser != null) { UserInfo = newUser; user.role = newUser.Role; user.userID = newUser.UserID; user.userName = newUser.Username; user.contactInfo = newUser.ContactInfo; user.name = newUser.Name; //UserInfo = user; //---Set UserInfo session variable return(user); } else { return(user); } } catch (Exception e) { Log(e); return(user); } }
public bool storeTest(Test test) { if (Authenticated_AorC()) { try { Movement.Database.User newUser = new Movement.Database.User(test.user.userID); Movement.Database.Patient newPatient = new Movement.Database.Patient(test.patient.ID); Movement.Database.TestScript newScript = new Movement.Database.TestScript(test.script.scriptID); IEnumerable<Movement.Database.TestDataSample> data; data = test.data.ConvertAll<TestDataSample>(new Converter<Data, TestDataSample>( delegate(Data filler) { return new TestDataSample(filler.time, filler.x, filler.y, filler.pressure); })); Movement.Database.Test.CreateTest(newUser, newPatient, test.hand, newScript, test.mode, data, test.avg_X, test.avg_Y, test.rotation); return true; } catch(Exception e) { Log(e); return false; } } else { throw new UnauthorizedAccessException("You are not authorized to perform that action!"); } }
public UserObject logIn(string userName, string password) { //eventually this will start a session and populate session variables UserObject user = new UserObject(); try { Movement.Database.User newUser = Movement.Database.User.Login(userName, password); if (newUser != null) { UserInfo = newUser; user.role = newUser.Role; user.userID = newUser.UserID; user.userName = newUser.Username; user.contactInfo = newUser.ContactInfo; user.name = newUser.Name; //UserInfo = user; //---Set UserInfo session variable return user; } else { return user; } } catch (Exception e) { Log(e); return user; } }
/// <summary> /// Stores a new note regarding this patient. /// </summary> /// <param name="author">The author of the note.</param> /// <param name="data">The content of the note.</param> /// <returns>The created note.</returns> public PatientNote RecordNote( User author, string data) { Execute(GetConnection(), "STORE_PATIENT_NOTE", "@patientID", PatientID, "@userID", author.UserID, "@note", data); return new PatientNote(this, DateTime.UtcNow, author.UserID, data); }