Esempio n. 1
0
        public static DataTable RefreshOneStudent(long provNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetTable(MethodBase.GetCurrentMethod(), provNum));
            }
            DataTable table = new DataTable();
            DataRow   row;

            //columns that start with lowercase are altered for display rather than being raw data.
            table.Columns.Add("appointment");
            table.Columns.Add("course");
            table.Columns.Add("done");
            table.Columns.Add("patient");
            table.Columns.Add("ReqStudentNum");
            table.Columns.Add("requirement");
            string command = "SELECT AptDateTime,CourseID,reqstudent.Descript ReqDescript,"
                             + "schoolcourse.Descript CourseDescript,reqstudent.DateCompleted, "
                             + "patient.LName,patient.FName,patient.MiddleI,patient.Preferred,ProcDescript,reqstudent.ReqStudentNum "
                             + "FROM reqstudent "
                             + "LEFT JOIN schoolcourse ON reqstudent.SchoolCourseNum=schoolcourse.SchoolCourseNum "
                             + "LEFT JOIN patient ON reqstudent.PatNum=patient.PatNum "
                             + "LEFT JOIN appointment ON reqstudent.AptNum=appointment.AptNum "
                             + "WHERE reqstudent.ProvNum=" + POut.Long(provNum)
                             + " ORDER BY CourseID,ReqDescript";
            DataTable raw = Db.GetTable(command);
            DateTime  AptDateTime;
            DateTime  dateCompleted;

            for (int i = 0; i < raw.Rows.Count; i++)
            {
                row         = table.NewRow();
                AptDateTime = PIn.DateT(raw.Rows[i]["AptDateTime"].ToString());
                if (AptDateTime.Year > 1880)
                {
                    row["appointment"] = AptDateTime.ToShortDateString() + " " + AptDateTime.ToShortTimeString()
                                         + " " + raw.Rows[i]["ProcDescript"].ToString();
                }
                row["course"] = raw.Rows[i]["CourseID"].ToString();              //+" "+raw.Rows[i]["CourseDescript"].ToString();
                dateCompleted = PIn.Date(raw.Rows[i]["DateCompleted"].ToString());
                if (dateCompleted.Year > 1880)
                {
                    row["done"] = "X";
                }
                row["patient"] = PatientLogic.GetNameLF(raw.Rows[i]["LName"].ToString(), raw.Rows[i]["FName"].ToString(),
                                                        raw.Rows[i]["Preferred"].ToString(), raw.Rows[i]["MiddleI"].ToString());
                row["ReqStudentNum"] = raw.Rows[i]["ReqStudentNum"].ToString();
                row["requirement"]   = raw.Rows[i]["ReqDescript"].ToString();
                table.Rows.Add(row);
            }
            return(table);
        }
