Ejemplo n.º 1
0
        public bool IsPatientInDataSet(int patientId, int datasetId)
        {
            string datasetSql = CacheManager.GetDatasetSQL(datasetId);

            DataTable dt = new DataTable();

            dt = _pda.GetPatientById(patientId, datasetSql);

            if (dt.Rows.Count == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        //protected Hashtable TimeSpanByYearsMonthsDays(DateTime FirstDate, DateTime SecondDate)
        //{
        //    Hashtable span = new Hashtable();
        //    span.Add("Years", 0);
        //    span.Add("Months", 0);
        //    span.Add("Days", 0);

        //    int diff = (SecondDate - FirstDate).Days;
        //    if (diff > 365)
        //    {
        //        int years = (int)(Math.Floor(diff / 365.25));
        //        int extraMonthDays = (int)(Math.Floor(diff % (365.25)));
        //        int months = (int)(Math.Floor(extraMonthDays / (365.25 / 12)));
        //        int extraDays = (int)(Math.Round(extraMonthDays % (365.25 / 12)));

        //        span["Years"] = years;
        //        span["Months"] = months;
        //        span["Days"] = extraDays;
        //    }
        //    else if (diff > 30)
        //    {
        //        int months = (int)(Math.Floor(diff / (365.25 / 12)));
        //        int extraDays = (int)(Math.Round(diff % (365.25 / 12)));
        //        span["Months"] = months;
        //        span["Days"] = extraDays;
        //    }
        //    else
        //    {
        //        span["Days"] = diff.ToString() + " days";
        //    }

        //    return span;
        //}


        protected int?PatientAge(int PatientId)
        {
            int?age = null;

            string    datasetSQL = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]);
            PatientDa p          = new PatientDa();
            DataTable pt         = p.GetPatientById(PatientId, datasetSQL);

            if (pt.Rows.Count == 1 && pt.Rows[0][BOL.Patient.PtBirthDateText].ToString().Length > 0)
            {
                DateTime dob = new DateTime();
                if (DateTime.TryParse(pt.Rows[0][BOL.Patient.PtBirthDateText].ToString(), out dob))
                {
                    int diff = (DateTime.Now - dob).Days;
                    age = (int)(Math.Floor(diff / 365.2422));
                }
            }
            return(age);
        }