private void bEdit_Click(object sender, EventArgs e) { formConsultaPeliculas aux; foreach (ListViewItem item in this.lBoxData.SelectedItems) { aux = new formConsultaPeliculas(this.Text + " - Editar Registro", this.Icon, data.GetRegistry(item.Index)); aux.ShowDialog(); if (aux.getData() != null) { String Id = data.GetRegistry(item.Index)[0]; String[] process = aux.getData().Split('#'); if (process[5] != "" && process[5][0] != '.') { PSLibrary.Utils.Image.Resize(new Bitmap(process[5]), 260, 320).Save("./db/images/" + Id + ".png", System.Drawing.Imaging.ImageFormat.Png); process[5] = "./db/images/" + Id + ".png"; } else if(process[5] == "") { process[5] = "./db/images/default.png"; try { File.Delete("./db/images/" + Id + ".png"); } catch { } } this.data.ModifyRegistry(getRealIndex(item), process ); } } LoadData(); }
private void bAnhadir_Click(object sender, EventArgs e) { formConsultaPeliculas aux; aux = new formConsultaPeliculas(this.Text + " - Nuevo Registro", this.Icon); aux.ShowDialog(); if (aux.getData() != null) { String Id = data.generateID(); String[] process = aux.getData().Split('#'); if (process[5] != "") { PSLibrary.Utils.Image.Resize(new Bitmap(process[5]), 260, 320).Save("./db/images/" + Id + ".png", System.Drawing.Imaging.ImageFormat.Png); process[5] = "./db/images/" + Id + ".png"; } else { process[5] = "./db/images/default.png"; } data.AddNewRegistry(process, Id); } LoadData(); }