コード例 #1
0
ファイル: Documents.cs プロジェクト: luisurbinanet/apolloniax
        ///<summary>Any filenames mentioned in the fileList which are not attached to the given patient are properly attached to that patient. Returns the total number of documents that were newly attached to the patient.</summary>
        public static int InsertMissing(Patient patient, string[] fileList)
        {
            int       countAdded = 0;
            string    command    = "SELECT FileName FROM document WHERE PatNum='" + patient.PatNum + "' ORDER BY FileName";
            DataTable table      = General2.GetTable(command);

            for (int j = 0; j < fileList.Length; j++)
            {
                if (!IsAcceptableFileName(fileList[j]))
                {
                    continue;
                }
                bool inList = false;
                for (int i = 0; i < table.Rows.Count && !inList; i++)
                {
                    inList = (table.Rows[i]["FileName"].ToString() == fileList[j]);
                }
                if (!inList)
                {
                    Document doc = new Document();
                    doc.DateCreated = DateTime.Today;
                    doc.Description = fileList[j];
                    doc.DocCategory = DefB.Short[(int)DefCat.ImageCats][0].DefNum;                  //First category.
                    doc.FileName    = fileList[j];
                    doc.PatNum      = patient.PatNum;
                    Insert(doc, patient);
                    countAdded++;
                }
            }
            return(countAdded);
        }
コード例 #2
0
ファイル: Documents.cs プロジェクト: luisurbinanet/apolloniax
        ///<summary>Gets the document with the specified document number.</summary>
        public static Document GetByNum(int docNum)
        {
            string    command = "SELECT * FROM document WHERE DocNum='" + docNum + "'";
            DataTable table   = General2.GetTable(command);

            if (table.Rows.Count < 1)
            {
                return(new Document());
            }
            return(Fill(table.Rows[0]));
        }
コード例 #3
0
ファイル: Mounts.cs プロジェクト: luisurbinanet/apolloniax
        ///<summary>Returns a single mount object corresponding to the given mount number key.</summary>
        public static Mount GetByNum(int mountNum)
        {
            string    command = "SELECT * FROM mount WHERE MountNum='" + mountNum + "'";
            DataTable table   = General2.GetTable(command);

            if (table.Rows.Count < 0)
            {
                return(new Mount());
            }
            return(Fill(table.Rows[0]));
        }
コード例 #4
0
        ///<summary>Returns the list of mount items associated with the given mount key.</summary>
        public static MountItem[] GetItemsForMount(int mountNum)
        {
            string    command = "SELECT * FROM mountitem WHERE MountNum='" + POut.PInt(mountNum) + "' ORDER BY OrdinalPos";
            DataTable result  = General2.GetTable(command);

            MountItem[] mountItems = new MountItem[result.Rows.Count];
            for (int i = 0; i < mountItems.Length; i++)
            {
                mountItems[i] = Fill(result.Rows[i]);
            }
            return(mountItems);
        }
コード例 #5
0
        ///<summary>Gets a list of all MountItemDefs when program first opens.</summary>
        public static void Refresh()
        {
            string    command = "SELECT * FROM mountitemdef";
            DataTable table   = General2.GetTable(command);

            Listt = new List <MountItemDef>();
            MountItemDef mount;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                mount = new MountItemDef();
                mount.MountItemDefNum = PIn.PInt(table.Rows[i][0].ToString());
                mount.MountDefNum     = PIn.PInt(table.Rows[i][1].ToString());
                mount.Xpos            = PIn.PInt(table.Rows[i][2].ToString());
                mount.Ypos            = PIn.PInt(table.Rows[i][3].ToString());
                mount.Width           = PIn.PInt(table.Rows[i][4].ToString());
                mount.Height          = PIn.PInt(table.Rows[i][5].ToString());
                Listt.Add(mount);
            }
        }
