private void buttonDelete_Click(object sender, EventArgs e) { MyPhotosServiceClient api = new MyPhotosServiceClient(); foreach (DataGridViewRow item in this.dataGridView1.SelectedRows) { string picName = item.Cells[1].Value.ToString(); var confirmDelete = MessageBox.Show("Are you sure to delete " + picName + " ?", "Delete picture", MessageBoxButtons.YesNo); if (confirmDelete == DialogResult.Yes) { api.RemoveEntry(Int32.Parse(item.Cells[0].Value.ToString())); } } UpdateDataGrid(); }
private void buttonOpen_Click(object sender, EventArgs e) { MyPhotosServiceClient api = new MyPhotosServiceClient(); foreach (DataGridViewRow item in this.dataGridView1.SelectedRows) { string path = item.Cells[7].Value.ToString(); if (File.Exists(path)) { Process.Start(path); } else { MessageBox.Show("Fisierul nu mai exista pe acest path!", "Eroare la deschidere", MessageBoxButtons.OK, MessageBoxIcon.Error); api.RemoveEntry(Int32.Parse(item.Cells[0].Value.ToString())); UpdateDataGrid(); } } }
private void buttonEdit_Click(object sender, EventArgs e) { MyPhotosServiceClient api = new MyPhotosServiceClient(); foreach (DataGridViewRow item in this.dataGridView1.SelectedRows) { //EditForm(int id, string title, string description, string location, string path, string persons, string categories) if (File.Exists(item.Cells[7].Value.ToString())) { EditForm editform = new EditForm(Int32.Parse(item.Cells[0].Value.ToString()), item.Cells[1].Value.ToString(), item.Cells[2].Value.ToString(), item.Cells[4].Value.ToString(), item.Cells[7].Value.ToString(), item.Cells[5].Value.ToString(), item.Cells[3].Value.ToString()); editform.ShowDialog(); } else { MessageBox.Show("Fisierul nu mai exista pe acest path!", "Eroare la deschidere", MessageBoxButtons.OK, MessageBoxIcon.Error); api.RemoveEntry(Int32.Parse(item.Cells[0].Value.ToString())); UpdateDataGrid(); } } UpdateDataGrid(); }