Example #1
0
        /// <summary>
        /// Создание новой папки в БД
        /// </summary>
        /// <param name="FolderName">Имя новой папки</param>
        /// <param name="ParentFolderID">Родительская папка</param>
        public void CreateFolderRecord(string FolderName, string ParentFolderID)
        {
            using (OdbcConnection connection = new OdbcConnection(ConnectionString))
            {
                //Подключение к БД
                connection.Open();

                //Запрос нового  ID
                string CommandText =
                    $"SELECT {quote}FolderID{quote} " +
                    $"FROM public.{quote}Folders{quote}" +
                    $"  ORDER BY {quote}FolderID{quote} DESC ";

                OdbcCommand FolderReaderCommand = new OdbcCommand(CommandText, connection);

                //int RowCounter = AskFolderByParent.ExecuteNonQuery();
                int NewID = (int)FolderReaderCommand.ExecuteScalar() + 1;

                //Размещаем новую запись в БД
                string InsertText =
                    $"INSERT INTO {quote}Folders{quote} ({quote}FolderID{quote},{quote}FolderName{quote},{quote}ParentFolderID{quote})" +
                    $"VALUES ({NewID},'''{FolderName}''',{ParentFolderID})";

                OdbcCommand FolderInsertCommand = new OdbcCommand(InsertText, connection);

                int i = FolderInsertCommand.ExecuteNonQuery();
            }
            RefreshTreeView?.Invoke();
        }
Example #2
0
 /// <summary>
 /// Внешний запрос на обновление иерархии файлов
 /// </summary>
 public void AskRefresh()
 {
     RefreshTreeView?.Invoke();
 }