예제 #1
0
    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!");
        }
    }
예제 #2
0
    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);
        }
    }
예제 #3
0
    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!");
        }
    }
예제 #4
0
    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;
        }
    }
예제 #5
0
        /// <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);
        }