示例#1
0
 public void ApproveRequest(string therapistNRIC, short permission)
 {
     if (AccountBLL.IsPatient())
     {
         patientDAL.UpdateRequestApprove(AccountBLL.GetNRIC(), therapistNRIC, permission);
         logPermissionBLL.LogEvent(AccountBLL.GetNRIC(), "Approve Therapist Permissions", "Action on: " + therapistNRIC + ".");
     }
 }
示例#2
0
 public void RevokePermissions(string therapistNRIC)
 {
     if (AccountBLL.IsPatient())
     {
         patientDAL.UpdateRequestRevoke(AccountBLL.GetNRIC(), therapistNRIC);
         logPermissionBLL.LogEvent(AccountBLL.GetNRIC(), "Revoke Therapist Permissions", "Action on: " + therapistNRIC + ".");
     }
 }
示例#3
0
 public void UpdateRecordDisable(long recordID)
 {
     if (AccountBLL.IsPatient())
     {
         recordDAL.UpdateRecordDisable(recordID, AccountBLL.GetNRIC());
         logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "Update Record Status Disable", "Record ID: " + recordID + ".");
     }
 }
示例#4
0
        public void AddRecord(Record record)
        {
            if (AccountBLL.IsPatient() && record.patientNRIC.Equals(AccountBLL.GetNRIC()))
            {
                if (record.type.isContent)
                {
                    recordDAL.InsertContent(record, AccountBLL.GetNRIC());
                    logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "Insert Record", "Action on: " + record.patientNRIC + ", Record ID: " + record.id + ".");
                }
                else if (!record.type.isContent)
                {
                    record.fileChecksum = record.GetMD5HashFromFile();

                    if (record.IsFileSafe())
                    {
                        recordDAL.InsertFile(record, AccountBLL.GetNRIC());
                    }
                    else
                    {
                        throw new Exception();
                    }

                    logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "Insert Record", "Action on: " + record.patientNRIC + ", Record ID: " + record.id + ".");
                }
            }
            else if (AccountBLL.IsTherapist())
            {
                Entity.Patient patient = new TherapistBLL().GetPatientPermissions(record.patientNRIC);

                if (patient.permissionApproved == 0 || ((patient.permissionApproved & record.type.permissionFlag) == 0) ||
                    AccountBLL.GetNRIC().Equals(record.patientNRIC))
                {
                    return;
                }

                if (record.type.isContent)
                {
                    recordDAL.InsertContent(record, AccountBLL.GetNRIC());
                    logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "Insert Record", "Action on: " + record.patientNRIC + ", Record ID: " + record.id + ".");
                }
                else if (!record.type.isContent)
                {
                    record.fileChecksum = record.GetMD5HashFromFile();

                    if (record.IsFileSafe())
                    {
                        recordDAL.InsertFile(record, AccountBLL.GetNRIC());
                    }
                    else
                    {
                        throw new Exception();
                    }

                    logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "Insert Record", "Action on: " + record.patientNRIC + ", Record ID: " + record.id + ".");
                }
            }
        }
示例#5
0
        public Entity.Therapist GetTherapistPermission(string therapistNRIC)
        {
            if (AccountBLL.IsPatient())
            {
                Entity.Therapist result = patientDAL.RetrieveTherapistPermission(therapistNRIC, AccountBLL.GetNRIC());
                logPermissionBLL.LogEvent(AccountBLL.GetNRIC(), "View Therapist Permissions", "Action on: " + therapistNRIC + ".");
                return(result);
            }

            return(null);
        }
示例#6
0
        public List <Entity.Therapist> GetDisallowedTherapists(int recordID, string term)
        {
            if (AccountBLL.IsPatient())
            {
                List <Entity.Therapist> result = patientDAL.RetrievePermissionsDisallow(recordID, term, AccountBLL.GetNRIC());
                logPermissionBLL.LogEvent(AccountBLL.GetNRIC(), "View Disallowed Therapists", "Term: \"" + term + "\", Record ID: " + recordID + ".");
                return(result);
            }

            return(null);
        }
