示例#1
0
        private void Connexion()
        {
            try
            {
                tryCo = true;
                Singleton.logOffPatient();
                IsEnConn = true;
                Singleton.identification();
                singleUser.Patient = SelectResultRech;

                PatientDB patient = PatientData.RecherchePatient(singleUser.Patient.Nom, singleUser.Patient.Prenom, Convert.ToDateTime(SelectResultRech.DateDeNaissance));


                if (patient != null)
                {
                    singleUser.PatientSingleton = new Patient(patient.Nom, patient.Prenom, patient.DateNaissance, patient.Sexe, (int)patient.Taille, (double)patient.Poids, (int)patient.Id1, (int)patient.Id2);
                }
                //log le patient qui à été connecté et la thérapeut qui l'a connecté
                logger.Info("Le patient " + patient.Prenom + " " + patient.Nom + " a été connecté par : " + Singleton.getInstance().Admin.Prenom + " " + Singleton.getInstance().Admin.Nom);
                MessageBox.Show(AxLanguage.Languages.REAplan_Connexion_Patient, AxLanguage.Languages.REAplan_Connexion, System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Asterisk);
                _nav.NavigateTo <HomeViewModel>(true);

                IsSelected = false;
                RecherchePatient();
                Messenger.Default.Send <Singleton>(singleUser, "Singleton"); //Message envoyé à HomeViewModel avec le singleton
            }
            catch (Exception ex)
            {
                GestionErreur.GerrerErreur(ex);
            }
        }
    public static PatientReferrer GetByID(int patient_referrer_id)
    {
        //string sql = "SELECT patient_referrer_id,patient_id,register_referrer_id,patient_referrer_date_added,is_debtor,is_active FROM PatientReferrer WHERE patient_referrer_id = " + patient_referrer_id.ToString();
        string    sql = JoinedSQL() + " AND patient_referrer_id = " + patient_referrer_id.ToString();
        DataTable tbl = DBBase.ExecuteQuery(sql).Tables[0];

        if (tbl.Rows.Count == 0)
        {
            return(null);
        }
        else
        {
            PatientReferrer pr = Load(tbl.Rows[0]);
            pr.Patient              = PatientDB.Load(tbl.Rows[0]);
            pr.Patient.Person       = PersonDB.Load(tbl.Rows[0], "patient_person_");
            pr.Patient.Person.Title = IDandDescrDB.Load(tbl.Rows[0], "patient_person_title_title_id", "patient_person_title_descr");

            if (tbl.Rows[0]["pr_register_referrer_id"] != DBNull.Value)
            {
                pr.RegisterReferrer                       = RegisterReferrerDB.Load(tbl.Rows[0]);
                pr.RegisterReferrer.Referrer              = ReferrerDB.Load(tbl.Rows[0]);
                pr.RegisterReferrer.Referrer.Person       = PersonDB.Load(tbl.Rows[0], "referrer_person_");
                pr.RegisterReferrer.Referrer.Person.Title = IDandDescrDB.Load(tbl.Rows[0], "referrer_person_title_title_id", "referrer_person_title_descr");
                pr.RegisterReferrer.Organisation          = OrganisationDB.Load(tbl.Rows[0], "organisation_");
            }
            if (tbl.Rows[0]["pr_organisation_id"] != DBNull.Value)
            {
                pr.Organisation = OrganisationDB.Load(tbl.Rows[0], "nonepcorg_");
            }

            return(pr);
        }
    }
示例#3
0
    public static bool IsValidUnsubscribeHash(string inString)
    {
        if (inString == null)
        {
            return(false);
        }

        inString = inString.Replace(" ", "+");

        string result = SimpleAES.Decrypt(SimpleAES.KeyType.EmailUnsubscribe, inString);

        if (result == null || !System.Text.RegularExpressions.Regex.IsMatch(result, @"^Mediclinic_\d{4}__\d+$"))
        {
            return(false);
        }

        string[] resultSplit = result.Split(new string[] { "__" }, StringSplitOptions.None);
        string   DB          = resultSplit[0];
        string   invNbr      = resultSplit[1];

        if (!Utilities.IsValidDB(DB.Substring(DB.Length - 4)))
        {
            return(false);
        }

        if (PatientDB.GetByID(Convert.ToInt32(invNbr), DB) == null)
        {
            return(false);
        }

        return(true);
    }