Esempio n. 2
0
        ///<summary>Gets a filtered list of all labcases.</summary>
        public static DataTable Refresh(DateTime aptStartDate, DateTime aptEndDate, bool showCompleted, bool ShowUnattached)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetTable(MethodBase.GetCurrentMethod(), aptStartDate, aptEndDate, showCompleted, ShowUnattached));
            }
            DataTable table = new DataTable();
            DataRow   row;

            //columns that start with lowercase are altered for display rather than being raw data.
            table.Columns.Add("AptDateTime", typeof(DateTime));
            table.Columns.Add("aptDateTime");
            table.Columns.Add("AptNum");
            table.Columns.Add("OpNum");
            table.Columns.Add("lab");
            table.Columns.Add("LabCaseNum");
            table.Columns.Add("patient");
            table.Columns.Add("phone");
            table.Columns.Add("ProcDescript");
            table.Columns.Add("status");
            table.Columns.Add("Instructions");
            List <DataRow> rows = new List <DataRow>();
            //the first query only gets labcases that are attached to scheduled appointments
            string command = "SELECT AptDateTime,appointment.AptNum,appointment.Op,DateTimeChecked,DateTimeRecd,DateTimeSent,"
                             + "LabCaseNum,laboratory.Description,LName,FName,Preferred,MiddleI,Phone,ProcDescript,Instructions "
                             + "FROM labcase "
                             + "LEFT JOIN appointment ON labcase.AptNum=appointment.AptNum "
                             + "LEFT JOIN patient ON labcase.PatNum=patient.PatNum "
                             + "LEFT JOIN laboratory ON labcase.LaboratoryNum=laboratory.LaboratoryNum "
                             + "WHERE AptDateTime > " + POut.Date(aptStartDate) + " "
                             + "AND AptDateTime < " + POut.Date(aptEndDate.AddDays(1)) + " ";

            if (!showCompleted)
            {
                command += " AND (AptStatus=" + POut.Long((int)ApptStatus.Broken)
                           + " OR AptStatus=" + POut.Long((int)ApptStatus.None)
                           + " OR AptStatus=" + POut.Long((int)ApptStatus.Scheduled)
                           + " OR AptStatus=" + POut.Long((int)ApptStatus.UnschedList) + ") ";
            }
            DataTable raw = Db.GetTable(command);
            DateTime  AptDateTime;
            DateTime  date;

            for (int i = 0; i < raw.Rows.Count; i++)
            {
                row                = table.NewRow();
                AptDateTime        = PIn.DateT(raw.Rows[i]["AptDateTime"].ToString());
                row["AptDateTime"] = AptDateTime;
                row["aptDateTime"] = AptDateTime.ToShortDateString() + " " + AptDateTime.ToShortTimeString();
                row["AptNum"]      = raw.Rows[i]["AptNum"].ToString();
                row["OpNum"]       = raw.Rows[i]["Op"].ToString();
                row["lab"]         = raw.Rows[i]["Description"].ToString();
                row["LabCaseNum"]  = raw.Rows[i]["LabCaseNum"].ToString();
                row["patient"]     = PatientLogic.GetNameLF(raw.Rows[i]["LName"].ToString(), raw.Rows[i]["FName"].ToString(),
                                                            raw.Rows[i]["Preferred"].ToString(), raw.Rows[i]["MiddleI"].ToString());
                row["phone"]        = raw.Rows[i]["Phone"].ToString();
                row["ProcDescript"] = raw.Rows[i]["ProcDescript"].ToString();
                row["Instructions"] = raw.Rows[i]["Instructions"].ToString();
                date = PIn.DateT(raw.Rows[i]["DateTimeChecked"].ToString());
                if (date.Year > 1880)
                {
                    row["status"] = Lans.g("FormLabCases", "Quality Checked");
                }
                else
                {
                    date = PIn.DateT(raw.Rows[i]["DateTimeRecd"].ToString());
                    if (date.Year > 1880)
                    {
                        row["status"] = Lans.g("FormLabCases", "Received");
                    }
                    else
                    {
                        date = PIn.DateT(raw.Rows[i]["DateTimeSent"].ToString());
                        if (date.Year > 1880)
                        {
                            row["status"] = Lans.g("FormLabCases", "Sent");                         //sent but not received
                        }
                        else
                        {
                            row["status"] = Lans.g("FormLabCases", "Not Sent");
                        }
                    }
                }
                rows.Add(row);
            }
            if (ShowUnattached)
            {
                //Then, this second query gets labcases not attached to appointments.  No date filter.  No date displayed.
                command = "SELECT DateTimeChecked,DateTimeRecd,DateTimeSent,"
                          + "LabCaseNum,laboratory.Description,LName,FName,Preferred,MiddleI,Phone,Instructions "
                          + "FROM labcase "
                          + "LEFT JOIN patient ON labcase.PatNum=patient.PatNum "
                          + "LEFT JOIN laboratory ON labcase.LaboratoryNum=laboratory.LaboratoryNum "
                          + "WHERE AptNum=0";
                raw = Db.GetTable(command);
                for (int i = 0; i < raw.Rows.Count; i++)
                {
                    row = table.NewRow();
                    row["AptDateTime"] = DateTime.MinValue;
                    row["aptDateTime"] = "";
                    row["AptNum"]      = 0;
                    row["lab"]         = raw.Rows[i]["Description"].ToString();
                    row["LabCaseNum"]  = raw.Rows[i]["LabCaseNum"].ToString();
                    row["patient"]     = PatientLogic.GetNameLF(raw.Rows[i]["LName"].ToString(), raw.Rows[i]["FName"].ToString(),
                                                                raw.Rows[i]["Preferred"].ToString(), raw.Rows[i]["MiddleI"].ToString());
                    row["phone"]        = raw.Rows[i]["Phone"].ToString();
                    row["ProcDescript"] = "";
                    row["status"]       = "";
                    row["Instructions"] = raw.Rows[i]["Instructions"].ToString();
                    date = PIn.DateT(raw.Rows[i]["DateTimeChecked"].ToString());
                    if (date.Year > 1880)
                    {
                        row["status"] = Lans.g("FormLabCases", "Quality Checked");
                    }
                    else
                    {
                        date = PIn.DateT(raw.Rows[i]["DateTimeRecd"].ToString());
                        if (date.Year > 1880)
                        {
                            row["status"] = Lans.g("FormLabCases", "Received");
                        }
                        else
                        {
                            date = PIn.DateT(raw.Rows[i]["DateTimeSent"].ToString());
                            if (date.Year > 1880)
                            {
                                row["status"] = Lans.g("FormLabCases", "Sent");                             //sent but not received
                            }
                            else
                            {
                                row["status"] = Lans.g("FormLabCases", "Not Sent");
                            }
                        }
                    }
                    rows.Add(row);
                }
            }
            LabCaseComparer comparer = new LabCaseComparer();

            rows.Sort(comparer);
            for (int i = 0; i < rows.Count; i++)
            {
                table.Rows.Add(rows[i]);
            }
            return(table);
        }
