Пример #1
0
        ///<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
        ///<summary></summary>
        public static void Delete(Document doc)
        {
            string command = "DELETE from document WHERE DocNum = '" + doc.DocNum.ToString() + "'";

            General2.NonQ(command);
            command = "DELETE from docattach WHERE DocNum = '" + doc.DocNum.ToString() + "'";
            General2.NonQ(command);
        }
Пример #3
0
        ///<summary>No need to surround with try/catch, because all deletions are allowed.</summary>
        public static void Delete(int mountDefNum)
        {
            string command = "DELETE FROM mountdef WHERE MountDefNum=" + POut.PInt(mountDefNum);

            General2.NonQ(command);
            command = "DELETE FROM mountitemdef WHERE MountDefNum =" + POut.PInt(mountDefNum);
            General2.NonQ(command);
        }
Пример #4
0
        ///<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]));
        }
Пример #5
0
        ///<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]));
        }
Пример #6
0
        ///<summary></summary>
        public static void Update(MountItemDef def)
        {
            string command = "UPDATE mountitemdef SET "
                             + "MountDefNum = '" + POut.PInt(def.MountDefNum) + "'"
                             + ",Xpos = '" + POut.PInt(def.Xpos) + "'"
                             + ",Ypos = '" + POut.PInt(def.Ypos) + "'"
                             + ",Width = '" + POut.PInt(def.Width) + "'"
                             + ",Height = '" + POut.PInt(def.Height) + "'"
                             + " WHERE MountItemDefNum  ='" + POut.PInt(def.MountItemDefNum) + "'";

            General2.NonQ(command);
        }
Пример #7
0
        ///<summary></summary>
        public static void Update(MountDef def)
        {
            string command = "UPDATE mountdef SET "
                             + "Description = '" + POut.PString(def.Description) + "'"
                             + ",ItemOrder = '" + POut.PInt(def.ItemOrder) + "'"
                             + ",IsRadiograph = '" + POut.PBool(def.IsRadiograph) + "'"
                             + ",Width = '" + POut.PInt(def.Width) + "'"
                             + ",Height = '" + POut.PInt(def.Height) + "'"
                             + " WHERE MountDefNum  ='" + POut.PInt(def.MountDefNum) + "'";

            General2.NonQ(command);
        }
Пример #8
0
        ///<summary></summary>
        public static void Insert(MountDef def)
        {
            string command = "INSERT INTO mountdef (Description,ItemOrder,IsRadiograph,Width,Height"
                             + ") VALUES("
                             + "'" + POut.PString(def.Description) + "', "
                             + "'" + POut.PInt(def.ItemOrder) + "', "
                             + "'" + POut.PBool(def.IsRadiograph) + "', "
                             + "'" + POut.PInt(def.Width) + "', "
                             + "'" + POut.PInt(def.Height) + "')";

            def.MountDefNum = General2.NonQ(command, true);
        }
Пример #9
0
        ///<summary></summary>
        public static void Insert(MountItemDef def)
        {
            string command = "INSERT INTO mountitemdef (MountDefNum,Xpos,Ypos,Width,Height"
                             + ") VALUES("
                             + "'" + POut.PInt(def.MountDefNum) + "', "
                             + "'" + POut.PInt(def.Xpos) + "', "
                             + "'" + POut.PInt(def.Ypos) + "', "
                             + "'" + POut.PInt(def.Width) + "', "
                             + "'" + POut.PInt(def.Height) + "')";

            def.MountItemDefNum = General2.NonQ(command, true);
        }
Пример #10
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);
        }
Пример #11
0
        public static int Update(MountItem mountItem)
        {
            string command = "UPDATE mountitem SET "
                             + "MountNum='" + POut.PInt(mountItem.MountNum) + "',"
                             + "Xpos='" + POut.PInt(mountItem.Xpos) + "',"
                             + "Ypos='" + POut.PInt(mountItem.Ypos) + "',"
                             + "OrdinalPos='" + POut.PInt(mountItem.OrdinalPos) + "',"
                             + "Width='" + POut.PInt(mountItem.Width) + "',"
                             + "Height='" + POut.PInt(mountItem.Height) + "' "
                             + "WHERE MountItemNum='" + POut.PInt(mountItem.MountItemNum) + "'";

            return(General2.NonQEx(command));
        }
Пример #12
0
        public static int Insert(MountItem mountItem)
        {
            string command = "INSERT INTO mountitem (MountItemNum,MountNum,Xpos,Ypos,OrdinalPos,Width,Height) VALUES ("
                             + "'" + POut.PInt(mountItem.MountItemNum) + "',"
                             + "'" + POut.PInt(mountItem.MountNum) + "',"
                             + "'" + POut.PInt(mountItem.Xpos) + "',"
                             + "'" + POut.PInt(mountItem.Ypos) + "',"
                             + "'" + POut.PInt(mountItem.OrdinalPos) + "',"
                             + "'" + POut.PInt(mountItem.Width) + "',"
                             + "'" + POut.PInt(mountItem.Height) + "')";

            return(General2.NonQEx(command, true));
        }
Пример #13
0
        public static int Insert(Mount mount)
        {
            string command = "INSERT INTO mount (MountNum,PatNum,DocCategory,DateCreated,Description,Note,ImgType,Width,Height) VALUES ("
                             + "'" + POut.PInt(mount.MountNum) + "',"
                             + "'" + POut.PInt(mount.PatNum) + "',"
                             + "'" + POut.PInt(mount.DocCategory) + "',"
                             + POut.PDate(mount.DateCreated) + ","
                             + "'" + POut.PString(mount.Description) + "',"
                             + "'" + POut.PString(mount.Note) + "',"
                             + "'" + POut.PInt((int)mount.ImgType) + "',"
                             + "'" + POut.PInt(mount.Width) + "',"
                             + "'" + POut.PInt(mount.Height) + "')";

            return(General2.NonQEx(command, true));
        }
Пример #14
0
        public static int Update(Mount mount)
        {
            string command = "UPDATE mount SET "
                             + "PatNum='" + POut.PInt(mount.PatNum) + "',"
                             + "DocCategory='" + POut.PInt(mount.DocCategory) + "',"
                             + "DateCreated=" + POut.PDate(mount.DateCreated) + ","
                             + "Description='" + POut.PString(mount.Description) + "',"
                             + "Note='" + POut.PString(mount.Note) + "',"
                             + "ImgType='" + POut.PInt((int)mount.ImgType) + "',"
                             + "Width='" + POut.PInt(mount.Width) + "',"
                             + "Height='" + POut.PInt(mount.Height) + "' "
                             + "WHERE MountNum='" + POut.PInt(mount.MountNum) + "'";

            return(General2.NonQEx(command));
        }
Пример #15
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);
            }
        }
Пример #16
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);
            }
        }
Пример #17
0
        ///<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);
        }
Пример #18
0
 ///<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);
 }
Пример #19
0
        public static void Delete(Mount mount)
        {
            string command = "DELETE FROM mount WHERE MountNum='" + POut.PInt(mount.MountNum) + "'";

            General2.NonQEx(command);
        }
Пример #20
0
 private static Document[] RefreshAndFill(string command)
 {
     return(Fill(General2.GetTable(command)));
 }
Пример #21
0
        public static void Delete(MountItem mountItem)
        {
            string command = "DELETE FROM mountitem WHERE MountItemNum='" + POut.PInt(mountItem.MountItemNum) + "'";

            General2.NonQEx(command);
        }