示例#4
0
    protected void GrdRegistration_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("Insert"))
        {
            DropDownList ddlOrganisation = (DropDownList)GrdRegistration.FooterRow.FindControl("ddlNewOrganisation");

            Patient patient = PatientDB.GetByID(GetFormID());
            if (patient == null)
            {
                HideTableAndSetErrorMessage("");
                return;
            }

            try
            {
                RegisterPatientDB.Insert(Convert.ToInt32(ddlOrganisation.SelectedValue), patient.PatientID);
            }
            catch (UniqueConstraintException)
            {
                // happens when 2 forms allow adding
                // do nothing and let form re-update
            }

            FillGrid();
        }
    }
示例#5
0
        private void DeletePatient()
        {
            try
            {
                //If button is clicked, a messagebox will be shown to make sure that the user wants to delete the patient
                MessageBoxResult result = MessageBox.Show("Are you sure you want to delete the patient?", "Delete", MessageBoxButton.YesNoCancel, MessageBoxImage.Exclamation, MessageBoxResult.No);

                if (result == MessageBoxResult.Yes)
                {
                    rowsAffected = PatientDB.deletePatient(SelectedPatient);

                    Patients.Clear();
                    DisplayAllPatients();

                    if (rowsAffected != 0)
                    {
                        MessageBox.Show("Patient Deleted");
                    }
                    else
                    {
                        MessageBox.Show("Delete Failed");
                    }
                }
            }
            catch (Exception e)
            {
                throw e;
            }
        }
示例#6
0
    protected void GrdReferreralEmails_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        Patient patient = PatientDB.GetByID(GetFormPTID());

        if (patient == null)
        {
            HideTableAndSetErrorMessage("");
            return;
        }

        UserView userView = UserView.GetInstance();

        DataTable dt       = ViewState["referreralemail_data"] as DataTable;
        bool      tblEmpty = (dt.Rows.Count == 1 && dt.Rows[0][0] == DBNull.Value);

        if (!tblEmpty && e.Row.RowType == DataControlRowType.DataRow)
        {
            Label     lblId     = (Label)e.Row.FindControl("lblId");
            DataRow[] foundRows = dt.Select("register_referrer_id=" + lblId.Text);
            DataRow   thisRow   = foundRows[0];



            Utilities.AddConfirmationBox(e);
            if ((e.Row.RowState & DataControlRowState.Edit) > 0)
            {
                Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow);
            }
        }
        if (e.Row.RowType == DataControlRowType.Footer)
        {
        }
    }
示例#7
0
    protected Tuple <Booking, PatientReferrer, bool, string, HealthCard> LoadRow(DataRow row)
    {
        Booking booking = BookingDB.Load(row, "booking_", true, false);

        booking.Offering = OfferingDB.Load(row, "offering_");

        PatientReferrer pr = PatientReferrerDB.Load(row, "pr_");

        pr.RegisterReferrer                       = RegisterReferrerDB.Load(row, "regref_");
        pr.RegisterReferrer.Referrer              = ReferrerDB.Load(row, "referrer_");
        pr.RegisterReferrer.Referrer.Person       = PersonDB.Load(row, "referrer_person_");
        pr.RegisterReferrer.Referrer.Person.Title = IDandDescrDB.Load(row, "referrer_person_title_title_id", "referrer_person_title_descr");
        if (row["organisation_organisation_id"] != DBNull.Value)
        {
            pr.RegisterReferrer.Organisation = OrganisationDB.Load(row, "organisation_");
        }
        pr.Patient              = PatientDB.Load(row, "patient_");
        pr.Patient.Person       = PersonDB.Load(row, "patient_person_");
        pr.Patient.Person.Title = IDandDescrDB.Load(row, "patient_person_title_title_id", "patient_person_title_descr");

        bool   refHasEmail = Convert.ToInt32(row["ref_has_email"]) == 1;
        string refEmail    = row["ref_email"] == DBNull.Value ? null : Convert.ToString(row["ref_email"]);

        HealthCard hc = HealthCardDB.Load(row, "hc_");

        return(new Tuple <Booking, PatientReferrer, bool, string, HealthCard>(booking, pr, refHasEmail, refEmail, hc));
    }
