Example #1
0
 public static void CreateTable(SQLiteConnection connection)
 {
     using (SQLiteCommand command = connection.CreateCommand())
     {
         DBDwgFileCommands.CreateTable(command);
         command.ExecuteNonQuery();
     }
 }
Example #2
0
        /// <summary>
        /// Check if the connection has path.
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="path">relative path</param>
        /// <returns></returns>
        public static bool HasRowPath(SQLiteConnection connection, string path)
        {
            long count = 0;

            using (SQLiteCommand command = connection.CreateCommand())
            {
                DBDwgFileCommands.SelectCount(command, path);
                count = Convert.ToInt64(command.ExecuteScalar());
            }
            return(count == 1);
        }
Example #3
0
        public static DwgFileModel SelectRow(SQLiteConnection connection, string relPath)
        {
            DwgFileModel model = null;

            using (SQLiteCommand command = connection.CreateCommand())
            {
                DBDwgFileCommands.SelectRow(command, relPath);
                SQLiteDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    model = GetFile(reader, connection);
                }
                reader.Close();
            }
            return(model);
        }
Example #4
0
 public static long InsertRow(SQLiteConnection connection, ref DwgFileModel model)
 {
     using (SQLiteCommand command = connection.CreateCommand())
     {
         DBDwgFileCommands.InsertRow(command, model);
         long check = command.ExecuteNonQuery();
         if (check == 1)
         {
             return(connection.LastInsertRowId);
         }
         else if (check == 0)
         {
             throw new Exception("DBDwgFile -> insertRow -> No Row is inserted.");
         }
         throw new Exception("DBDwgFile -> insertRow -> Row insertion not successful.");
     }
 }
Example #5
0
 //This is to update the file row only. Other has to be done in Note.
 public static void UpdateRow(SQLiteConnection connection, DwgFileModel model)
 {
     using (SQLiteCommand command = connection.CreateCommand())
     {
         DBDwgFileCommands.UpdateRow(command, model);
         long check = command.ExecuteNonQuery();
         if (check == 1)
         {
             return;
         }
         else if (check == 0)
         {
             //throw new Exception("DBFixtureDetails -> UpdateRow -> No Row is Updated.");
             return;
         }
         throw new Exception("DBFixtureDetails -> UpdateRow -> Update Not Successful.");
     }
 }
Example #6
0
        public static DwgFileModel GetPNote(SQLiteConnection connection)
        {
            DwgFileModel model = null;

            using (SQLiteCommand command = connection.CreateCommand())
            {
                DBDwgFileCommands.GetPNoteFile(command);
                using (SQLiteDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        model = GetFile(reader, connection);
                    }
                    reader.Close();
                }
            }
            return(model);
        }
Example #7
0
        public static List <DwgFileModel> GetDwgFilesExceptPNote(SQLiteConnection connection)
        {
            List <DwgFileModel> dwgs = new List <DwgFileModel>();

            using (SQLiteCommand command = connection.CreateCommand())
            {
                DBDwgFileCommands.GetDwgFiles(command);
                SQLiteDataReader reader = command.ExecuteReader();
                while (reader.Read())
                {
                    DwgFileModel model = GetFile(reader, connection);

                    dwgs.Add(model);
                }
                reader.Close();
            }
            return(dwgs);
        }