示例#7
0
        public List <Entity.Therapist> GetCurrentTherapistsFineGrain(string term, long recordID)
        {
            if (AccountBLL.IsPatient())
            {
                List <Entity.Therapist> result = patientDAL.RetrieveCurrentTherapistsFineGrain(term, recordID, AccountBLL.GetNRIC());
                logPermissionBLL.LogEvent(AccountBLL.GetNRIC(), "View Record Fine Grain Permissions", "Term: \"" + term + "\", Record ID: " + recordID + ".");
                return(result);
            }

            return(null);
        }
示例#8
0
        public List <Entity.Therapist> GetCurrentTherapists(string term)
        {
            if (AccountBLL.IsPatient())
            {
                List <Entity.Therapist> result = patientDAL.RetrieveCurrentTherapists(term, AccountBLL.GetNRIC());
                logAccountBLL.LogEvent(AccountBLL.GetNRIC(), "View Current Therapists", "Term: \"" + term + "\".");
                return(result);
            }

            return(null);
        }
示例#9
0
 public void UpdateRecordTherapistDisallow(long recordID, string therapistNRIC)
 {
     if (AccountBLL.IsPatient())
     {
         if (recordDAL.RetrieveRecordOwner(AccountBLL.GetNRIC(), recordID))
         {
             recordDAL.InsertRecordPermissionDisallow(recordID, therapistNRIC);
             logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "Update Record Fine Grain Permission Disallow", "Action on: " + therapistNRIC + ", Record ID: " + recordID + ".");
         }
     }
 }
示例#10
0
 public void UpdateRecordTherapistDefault(long recordID, string therapistNRIC)
 {
     if (AccountBLL.IsPatient())
     {
         if (recordDAL.RetrieveRecordOwner(AccountBLL.GetNRIC(), recordID))
         {
             recordDAL.DeleteRecordPermission(recordID, therapistNRIC);
             logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "Update Record Status Default", "Record ID: " + recordID + ".");
         }
     }
 }
示例#11
0
        public List <Record> GetRecords()
        {
            if (AccountBLL.IsPatient())
            {
                List <Record> result = recordDAL.RetrieveRecords(AccountBLL.GetNRIC());
                logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "View Records", "Self.");
                return(result);
            }

            return(null);
        }
示例#12
0
        public List <PatientDiagnosis> GetDiagnoses()
        {
            if (AccountBLL.IsPatient())
            {
                List <PatientDiagnosis> result = patientDAL.RetrievePatientDiagnoses(AccountBLL.GetNRIC());
                logAccountBLL.LogEvent(AccountBLL.GetNRIC(), "View Diagnoses", "Self.");

                return(result);
            }

            return(null);
        }
示例#13
0
        public List <RecordDiagnosis> GetRecordDiagnoses(long recordID)
        {
            if (AccountBLL.IsPatient())
            {
                return(recordDAL.RetrieveRecordDiagnoses(recordID, AccountBLL.GetNRIC()));
            }
            else if (AccountBLL.IsTherapist())
            {
                Record         record  = recordDAL.RetrieveRecord(recordID, AccountBLL.GetNRIC());
                Entity.Patient patient = new TherapistBLL().GetPatient(record.patientNRIC);

                if (patient.hasPermissionsApproved(record))
                {
                    List <RecordDiagnosis> result = recordDAL.RetrieveRecordDiagnoses(recordID, record.patientNRIC, AccountBLL.GetNRIC());
                    logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "View Record Diagnoses", "Record ID: " + recordID + ".");
                    return(result);
                }
            }

            return(null);
        }
示例#14
0
        public Record GetRecord(long recordID)
        {
            if (AccountBLL.IsPatient())
            {
                return(recordDAL.RetrieveRecord(AccountBLL.GetNRIC(), recordID));
            }
            else if (AccountBLL.IsTherapist())
            {
                Record         record  = recordDAL.RetrieveRecord(recordID, AccountBLL.GetNRIC());
                Entity.Patient patient = new TherapistBLL().GetPatient(record.patientNRIC);

                if (patient.hasPermissionsApproved(record))
                {
                    record.permited = true;

                    logRecordBLL.LogEvent(AccountBLL.GetNRIC(), "View Record", "Record ID: " + recordID + ".");

                    return(record);
                }
            }

            return(null);
        }