示例#8
0
    protected void GrdSummaryReport_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataTable dt       = Session["data_bookingswithoutsmsoremail"] as DataTable;
        bool      tblEmpty = (dt.Rows.Count == 1 && dt.Rows[0][0] == DBNull.Value);

        if (!tblEmpty && e.Row.RowType == DataControlRowType.DataRow)
        {
            Label     lblId     = (Label)e.Row.FindControl("lblId");
            DataRow[] foundRows = dt.Select("patient_id=" + lblId.Text);
            DataRow   thisRow   = foundRows[0];

            Patient patient = PatientDB.Load(thisRow);
            patient.Person       = PersonDB.Load(thisRow);
            patient.Person.Title = IDandDescrDB.Load(thisRow, "t_title_id", "t_descr");



            Utilities.AddConfirmationBox(e);
            if ((e.Row.RowState & DataControlRowState.Edit) > 0)
            {
                Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow);
            }
        }
        if (e.Row.RowType == DataControlRowType.Footer)
        {
        }
    }
示例#9
0
    protected void btnSubmit_Click_1(object sender, EventArgs e)
    {
        lblOutput.Text = colorPicker.Value;



        Patient patient = PatientDB.GetByID(54950);

        if (patient == null)
        {
            throw new Exception("Invalid url id");
        }

        Hashtable selectedConditions = PatientConditionDB.GetHashtable_ByPatientID(patient.PatientID, false);

        foreach (ListItem li in chkBoxListConditions.Items)
        {
            if (li.Selected && selectedConditions[Convert.ToInt32(li.Value)] == null)
            {
                PatientConditionDB.Insert(patient.PatientID, Convert.ToInt32(li.Value), DateTime.MinValue, 0, "", false);
            }

            if (!li.Selected && selectedConditions[Convert.ToInt32(li.Value)] != null)
            {
                PatientConditionDB.Delete(patient.PatientID, Convert.ToInt32(li.Value));
            }
        }

        //SetErrorMessage("Updated");
        Response.Redirect(Request.RawUrl);
    }
示例#10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Utilities.SetNoCache(Response);
        }

        try
        {
            if (Session == null || Session["DB"] == null)
            {
                throw new SessionTimedOutException();
            }

            string patient_id = Request.QueryString["patient_id"];
            if (patient_id == null || !Regex.IsMatch(patient_id, @"^\d+$"))
            {
                throw new CustomMessageException();
            }
            Patient patient = PatientDB.GetByID(Convert.ToInt32(patient_id));
            if (patient == null)
            {
                throw new CustomMessageException();
            }

            string offering_id = Request.QueryString["offering_id"];
            if (offering_id == null || !Regex.IsMatch(offering_id, @"^\d+$"))
            {
                throw new CustomMessageException();
            }
            Offering offering = OfferingDB.GetByID(Convert.ToInt32(offering_id));
            if (offering == null)
            {
                throw new CustomMessageException();
            }

            string booking_datetime = Request.QueryString["booking_datetime"];
            if (booking_datetime == null || !Regex.IsMatch(booking_datetime, @"^\d{4}_\d{2}_\d{2}_\d{4}$"))
            {
                throw new CustomMessageException();
            }
            DateTime dateTime = ConvertStringToDateTime(booking_datetime);

            int nbrMedicareThisServiceSoFarThisPeriod = (int)InvoiceDB.GetMedicareCountByPatientAndDateRange(patient.PatientID, dateTime.Date.AddMonths(-1 * offering.MaxNbrClaimableMonths), dateTime.Date, offering.OfferingID);

            // return "[done]:[limit]"
            Response.Write(nbrMedicareThisServiceSoFarThisPeriod + ":" + offering.MaxNbrClaimable + ":" + offering.MaxNbrClaimableMonths);
        }
        catch (SessionTimedOutException)
        {
            Utilities.UnsetSessionVariables();
            Response.Write("SessionTimedOutException");
        }
        catch (Exception ex)
        {
            Response.Write("Exception: " + (Utilities.IsDev() ? ex.ToString() : "please contact system administrator."));
        }
    }