コード例 #6
0
        ///<summary>Gets a list of all MountDefs when program first opens.  Also refreshes MountItemDefs and attaches all items to the appropriate mounts.</summary>
        public static void Refresh()
        {
            MountItemDefs.Refresh();
            string    command = "SELECT * FROM mountdef ORDER BY ItemOrder";
            DataTable table   = General2.GetTable(command);

            Listt = new List <MountDef>();
            MountDef mount;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                mount              = new MountDef();
                mount.MountDefNum  = PIn.PInt(table.Rows[i][0].ToString());
                mount.Description  = PIn.PString(table.Rows[i][1].ToString());
                mount.ItemOrder    = PIn.PInt(table.Rows[i][2].ToString());
                mount.IsRadiograph = PIn.PBool(table.Rows[i][3].ToString());
                mount.Width        = PIn.PInt(table.Rows[i][4].ToString());
                mount.Height       = PIn.PInt(table.Rows[i][5].ToString());
                Listt.Add(mount);
            }
        }
コード例 #7
0
ファイル: Documents.cs プロジェクト: luisurbinanet/apolloniax
        ///<summary>This is used by FormImageViewer to get a list of paths based on supplied list of DocNums. The reason is that later we will allow sharing of documents, so the paths may not be in the current patient folder.</summary>
        public static ArrayList GetPaths(ArrayList docNums)
        {
            if (docNums.Count == 0)
            {
                return(new ArrayList());
            }
            string command = "SELECT document.DocNum,document.FileName,patient.ImageFolder "
                             + "FROM document "
                             + "LEFT JOIN patient ON patient.PatNum=document.PatNum "
                             + "WHERE document.DocNum = '" + docNums[0].ToString() + "'";

            for (int i = 1; i < docNums.Count; i++)
            {
                command += " OR document.DocNum = '" + docNums[i].ToString() + "'";
            }
            //remember, they will not be in the correct order.
            DataTable table = General2.GetTable(command);
            Hashtable hList = new Hashtable();          //key=docNum, value=path

            //one row for each document, but in the wrong order
            for (int i = 0; i < table.Rows.Count; i++)
            {
                //We do not need to check if A to Z folders are being used here, because
                //thumbnails are not visible from the chart module when A to Z are disabled,
                //making it impossible to launch the form image viewer (the only place this
                //function is called from.
                hList.Add(PIn.PInt(table.Rows[i][0].ToString()),
                          ODFileUtils.CombinePaths(new string[] { FileStoreSettings.GetPreferredImagePath,
                                                                  PIn.PString(table.Rows[i][2].ToString()).Substring(0, 1).ToUpper(),
                                                                  PIn.PString(table.Rows[i][2].ToString()),
                                                                  PIn.PString(table.Rows[i][1].ToString()), }));
            }
            ArrayList retVal = new ArrayList();

            for (int i = 0; i < docNums.Count; i++)
            {
                retVal.Add((string)hList[(int)docNums[i]]);
            }
            return(retVal);
        }
コード例 #8
0
ファイル: Documents.cs プロジェクト: luisurbinanet/apolloniax
 ///<summary>Returns the documents which correspond to the given mountitems.</summary>
 public static Document[] GetDocumentsForMountItems(MountItem[] mountItems)
 {
     if (mountItems == null || mountItems.Length < 1)
     {
         return(new Document[0]);
     }
     Document[] documents = new Document[mountItems.Length];
     for (int i = 0; i < mountItems.Length; i++)
     {
         string    command = "SELECT * FROM document WHERE MountItemNum='" + POut.PInt(mountItems[i].MountItemNum) + "'";
         DataTable table   = General2.GetTable(command);
         if (table.Rows.Count < 1)
         {
             documents[i] = null;
         }
         else
         {
             documents[i] = Fill(table)[0];
         }
     }
     return(documents);
 }
コード例 #9
0
ファイル: Documents.cs プロジェクト: luisurbinanet/apolloniax
 private static Document[] RefreshAndFill(string command)
 {
     return(Fill(General2.GetTable(command)));
 }