Exemplo n.º 1
0
        protected void BuildErectileFunction()
        {
            SurveyDa sDa = new SurveyDa();

            DataSet sDs = sDa.FormGetSurveyErectileFunction(this._patientId);

            if (sDs != null && sDs.Tables.Count > 0 && sDs.Tables[0].Rows.Count > 0)
            {
                // fill in blank rows for medications when they are not populated only because the prescription hasn't changed
                for (int j = 1; j < sDs.Tables[0].Rows.Count; j++)
                {
                    try
                    {
                        // oral meds
                        if (sDs.Tables[0].Rows[j]["Oral Agent"] != null &&
                            sDs.Tables[0].Rows[j]["Oral Agent"].ToString().Length < 1 &&
                            sDs.Tables[0].Rows[j]["Oral Dose"].ToString().Length < 1 &&
                            sDs.Tables[0].Rows[j]["Date"].ToString().Length > 1 &&
                            sDs.Tables[0].Rows[j - 1]["Date"].ToString().Length > 1 &&
                            sDs.Tables[0].Rows[j - 1]["Oral Agent"].ToString().Length > 0 &&
                            (sDs.Tables[0].Rows[j - 1]["Oral Agent Stop Date"].ToString().Length <1 ||
                                                                                                  Convert.ToDateTime(sDs.Tables[0].Rows[j - 1]["Oral Agent Stop Date"].ToString())> DateTime.Now ||
                             Convert.ToDateTime(sDs.Tables[0].Rows[j - 1]["Oral Agent Stop Date"].ToString()) > Convert.ToDateTime(sDs.Tables[0].Rows[j]["Date"].ToString()))

                            )
                        {
                            sDs.Tables[0].Rows[j]["Oral Agent"] = sDs.Tables[0].Rows[j - 1]["Oral Agent"];
                            sDs.Tables[0].Rows[j]["Oral Dose"]  = sDs.Tables[0].Rows[j - 1]["Oral Dose"];
                        }
                    }
                    catch { }

                    try
                    {
                        // ICI meds
                        if (sDs.Tables[0].Rows[j]["ICI Agent"] != null &&
                            sDs.Tables[0].Rows[j]["ICI Agent"].ToString().Length < 1 &&
                            sDs.Tables[0].Rows[j]["ICI Dose"].ToString().Length < 1 &&
                            sDs.Tables[0].Rows[j]["Date"].ToString().Length > 1 &&
                            sDs.Tables[0].Rows[j - 1]["Date"].ToString().Length > 1 &&
                            sDs.Tables[0].Rows[j - 1]["ICI Agent"].ToString().Length > 0 &&
                            (sDs.Tables[0].Rows[j - 1]["ICI Stop Date"].ToString().Length <1 ||
                                                                                           Convert.ToDateTime(sDs.Tables[0].Rows[j - 1]["ICI Stop Date"].ToString())> DateTime.Now ||
                             Convert.ToDateTime(sDs.Tables[0].Rows[j - 1]["ICI Stop Date"].ToString()) > Convert.ToDateTime(sDs.Tables[0].Rows[j]["Date"].ToString()))

                            )
                        {
                            sDs.Tables[0].Rows[j]["ICI Agent"] = sDs.Tables[0].Rows[j - 1]["ICI Agent"];
                            sDs.Tables[0].Rows[j]["ICI Dose"]  = sDs.Tables[0].Rows[j - 1]["ICI Dose"];
                        }
                    }
                    catch { }
                }
                // original way
                erectileFunction.DataSource = sDs.Tables[0].DefaultView;
            }
            erectileFunction.DataBind();
        }