示例#11
0
        //Method to displayAllPatients
        public void DisplayAllPatients()
        {
            var allPatients = PatientDB.GetAllPatients();

            foreach (var item in allPatients)
            {
                Patients.Add(item);
            }
        }
示例#12
0
    protected void GrdReferrerAdditionalEmails_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName.Equals("Insert"))
        {
            TextBox txtName  = (TextBox)GrdReferrerAdditionalEmails.FooterRow.FindControl("txtNewName");
            TextBox txtEmail = (TextBox)GrdReferrerAdditionalEmails.FooterRow.FindControl("txtNewEmail");


            txtName.Text  = txtName.Text.Trim();
            txtEmail.Text = txtEmail.Text.Trim();

            if (txtName.Text.Length == 0)
            {
                SetErrorMessage("Referrer Additional Emails - Name is required");
                return;
            }
            if (txtEmail.Text.Length == 0)
            {
                SetErrorMessage("Referrer Additional Emails - Email is required");
                return;
            }
            if (!Utilities.IsValidEmailAddress(txtEmail.Text))
            {
                SetErrorMessage("Referrer Additional Emails - Invalid email address");
                return;
            }


            Patient patient = PatientDB.GetByID(GetFormPTID());
            ReferrerAdditionalEmailDB.Insert(patient.PatientID, txtName.Text, txtEmail.Text);
            FillGrdReferrerAdditionalEmails();
        }

        if (e.CommandName.Equals("_Delete") || e.CommandName.Equals("_UnDelete"))
        {
            int referrer_additional_email_id = Convert.ToInt32(e.CommandArgument);

            try
            {
                if (e.CommandName.Equals("_Delete"))
                {
                    ReferrerAdditionalEmailDB.UpdateDeleted(referrer_additional_email_id, Convert.ToInt32(ViewState["StaffID"]));
                }
                else
                {
                    ReferrerAdditionalEmailDB.UpdateNotDeleted(referrer_additional_email_id);
                }
            }
            catch (ForeignKeyConstraintException fkcEx)
            {
                SetErrorMessage("Can not delete because other records depend on this" + (Utilities.IsDev() ? " : " + fkcEx.Message : ""));
            }

            FillGrdReferrerAdditionalEmails();
        }
    }
    public static PatientCondition LoadAll(DataRow row)
    {
        PatientCondition patientCondition = Load(row, "patient_condition_");

        patientCondition.Condition            = ConditionDB.Load(row, "condition_");
        patientCondition.Patient              = PatientDB.Load(row, "patient_");
        patientCondition.Patient.Person       = PersonDB.Load(row, "person_", "entity_id");
        patientCondition.Patient.Person.Title = IDandDescrDB.Load(row, "title_title_id", "title_descr");
        return(patientCondition);
    }
示例#14
0
        //Method to call the searchpatient instance from the PatientDB.
        //This method will be attached to the button 'Search' command.
        private void SearchPatient()
        {
            Patients.Clear();
            var search = PatientDB.SearchPatient(SearchInput);

            foreach (var item in search)
            {
                Patients.Add(item);
            }
        }
