Пример #1
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();
            }
        }
Пример #2
0
        private void button_AddFileInDb_Click(object sender, EventArgs e)
        {
            FilePersonKeywordClient client = new FilePersonKeywordClient();

            MemoriesManager.File file = new MemoriesManager.File
            {
                Path         = listBox_Files.SelectedItem.ToString(),
                Created_at   = dateTimePicker_createdAt.Value.Date,
                Type         = "Image",
                Path_changed = false,
                Location     = textBox_locations.Text
            };
            client.CreateFile(file);
            enableArrowButtons();
            button_AddFileInDb.Enabled      = false; //Dezactivam butonul de adaugare fisier in DB
            label_dbResponse.Text           = "The file is registered in DB";
            label_dbResponse.ForeColor      = Color.Green;
            button_DeleteFileFromDb.Enabled = true; //Activam butonul de stergere fisier din DB
            AddingKeywordsToFile(dgk_DB);
            AddingPersonsToFile(dgp_DB);
            RefreshDgk_file();
            RefreshDgp_file();
            client.Close();
        }