Exemplo n.º 2
0
        protected void BuildErectileFunction(int minNumRowsToShow, int minNumBlankRows)
        {
            if (patientID != 0)
            {
                SurveyDa sDa = new SurveyDa();

                DataSet sDs = sDa.FormGetSurveyErectileFunction(this.patientID);
                if (sDs != null && sDs.Tables.Count > 0 && sDs.Tables[0].Rows.Count > 0)
                {
                    // fill in blank rows for medications when they are not populated only because the prescription hasn't changed
                    for (int j = 1; j < sDs.Tables[0].Rows.Count; j++)
                    {
                        try
                        {
                            // oral meds
                            if (sDs.Tables[0].Rows[j]["Oral Agent"] != null &&
                                sDs.Tables[0].Rows[j]["Oral Agent"].ToString().Length < 1 &&
                                sDs.Tables[0].Rows[j]["Oral Dose"].ToString().Length < 1 &&
                                sDs.Tables[0].Rows[j]["Date"].ToString().Length > 1 &&
                                sDs.Tables[0].Rows[j - 1]["Date"].ToString().Length > 1 &&
                                sDs.Tables[0].Rows[j - 1]["Oral Agent"].ToString().Length > 0 &&
                                (sDs.Tables[0].Rows[j - 1]["Oral Agent Stop Date"].ToString().Length <1 ||
                                                                                                      Convert.ToDateTime(sDs.Tables[0].Rows[j - 1]["Oral Agent Stop Date"].ToString())> DateTime.Now ||
                                 Convert.ToDateTime(sDs.Tables[0].Rows[j - 1]["Oral Agent Stop Date"].ToString()) > Convert.ToDateTime(sDs.Tables[0].Rows[j]["Date"].ToString()))

                                )
                            {
                                sDs.Tables[0].Rows[j]["Oral Agent"]           = sDs.Tables[0].Rows[j - 1]["Oral Agent"];
                                sDs.Tables[0].Rows[j]["Oral Dose"]            = sDs.Tables[0].Rows[j - 1]["Oral Dose"];
                                sDs.Tables[0].Rows[j]["Oral Agent Stop Date"] = sDs.Tables[0].Rows[j - 1]["Oral Agent Stop Date"];
                            }
                        }
                        catch { }

                        try
                        {
                            // ICI meds
                            if (sDs.Tables[0].Rows[j]["ICI Agent"] != null &&
                                sDs.Tables[0].Rows[j]["ICI Agent"].ToString().Length < 1 &&
                                sDs.Tables[0].Rows[j]["ICI Dose"].ToString().Length < 1 &&
                                sDs.Tables[0].Rows[j]["Date"].ToString().Length > 1 &&
                                sDs.Tables[0].Rows[j - 1]["Date"].ToString().Length > 1 &&
                                sDs.Tables[0].Rows[j - 1]["ICI Agent"].ToString().Length > 0 &&
                                (sDs.Tables[0].Rows[j - 1]["ICI Stop Date"].ToString().Length <1 ||
                                                                                               Convert.ToDateTime(sDs.Tables[0].Rows[j - 1]["ICI Stop Date"].ToString())> DateTime.Now ||
                                 Convert.ToDateTime(sDs.Tables[0].Rows[j - 1]["ICI Stop Date"].ToString()) > Convert.ToDateTime(sDs.Tables[0].Rows[j]["Date"].ToString()))

                                )
                            {
                                sDs.Tables[0].Rows[j]["ICI Agent"]     = sDs.Tables[0].Rows[j - 1]["ICI Agent"];
                                sDs.Tables[0].Rows[j]["ICI Dose"]      = sDs.Tables[0].Rows[j - 1]["ICI Dose"];
                                sDs.Tables[0].Rows[j]["ICI Stop Date"] = sDs.Tables[0].Rows[j - 1]["ICI Stop Date"];
                            }
                        }
                        catch { }
                    }



                    // original way
                    int numBlankRows = minNumRowsToShow - sDs.Tables[0].Rows.Count;

                    if (numBlankRows < minNumBlankRows)
                    {
                        numBlankRows = minNumBlankRows;
                    }

                    for (int i = 0; i < numBlankRows; i++)
                    {
                        DataRow blankRow = sDs.Tables[0].NewRow();
                        sDs.Tables[0].Rows.Add(blankRow);
                    }
                    erectileFunction.DataSource = sDs.Tables[0].DefaultView;



                    /* with filter
                     * DataView sDv = sDs.Tables[0].DefaultView;
                     * string filterExpression = "(Len([Duration Post TX]) > 0) OR (Len([Spontaneous Erectile Function %]) > 0)";
                     * sDv.RowFilter = filterExpression;
                     *
                     * DataTable newDt = sDv.ToTable();
                     *
                     *
                     *
                     * int numBlankRows = minNumRowsToShow - newDt.Rows.Count;
                     *
                     * if (numBlankRows < minNumBlankRows)
                     * {
                     *  numBlankRows = minNumBlankRows;
                     * }
                     *
                     * for (int i = 0; i < numBlankRows; i++)
                     * {
                     *  DataRow blankRow = newDt.NewRow();
                     *  newDt.Rows.Add(blankRow);
                     * }
                     * erectileFunction.DataSource = newDt.DefaultView;
                     */
                }
                else
                {
                    erectileFunction.DataSource = BlankErectileFunction(minNumRowsToShow).DefaultView;
                }
            }
            else
            {
                erectileFunction.DataSource = BlankErectileFunction(minNumRowsToShow).DefaultView;
            }

            try
            {
                erectileFunction.DataBind();
            }
            catch
            {
                erectileFunction.DataSource = BlankErectileFunction(minNumRowsToShow).DefaultView;
                erectileFunction.DataBind();
            }
        }