示例#15
0
    protected void FillGrdReferrerAdditionalEmails()
    {
        try
        {
            GrdReferrerAdditionalEmails.Visible = true;

            Patient patient = PatientDB.GetByID(GetFormPTID());
            lblHeading.Text = "Referrer Additional Emails For " + patient.Person.FullnameWithoutMiddlename;

            DataTable dt = ReferrerAdditionalEmailDB.GetDataTable_ByPatient(patient.PatientID, false);
            dt.DefaultView.Sort = "rae_name ASC";
            dt = dt.DefaultView.ToTable();

            ViewState["referreradditionalemail_data"] = dt;


            if (dt.Rows.Count > 0)
            {
                if (IsPostBack && ViewState["referreradditionalemail_sortexpression"] != null && ViewState["referreradditionalemail_sortexpression"].ToString().Length > 0)
                {
                    DataView dataView = new DataView(dt);
                    dataView.Sort = ViewState["referreradditionalemail_sortexpression"].ToString();
                    GrdReferrerAdditionalEmails.DataSource = dataView;
                }
                else
                {
                    GrdReferrerAdditionalEmails.DataSource = dt;
                }


                GrdReferrerAdditionalEmails.DataBind();
            }
            else
            {
                dt.Rows.Add(dt.NewRow());
                GrdReferrerAdditionalEmails.DataSource = dt;
                GrdReferrerAdditionalEmails.DataBind();

                int TotalColumns = GrdReferrerAdditionalEmails.Rows[0].Cells.Count;
                GrdReferrerAdditionalEmails.Rows[0].Cells.Clear();
                GrdReferrerAdditionalEmails.Rows[0].Cells.Add(new TableCell());
                GrdReferrerAdditionalEmails.Rows[0].Cells[0].ColumnSpan = TotalColumns;
                GrdReferrerAdditionalEmails.Rows[0].Cells[0].Text       = "No Additional Emails Added Yet";
            }
        }
        catch (CustomMessageException ex)
        {
            SetErrorMessage(ex.ToString());
        }
        catch (Exception ex)
        {
            SetErrorMessage("", Utilities.IsDev() ? ex.ToString() : ex.Message);
        }
    }
示例#16
0
    protected void SetupGUI()
    {
        bool isValidFormPatient = IsValidFormPatient();

        if (isValidFormPatient)
        {
            Patient patient = PatientDB.GetByID(GetFormPatient());
            lblSelectedPatientName.Text = "<a href=\"#\" onclick=\"open_new_window('PatientDetailV2.aspx?type=view&id=" + patient.PatientID + "', 1750, 1000);return false;\">" + patient.Person.FullnameWithoutMiddlename + "</a>";
        }

        lblSelectedPatientLabelText.Visible = isValidFormPatient;
        lblSelectedPatientName.Visible      = isValidFormPatient;
        btnClearSelectedPatient.Visible     = isValidFormPatient;



        txtStartDate.Text = GetFormDate().ToString("dd-MM-yyyy");

        for (int i = 1; i <= 8; i++)
        {
            ddlDaysToDisplay.Items.Add(new ListItem(i.ToString(), i.ToString()));
        }

        int ndays = GetFormNumDays();

        if (ndays < 1)
        {
            ndays = 1;
        }
        if (ndays > 8)
        {
            ndays = 8;
        }
        ddlDaysToDisplay.SelectedValue = ndays.ToString();

        if (Convert.ToInt32(ddlDaysToDisplay.SelectedValue) != Convert.ToInt32(Session["NumDaysToDisplayOnBookingScreen"]))
        {
            StaffDB.UpdateNumDaysToDisplayOnBookingScreen(Convert.ToInt32(Session["StaffID"]), Convert.ToInt32(ddlDaysToDisplay.SelectedValue));
            Session["NumDaysToDisplayOnBookingScreen"] = Convert.ToInt32(ddlDaysToDisplay.SelectedValue);
        }

        if (UserView.GetInstance().IsAgedCareView)
        {
            lblGetPatientLabelText.Visible = false;
            txtSearchFullName.Visible      = false;
            btnClearFullNameSearch.Visible = false;

            lblSelectedPatientLabelText.Visible = false;
            lblSelectedPatientName.Visible      = false;
            btnClearSelectedPatient.Visible     = false;

            pt_table_seperator.Style["min-width"] = "0px";
        }
    }