Esempio n. 3
0
        ///<summary>Gets a filtered list of all labcases.</summary>
        public static DataTable Refresh(DateTime aptStartDate, DateTime aptEndDate)
        {
            DataTable table = new DataTable();
            DataRow   row;

            //columns that start with lowercase are altered for display rather than being raw data.
            table.Columns.Add("aptDateTime");
            table.Columns.Add("lab");
            table.Columns.Add("LabCaseNum");
            table.Columns.Add("patient");
            table.Columns.Add("phone");
            table.Columns.Add("ProcDescript");
            table.Columns.Add("status");
            string command = "SELECT AptDateTime,DateTimeChecked,DateTimeRecd,DateTimeSent,"
                             + "LabCaseNum,laboratory.Description,LName,FName,Preferred,MiddleI,Phone,ProcDescript "
                             + "FROM labcase,appointment,patient,laboratory "
                             + "WHERE labcase.AptNum=appointment.AptNum "
                             + "AND labcase.PatNum=patient.PatNum "
                             + "AND labcase.LaboratoryNum=laboratory.LaboratoryNum "
                             + "AND AptDateTime > " + POut.PDate(aptStartDate) + " "
                             + "AND AptDateTime < " + POut.PDate(aptEndDate.AddDays(1)) + " "
                             + "ORDER BY AptDateTime";
            DataTable raw = General.GetTable(command);
            DateTime  AptDateTime;
            DateTime  date;

            for (int i = 0; i < raw.Rows.Count; i++)
            {
                row                = table.NewRow();
                AptDateTime        = PIn.PDateT(raw.Rows[i]["AptDateTime"].ToString());
                row["aptDateTime"] = AptDateTime.ToShortDateString() + " " + AptDateTime.ToShortTimeString();
                row["lab"]         = raw.Rows[i]["Description"].ToString();
                row["LabCaseNum"]  = raw.Rows[i]["LabCaseNum"].ToString();
                row["patient"]     = PatientB.GetNameLF(raw.Rows[i]["LName"].ToString(), raw.Rows[i]["FName"].ToString(),
                                                        raw.Rows[i]["Preferred"].ToString(), raw.Rows[i]["MiddleI"].ToString());
                row["phone"]        = raw.Rows[i]["Phone"].ToString();
                row["ProcDescript"] = raw.Rows[i]["ProcDescript"].ToString();
                date = PIn.PDateT(raw.Rows[i]["DateTimeChecked"].ToString());
                if (date.Year > 1880)
                {
                    row["status"] = Lan.g("FormLabCases", "Quality Checked");
                }
                else
                {
                    date = PIn.PDateT(raw.Rows[i]["DateTimeRecd"].ToString());
                    if (date.Year > 1880)
                    {
                        row["status"] = Lan.g("FormLabCases", "Received");
                    }
                    else
                    {
                        date = PIn.PDateT(raw.Rows[i]["DateTimeSent"].ToString());
                        if (date.Year > 1880)
                        {
                            row["status"] = Lan.g("FormLabCases", "Sent");                         //sent but not received
                        }
                        else
                        {
                            row["status"] = Lan.g("FormLabCases", "Not Sent");
                        }
                    }
                }
                table.Rows.Add(row);
            }
            return(table);
        }