Beispiel #1
0
    private void bindLstEligibleParticipants()
    {
        ParticipantDAO dao = new ParticipantDAO();
        ICollection<Participant> participantList = dao.GetEligibleParticipants();

        lstPatients.DataSource = participantList;
        lstPatients.DataTextField = "FullName";
        lstPatients.DataValueField = "ID";
        lstPatients.DataBind();
    }
        /**
         * this is the constructor for the GUI, it does the following:
         * 1.  set up the DAO objects to access the local database
         * 2.  add any active meetings in the database to the field in the GUI
         * 3.  extract my X.509 certificate from the local store
         * 4.  instantiate 5 "dummy" resources, add them to resource list
         * */
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //

            dbConnect = "DSN=TotalRecall;UID=TotalRecallUser;PWD=totalrecall;DATABASE=TotalRecall";

            mDAO  = new MeetingDAO(dbConnect);
            pDAO  = new ParticipantDAO(dbConnect);
            rDAO  = new ResourceDAO(dbConnect);
            cDAO  = new ContactDAO(dbConnect);
            cmDAO = new ContextMsgDAO(dbConnect);

            strSelectedMtg = "";
            ArrayList lstMtgs = mDAO.GetMeetingIDs(enuMeetingState.Active);

            foreach (string s in lstMtgs)
            {
                m_boxMtgs.Items.Add(s);
            }

            strMyUrl = "http://localhost/TotalRecall/InfoAgent.asmx?wsdl";

            store = X509CertificateStore.LocalMachineStore(X509CertificateStore.MyStore);
            store.OpenRead();

            strMyName = "CN=Omar";
            certCol   = store.FindCertificateBySubjectName(strMyName);

            cert      = (X509Certificate)certCol[0];
            certToken = new X509SecurityToken(cert);

            lstResources = new ArrayList();
            for (int i = 0; i < 5; i++)
            {
                Resource res = new Resource();
                res.ID   = "res" + (i + 1);
                res.Name = "Foo" + (i + 1) + ".txt";
                res.Url  = "file:///c:\\" + res.Name;
                rDAO.AddNewResource(res);
                lstResources.Add(res);
            }

            foreach (Resource r in lstResources)
            {
                m_boxResources.Items.Add(r.ID);
            }
        }
Beispiel #3
0
    private string getGroupAverage(string tGroup, string thing)
    {
        int sumWt = 0;
        int sumAge = 0;
        ParticipantDAO dao = new ParticipantDAO();
        ICollection<Participant> participantList = dao.GetTrialGroup(tGroup);

        foreach (var participant in participantList)
        {
            try
            {
                OfflineWebApplicationConnection conn = HVConnectionManager.CreateConnection(participant.HVPersonID);
                HealthRecordAccessor accessor = new HealthRecordAccessor(conn, participant.HVRecordID);
                HealthRecordSearcher search = accessor.CreateSearcher();

                search.Filters.Add(new HealthRecordFilter(Weight.TypeId));
                search.Filters.Add(new HealthRecordFilter(Basic.TypeId));
                HealthRecordItemCollection items = null;

                items = search.GetMatchingItems()[0];
                var firstStr = items[0].ToString();
                var secStr = firstStr.Substring(0, firstStr.IndexOf(" "));
                int intVal = Convert.ToInt32(secStr);
                sumWt = sumWt + intVal;

                items = search.GetMatchingItems()[1];
                var age = items[0].ToString();
                age = age.Substring(age.Length-4, 4);
                intVal = Convert.ToInt32(age);
                sumAge = sumAge + intVal;
            }
            catch (HealthServiceException ex)
            {
                String msg = String.Empty;
                if (ex is HealthServiceAccessDeniedException)
                    msg = "The application may be trying to read user data from an anonymous connection.\n";
                msg += ex.Error.ErrorInfo + "\n" + ex.Message.ToString();
                Debug.WriteLine(msg);
            }
        }
        if (participantList.Count > 0)
        {
            if (thing == "Weight") return (sumWt / participantList.Count).ToString();
            else if (thing == "Age") return (2013 - (sumAge / participantList.Count)).ToString();
        }
        return "No participants in Group " + tGroup;
    }
 /// <summary>
 /// Default constructor
 /// </summary>
 private ParticipantMgr()
 {
     this.DAO = new ParticipantDAO();
 }
Beispiel #5
0
 private ICollection<Participant> GetPcpPatients()
 {
     string username = Profile.UserName;
     ParticipantDAO dao = new ParticipantDAO();
     return dao.GetParticipantsForPcp(username);
 }