示例#17
0
 private Patient GetFormPatient()
 {
     try
     {
         string id = Request.QueryString["id"];
         return((id == null || !Regex.IsMatch(id, @"^\d+$")) ? null : PatientDB.GetByID(Convert.ToInt32(id)));
     }
     catch (Exception)
     {
         return(null);
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                Utilities.SetNoCache(Response);
            }
            HideErrorMessage();
            Utilities.UpdatePageHeaderV2(Page.Master, true);

            if (!IsPostBack)
            {
                PagePermissions.EnforcePermissions_RequireAny(Session, Response, true, true, true, true, true, true);
                Session.Remove("patientcondition_sortexpression");
                Session.Remove("patientcondition_data");

                Patient patient = PatientDB.GetByID(GetFormPatientID());
                if (patient == null)
                {
                    throw new Exception("Invalid url id");
                }

                lblHeading.Text = "Patient Conditions For<br />" + patient.Person.FullnameWithoutMiddlename;
                FillGrdCondition(patient);
                FillGrdConditionView(patient);
            }

            this.GrdCondition.EnableViewState = true;
        }
        catch (CustomMessageException ex)
        {
            if (IsPostBack)
            {
                SetErrorMessage(ex.Message);
            }
            else
            {
                HideTableAndSetErrorMessage(ex.Message);
            }
        }
        catch (Exception ex)
        {
            if (IsPostBack)
            {
                SetErrorMessage("", ex.ToString());
            }
            else
            {
                HideTableAndSetErrorMessage("", ex.ToString());
            }
        }
    }
示例#19
0
 protected void ResetPatientName()
 {
     if (txtUpdatePatientID.Text.Length == 0)
     {
         txtUpdatePatientName.Text = "";
     }
     else
     {
         Patient patient = PatientDB.GetByID(Convert.ToInt32(txtUpdatePatientID.Text));
         txtUpdatePatientName.Text = patient.Person.FullnameWithoutMiddlename;
     }
 }
    protected void FillGrid()
    {
        int patient_id = IsValidFormPatient() ? GetFormPatient(false) : -1;

        if (patient_id != -1)
        {
            Patient patient = PatientDB.GetByID(patient_id);
            Page.Title              = lblHeading.Text = "B.E.S.T. Letter Print History For ";
            lnkToEntity.Text        = patient.Person.FullnameWithoutMiddlename;
            lnkToEntity.NavigateUrl = "PatientDetailV2.aspx?type=view&id=" + patient.PatientID;
        }


        DataTable dt = LetterBestPrintHistoryDB.GetDataTable(patient_id);

        Session["letterbestprinthistory_data"] = dt;

        if (dt.Rows.Count > 0)
        {
            if (IsPostBack && Session["letterbestprinthistory_sortexpression"] != null && Session["letterbestprinthistory_sortexpression"].ToString().Length > 0)
            {
                DataView dataView = new DataView(dt);
                dataView.Sort = Session["letterbestprinthistory_sortexpression"].ToString();
                GrdLetterPrintHistory.DataSource = dataView;
            }
            else
            {
                GrdLetterPrintHistory.DataSource = dt;
            }


            try
            {
                GrdLetterPrintHistory.DataBind();
            }
            catch (Exception ex)
            {
                HideTableAndSetErrorMessage("", ex.ToString());
            }
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdLetterPrintHistory.DataSource = dt;
            GrdLetterPrintHistory.DataBind();

            int TotalColumns = GrdLetterPrintHistory.Rows[0].Cells.Count;
            GrdLetterPrintHistory.Rows[0].Cells.Clear();
            GrdLetterPrintHistory.Rows[0].Cells.Add(new TableCell());
            GrdLetterPrintHistory.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            GrdLetterPrintHistory.Rows[0].Cells[0].Text       = "No Record Found";
        }
    }
示例#21
0
        //public frmPatient()
        //{
        //    InitializeComponent();
        //    patients = new PatientDB();
        //    state = AddState.NAVIGATE;
        //    Populate(patients.GetCurrentRow());
        //    SetButtonStates(true);
        //}

        public frmPatient(Form frmmain)
        {
            this.parent = frmmain;
            InitializeComponent();
            patients = new PatientDB();
            state    = AddState.NAVIGATE;
            Populate(patients.GetCurrentRow());
            SetButtonStates(true);
            dv = patients.GetDataView();
            listBox1.DataSource    = dv;
            listBox1.ValueMember   = "ID";
            listBox1.DisplayMember = "LastName";
        }
