Exemplo n.º 1
0
        public static IEnumerable <ShowBase> GetReportInfos(DateTime filterDate)
        {
            using (OleDbConnection conn = CreateConnection(GlobalConfigVars.DbPath))
            {
                using (var cmd = new OleDbCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandText = "select * from Scan where CreateDate >= @date1 and CreateDate < @date2";
                    cmd.Parameters.AddWithValue("@date1", filterDate.Date);
                    cmd.Parameters.AddWithValue("@date2", filterDate.AddDays(1).Date);

                    // test to fetch all record
                    //cmd.CommandText = "select * from Scan";

                    if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }

                    var reader = cmd.ExecuteReader();

                    using (reader)
                    {
                        while (reader.Read())
                        {
                            ScanResult result = new ScanResult();
                            result.ScanIdNr        = reader.GetInt32(0);
                            result.DemographicIdNr = reader.GetInt32(3);
                            result.GelName         = reader.GetString(reader.GetOrdinal("GelName"));
                            result.GelType         = reader.GetString(reader.GetOrdinal("GelType"));
                            result.IFE             = 1 == reader.GetByte(reader.GetOrdinal("IFE"));
                            result.Edited          = 1 == reader.GetByte(reader.GetOrdinal("Edited"));
                            result.Viewed          = 1 == reader.GetByte(reader.GetOrdinal("Viewed"));
                            result.MeasTime        = reader.GetDateTime(reader.GetOrdinal("MeasTime"));
                            result.NumData         = reader.GetInt32(reader.GetOrdinal("NumData"));
                            result.BaseLeft        = reader.GetFloat(reader.GetOrdinal("BaseLeft"));
                            result.BaseRight       = reader.GetFloat(reader.GetOrdinal("BaseRight"));
                            if (!result.IFE)
                            {
                                if (reader[reader.GetOrdinal("Scan")] != DBNull.Value)
                                {
                                    result.Scan = (byte[])reader[reader.GetOrdinal("Scan")];
                                }
                                // SaveToFile((byte[])reader[reader.GetOrdinal("Scan")]);
                            }
                            if (reader[reader.GetOrdinal("DIB")] != DBNull.Value)
                            {
                                result.DIB = (byte[])reader[reader.GetOrdinal("DIB")];
                            }
                            result.CreateDate = reader.GetDateTime(reader.GetOrdinal("CreateDate"));
                            result.UpdateDate = reader.GetDateTime(reader.GetOrdinal("UpdateDate"));
                            result.Operator   = reader.GetString(reader.GetOrdinal("Operator"));

                            // Patient
                            result.Patient = GetDemographicById(result.DemographicIdNr);
                            yield return((ShowBase)result);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static IEnumerable<ShowBase> GetReportInfos(DateTime filterDate)
        {
            using (OleDbConnection conn = CreateConnection(GlobalConfigVars.DbPath))
            {
                using (var cmd = new OleDbCommand())
                {
                    cmd.Connection = conn;
                    cmd.CommandText = "select * from Scan where CreateDate >= @date1 and CreateDate < @date2";
                    cmd.Parameters.AddWithValue("@date1", filterDate.Date);
                    cmd.Parameters.AddWithValue("@date2", filterDate.AddDays(1).Date);

                    // test to fetch all record
                    //cmd.CommandText = "select * from Scan";

                    if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }

                    var reader = cmd.ExecuteReader();

                    using (reader)
                    {
                        while (reader.Read())
                        {
                            ScanResult result = new ScanResult();
                            result.ScanIdNr = reader.GetInt32(0);
                            result.DemographicIdNr = reader.GetInt32(3);
                            result.GelName = reader.GetString(reader.GetOrdinal("GelName"));
                            result.GelType = reader.GetString(reader.GetOrdinal("GelType"));
                            result.IFE = 1==reader.GetByte(reader.GetOrdinal("IFE"));
                            result.Edited = 1==reader.GetByte(reader.GetOrdinal("Edited"));
                            result.Viewed = 1 == reader.GetByte(reader.GetOrdinal("Viewed"));
                            result.MeasTime = reader.GetDateTime(reader.GetOrdinal("MeasTime"));
                            result.NumData = reader.GetInt32(reader.GetOrdinal("NumData"));    
                            result.BaseLeft = reader.GetFloat(reader.GetOrdinal("BaseLeft"));
                            result.BaseRight = reader.GetFloat(reader.GetOrdinal("BaseRight"));
                            if (!result.IFE)
                            {
                                if (reader[reader.GetOrdinal("Scan")] != DBNull.Value)
                                {
                                    result.Scan = (byte[]) reader[reader.GetOrdinal("Scan")];
                                }
                                // SaveToFile((byte[])reader[reader.GetOrdinal("Scan")]);
                            }
                            if (reader[reader.GetOrdinal("DIB")] != DBNull.Value)
                            {
                                result.DIB = (byte[])reader[reader.GetOrdinal("DIB")];
                            }
                            result.CreateDate = reader.GetDateTime(reader.GetOrdinal("CreateDate"));
                            result.UpdateDate = reader.GetDateTime(reader.GetOrdinal("UpdateDate"));
                            result.Operator = reader.GetString(reader.GetOrdinal("Operator"));

                            // Patient
                            result.Patient = GetDemographicById(result.DemographicIdNr);
                            yield return (ShowBase)result;
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public PlatinumState(ScanResult scan)
        {
            this.Scan = scan;

            if (!this.Scan.IFE)
            {
                this.Result = new CalResult(this.Scan.ScanIdNr, this.Scan.NumData, this.Scan.Scan, this.Scan.BaseLeft, this.Scan.BaseRight);
            }
        }