Esempio n. 1
0
 /// <summary>
 /// Remove Image from ListBox and PhotoList
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void RemoveImage_Click(object sender, EventArgs e)
 {
     if (IListBox.Items.Count != 0)
     {
         PhotoList.Remove(IListBox.Items[indexer].ToString());
         IListBox.Items.Remove(IListBox.Items[indexer].ToString());
         indexer = 0;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Remove duplicate image
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DelCopy_Click(object sender, EventArgs e)
        {
            var removes = PhotoList.Remove();

            foreach (var item in removes)
            {
                IListBox.Items.Remove(item);
            }
        }
Esempio n. 3
0
 public static void DeleteRecord(Photograph photo, PhotoList list)
 {
     list.Remove(photo);
     using (SqlConnection connection = new SqlConnection(connectionString))
     {
         try
         {
             using (SqlCommand command = new SqlCommand($"DELETE FROM tblPhotoAlbum WHERE Id = @Id", connection))
             {
                 command.Parameters.AddWithValue("@Id", photo.Id);
                 connection.Open();
                 command.ExecuteNonQuery();
             }
         }
         catch (SqlException e)
         {
             MessageBox.Show("An exception occurred:" + e.Message);
         }
     }
 }