示例#22
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (GetUrlParamType() == UrlParamType.View)
        {
            Response.Redirect(UrlParamModifier.AddEdit(Request.RawUrl, "type", "edit"));
        }
        else if (GetUrlParamType() == UrlParamType.Edit)
        {
            if (!IsValidFormID())
            {
                HideTableAndSetErrorMessage();
                return;
            }

            Patient patient = PatientDB.GetByID(GetFormID());
            if (patient == null)
            {
                HideTableAndSetErrorMessage("Invalid Patient ID");
                return;
            }

            PatientDB.UpdateFlashingText(patient.PatientID, txtFlashingText.Text, Convert.ToInt32(Session["StaffID"]), DateTime.Now);

            //close this window
            Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script language=javascript>window.opener.location.href=window.opener.location.href;self.close();</script>");
        }
        else if (GetUrlParamType() == UrlParamType.Add)
        {
            if (!IsValidFormID())
            {
                HideTableAndSetErrorMessage();
                return;
            }

            Patient patient = PatientDB.GetByID(GetFormID());
            if (patient == null)
            {
                HideTableAndSetErrorMessage("Invalid Patient ID");
                return;
            }

            PatientDB.UpdateFlashingText(patient.PatientID, txtFlashingText.Text, Convert.ToInt32(Session["StaffID"]), DateTime.Now);

            // close this window
            Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "<script language=javascript>window.opener.location.href=window.opener.location.href;self.close();</script>");
        }
        else
        {
            HideTableAndSetErrorMessage("", "Invalid URL Parameters");
        }
    }
示例#23
0
    protected void InsertEmail(bool PT, bool GP)
    {
        if (txtUpdatePatientID.Text.Length == 0)
        {
            SetErrorMessage("No PT Selected");
            return;
        }


        string[] emails  = null;
        string   refName = null;

        Patient patient = PatientDB.GetByID(Convert.ToInt32(txtUpdatePatientID.Text));

        if (PT)
        {
            emails = ContactDB.GetEmailsByEntityID(patient.Person.EntityID);
        }
        else if (GP)
        {
            PatientReferrer[] patRefs = PatientReferrerDB.GetActiveEPCPatientReferrersOf(patient.PatientID);
            if (patRefs.Length > 0)
            {
                refName = patRefs[0].RegisterReferrer.Referrer.Person.FullnameWithoutMiddlename;
                emails  = ContactDB.GetEmailsByEntityID(patRefs[0].RegisterReferrer.Organisation.EntityID);
            }
        }

        if (emails != null && emails.Length > 0)
        {
            txtEmailTo.Text = string.Join(",", emails);
        }
        else
        {
            if (PT)
            {
                SetErrorMessage("No email address set for " + patient.Person.FullnameWithoutMiddlename + "<br />");
            }
            else if (GP && refName == null)
            {
                SetErrorMessage("No referrer set for " + patient.Person.FullnameWithoutMiddlename + "<br />");
            }
            else if (GP)
            {
                SetErrorMessage("No email set for referrer " + refName + "<br />");
            }

            txtEmailTo.Text = string.Empty;
        }
    }
    private static Patient[] _GetPatientsOf(int register_referrer_id, bool onlyActive)
    {
        DataTable tbl = onlyActive ? GetDataTable_ActivePatientsOf(register_referrer_id) : GetDataTable_PatientsOf(register_referrer_id);

        Patient[] list = new Patient[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            Patient patient = PatientDB.Load(tbl.Rows[i]);
            patient.Person       = PersonDB.Load(tbl.Rows[i]);
            patient.Person.Title = IDandDescrDB.Load(tbl.Rows[i], "title_id", "descr");
            list[i] = patient;
        }
        return(list);
    }
示例#25
0
        public void Init()
        {
            dateNaissance = DateTime.Now;
            EntityConnection connection = Effort.EntityConnectionFactory.CreateTransient("name=ReaPlanDBEntities");

            context = new ReaPlanDBEntities(connection);
            //creation d'un patient test dans la fausse BD
            PatientDB patient = PatientDB.CreatePatientDB("pat", "paul", dateNaissance, "M", (decimal)172, (decimal)66, 123, 26);

            context.AddToPatientDBs(patient);
            context.SaveChanges();

            PatientData.conn = connection;
        }
    public static Patient[] GetAllNotInc(RegisterReferrer[] excList)
    {
        DataTable tbl = GetDataTable_AllNotInc(excList);

        Patient[] list = new Patient[tbl.Rows.Count];
        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            list[i]              = PatientDB.Load(tbl.Rows[i]);
            list[i].Person       = PersonDB.Load(tbl.Rows[i]);
            list[i].Person.Title = IDandDescrDB.Load(tbl.Rows[i], "type_id", "descr");
        }

        return(list);
    }
