Ejemplo n.º 1
0
        // Check keywords of the current file and display them in data grid view
        public void RefreshDgk_file()
        {
            FilePersonKeywordClient client = new FilePersonKeywordClient();

            if (listBox_Files.SelectedIndex >= 0)
            {
                if (client.GetFileByPath(listBox_Files.SelectedItem.ToString()) != null)
                {
                    dgk_file.ClearSelection();
                    dgk_file.DataSource = client.GetKeywordsOfFile(listBox_Files.SelectedItem.ToString());
                    client.Close();
                }
            }
        }
Ejemplo n.º 2
0
        private void listBox_files_SelectedIndexChanged(object sender, EventArgs e)
        {
            FilePersonKeywordClient client = new FilePersonKeywordClient();

            MemoriesManager.File fileSelected = new MemoriesManager.File();

            if (listBox_Files.SelectedIndex >= 0)
            {
                ChangeImageInPictureBox(pictureBox_Files, listBox_Files.SelectedItem.ToString());
                if ((fileSelected = client.GetFileByPath(listBox_Files.SelectedItem.ToString())) != null)
                {
                    label_dbResponse.Text           = "The file is registered in DB    >";
                    label_dbResponse.ForeColor      = Color.Green;
                    textBox_locations.Text          = fileSelected.Location;
                    dateTimePicker_createdAt.Value  = fileSelected.Created_at;
                    button_AddFileInDb.Enabled      = false; //Dezactivam butonul de adaugare fisier in DB
                    button_DeleteFileFromDb.Enabled = true;  //Activam butonul de stergere fisier din DB
                    RefreshDgk_file();
                    RefreshDgp_file();
                    dgp_file.ClearSelection();
                    dgk_file.ClearSelection();
                    enableArrowButtons();
                }
                else
                {
                    label_dbResponse.Text           = "The file is unregistered in DB    >";
                    label_dbResponse.ForeColor      = Color.Red;
                    textBox_locations.Text          = "";
                    dateTimePicker_createdAt.Value  = DateTime.Now;
                    button_AddFileInDb.Enabled      = true;  //Activam butonul de adaugare fisier in DB
                    button_DeleteFileFromDb.Enabled = false; //Dezactivam butonul de stergere fisier din DB
                    dgk_DB.ClearSelection();
                    dgp_DB.ClearSelection();
                    //RefreshDgk_file();
                    dgk_file.DataSource = "";
                    //RefreshDgp_file();
                    dgp_file.DataSource = "";
                    disableArrowButtons();
                }
                client.Close();
            }
        }