Beispiel #6
0
 private Participant GetParticipant(Guid pid)
 {
     ParticipantDAO dao = new ParticipantDAO();
     return dao.FindParticipantById(pid);
 }
Beispiel #7
0
 private ICollection<Participant> GetOncologistPatients()
 {
     ParticipantDAO dao = new ParticipantDAO();
     return dao.GetEligibleParticipants();
 }
 public ParticipantEnroller()
 {
     HvEnroller = new HVParticipantEnroller();
     ParticipantDAO = new ParticipantDAO();
     rand = new Random();
 }
Beispiel #9
0
        /**
         * this constructor does the following:
         * 1.  read in the X.509 certificate from the machine store
         * 2.  get the localhost IP address
         * 3.  create an executor / executor context for the local InfoAgent
         * 4.  create the DAO objects to access contents in the database
         * 5.  update the existing meetings with all meetings in the database
         * */
        public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            store = X509CertificateStore.LocalMachineStore(X509CertificateStore.MyStore);
            store.OpenRead();

            strMyId = "CN=Omar";
            certCol = store.FindCertificateBySubjectName(strMyId);

            cert      = (X509Certificate)certCol[0];
            certToken = new X509SecurityToken(cert);

            me      = new MeetingParticipant();
            me.Name = cert.GetName();
            me.Role = enuMeetingParticipantRole.Organizer;

            strFileLocation = "TotalRecall/InfoAgent.asmx?wsdl";
            string      strHost = Dns.GetHostName();
            IPHostEntry entry   = Dns.Resolve(strHost);
            string      strIP   = "";

            if (entry.AddressList.Length > 0)
            {
                IPAddress addr = new IPAddress(entry.AddressList[0].Address);
                strIP = addr.ToString();
            }
            else
            {
                m_boxInvite.Text = "ERROR getting host IP";
                return;
            }
            StringBuilder strbldUrl = new StringBuilder(strIP);

            strbldUrl.Append(strFileLocation);
            me.Location = strbldUrl.ToString();


            //create my infoagent
            strMyUrl = "http://localhost/TotalRecall/InfoAgent.asmx?wsdl";

            ProxyGenRequest pxyreq = new ProxyGenRequest();

            pxyreq.ProxyPath   = "";
            pxyreq.ServiceName = "InfoAgent";
            pxyreq.WsdlUrl     = strMyUrl;

            ProxyPolicyMutator mymutator = new ProxyPolicyMutator();

            mymutator.ProxyName = pxyreq.ServiceName;

            // Ensure the name of the file generated is unique
            string strMySuffix = "";
            int    nMyCode     = Guid.NewGuid().GetHashCode();

            if (nMyCode < 0)
            {
                nMyCode = nMyCode * -1;
            }
            strMySuffix        = nMyCode.ToString();
            pxyreq.ServiceName = pxyreq.ServiceName + "_" + strMySuffix;

            ProxyGen myPxyGen = new ProxyGen();

            myPxyGen.Mutator = mymutator;

            string strMyAssembly = "";

            try
            {
                strMyAssembly = myPxyGen.GenerateAssembly(pxyreq);
            }
            catch (Exception excep)
            {
                string strString = excep.Message;
            }

            myctx             = new ExecContext();
            myctx.ServiceName = pxyreq.Namespace + "." + mymutator.ProxyName;
            myctx.Assembly    = strMyAssembly;


            myexec = new Executor();
            myexec.Settings.ExpectSignedResponse = true;
            myexec.Settings.SigningCertificate   = cert;

            dbConnect = "DSN=TotalRecall;UID=TotalRecallUser;PWD=totalrecall;DATABASE=TotalRecall";

            mDAO = new MeetingDAO(dbConnect);
            pDAO = new ParticipantDAO(dbConnect);
            rDAO = new ResourceDAO(dbConnect);
            cDAO = new ContactDAO(dbConnect);

            strSelectedMtg = "";
            ArrayList lstMtgs = mDAO.GetMeetingIDs(enuMeetingState.Active);

            foreach (string s in lstMtgs)
            {
                m_boxMtgs.Items.Add(s);
            }
        }
Beispiel #10
0
 private void GetPatient()
 {
     Guid pid = (Guid)Session["selected_patient_pid"];
     ParticipantDAO dao = new ParticipantDAO();
     selectedParticipant = dao.FindParticipantById(pid);
 }