示例#27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            HideErrorMessage();

            if (!IsPostBack)
            {
                if (IsValidFormParams())
                {
                    Tuple <string, int> formParams = GetFormParams(false);

                    Patient patient = PatientDB.GetByID(formParams.Item2, formParams.Item1);
                    if (patient == null)
                    {
                        throw new CustomMessageException("Invalid patient ID");
                    }

                    Patient.UnsubscribeAll(patient.PatientID, formParams.Item1);
                    lblResult.Text = "Apologies for the inconvenience.<br /><br />You are now unsubscribed.";
                }
                else
                {
                    throw new CustomMessageException("Invalid Link");
                }
            }
        }
        catch (CustomMessageException ex)
        {
            if (IsPostBack)
            {
                SetErrorMessage(ex.Message);
            }
            else
            {
                HideTableAndSetErrorMessage(ex.Message);
            }
        }
        catch (Exception ex)
        {
            if (IsPostBack)
            {
                SetErrorMessage("", ex.ToString());
            }
            else
            {
                HideTableAndSetErrorMessage("", ex.ToString());
            }
        }
    }
    protected void btnPatientSelectionUpdate_Click(object sender, EventArgs e)
    {
        int newPatientID = Convert.ToInt32(patientID.Value);

        if (newPatientID == -1)
        {
            lblPatientText.Text = "<b>All Patients</b>";
        }
        else
        {
            Patient patient = PatientDB.GetByID(newPatientID);
            lblPatientText.Text = "<b>" + patient.Person.FullnameWithoutMiddlename + "</b> " + (patient.Person.Dob == DateTime.MinValue ? "" : "[" + patient.Person.Dob.ToString("dd-MM-yyyy") + "]") + "<br />";
        }
    }
示例#29
0
    private void FillEmptyAddForm()
    {
        Patient patient = PatientDB.GetByID(GetFormID());

        if (patient == null)
        {
            HideTableAndSetErrorMessage("Invalid Patient ID");
            return;
        }

        txtFlashingText.Text = patient.FlashingText;

        btnSubmit.Text    = "Add Popup Message";
        btnCancel.Visible = true;
    }
示例#30
0
        public static ExerciceBaseConfig LoadLastConfigPourExercice(string nomExo)
        {
            ExerciceBaseConfig config = LoadExerciceBaseConfig();
            var patientSingleton      = Singleton.getInstance().PatientSingleton;

            using (ReaPlanDBEntities db = new ReaPlanDBEntities())
            {
                PatientDB pat = (from p in db.PatientDBs
                                 where p.Id1 == patientSingleton.ID1 &&
                                 p.Id2 == patientSingleton.ID2 &&
                                 p.DateNaissance == patientSingleton.DateNaiss
                                 select p).FirstOrDefault();
                if (pat != null)
                {
                    JeuDB jeu = (from j in db.JeuDBs
                                 where j.NomJeu == nomExo
                                 select j).FirstOrDefault();

                    if (jeu != null)
                    {
                        ExerciceDB exo = (from e in db.ExerciceDBs
                                          where e.IdPatient == pat.IdPatient &&
                                          e.IdJeu == jeu.IdJeu
                                          orderby e.Date
                                          orderby e.Heure descending
                                          select e).FirstOrDefault();

                        if (exo != null)
                        {
                            ConfigJeuDB conf = (from c in db.ConfigJeuDBs
                                                where c.IdExercice == exo.IdExercice
                                                select c).FirstOrDefault();

                            if (conf != null)
                            {
                                config.Init        = (byte)conf.Initialisation;
                                config.RaideurLat  = (byte)conf.RaideurLat;
                                config.RaideurLong = (byte)conf.RaideurLong;
                                config.Vitesse     = (byte)conf.Vitesse;
                            }
                        }
                    }
                }
                return(config);
            }
        }