Exemplo n.º 1
0
        private static int CleanSQLEntries(List <AttachScanInfo> missingSQLDirs)
        {
            if (missingSQLDirs.Count > 0)
            {
                DeviceAttachmentsCols DeviceTable = new DeviceAttachmentsCols();
                SibiAttachmentsCols   SibiTable   = new SibiAttachmentsCols();
                int deletions = 0;
                foreach (var sqlItem in missingSQLDirs)
                {
                    if (!CheckForPrimaryItem(sqlItem.FKey))
                    {
                        var DeviceRows = DBFactory.GetDatabase().ExecuteNonQuery("DELETE FROM " + DeviceTable.TableName + " WHERE " + DeviceTable.FKey + "='" + sqlItem.FKey + "'");
                        if (DeviceRows > 0)
                        {
                            deletions += DeviceRows;
                            Logging.Logger("Deleted " + DeviceRows.ToString() + " Device SQL Entries For: " + sqlItem.FKey);
                        }

                        var SibiRows = DBFactory.GetDatabase().ExecuteNonQuery("DELETE FROM " + SibiTable.TableName + " WHERE " + SibiTable.FKey + "='" + sqlItem.FKey + "'");
                        if (SibiRows > 0)
                        {
                            deletions += SibiRows;
                            Logging.Logger("Deleted " + SibiRows.ToString() + " Sibi SQL Entries For: " + sqlItem.FKey);
                        }
                    }
                }
                return(deletions);
            }
            return(0);
        }
Exemplo n.º 2
0
        private static int CleanSQLFiles(List <AttachScanInfo> missingSQLFiles)
        {
            if (missingSQLFiles.Count > 0)
            {
                DeviceAttachmentsCols DeviceTable = new DeviceAttachmentsCols();
                SibiAttachmentsCols   SibiTable   = new SibiAttachmentsCols();
                int deletions = 0;
                foreach (var sqlItem in missingSQLFiles)
                {
                    var DeviceRows = DBFactory.GetDatabase().ExecuteNonQuery("DELETE FROM " + DeviceTable.TableName + " WHERE " + DeviceTable.FileGuid + "='" + sqlItem.FileGuid + "'");
                    if (DeviceRows > 0)
                    {
                        deletions += DeviceRows;
                        Logging.Logger("Deleted Device SQL File: " + sqlItem.FKey + "/" + sqlItem.FileGuid);
                    }

                    var SibiRows = DBFactory.GetDatabase().ExecuteNonQuery("DELETE FROM " + SibiTable.TableName + " WHERE " + SibiTable.FileGuid + "='" + sqlItem.FileGuid + "'");
                    if (SibiRows > 0)
                    {
                        deletions += SibiRows;
                        Logging.Logger("Deleted Sibi SQL File: " + sqlItem.FKey + "/" + sqlItem.FileGuid);
                    }
                }
                return(deletions);
            }
            return(0);
        }
Exemplo n.º 3
0
        private static List <AttachScanInfo> ListSQLFiles()
        {
            DeviceAttachmentsCols DeviceTable = new DeviceAttachmentsCols();
            SibiAttachmentsCols   SibiTable   = new SibiAttachmentsCols();
            List <AttachScanInfo> SQLFileList = new List <AttachScanInfo>();

            var devFiles = DBFactory.GetDatabase().DataTableFromQueryString("SELECT * FROM " + DeviceTable.TableName);

            foreach (DataRow file in devFiles.Rows)
            {
                SQLFileList.Add(new AttachScanInfo(file[DeviceTable.FKey].ToString(), file[DeviceTable.FileGuid].ToString()));
            }

            var sibiFiles = DBFactory.GetDatabase().DataTableFromQueryString("SELECT * FROM " + SibiTable.TableName);

            foreach (DataRow file in sibiFiles.Rows)
            {
                SQLFileList.Add(new AttachScanInfo(file[SibiTable.FKey].ToString(), file[SibiTable.FileGuid].ToString()));
            }

            return(SQLFileList);
        }