private void Save_Btn_Click(object sender, EventArgs e) { List <Genree> List = new List <Genree>(); for (int k = 0; k < Genree_lst.CheckedItems.Count; k++) { Genree list = new Genree(Genree_lst.CheckedItems[k].ToString()); List.Add(list); } moVie.Save_Movie(FileNA_TXT.Text, EMovieTitle_txt.Text, ID_txt.Text, Title_txt.Text, Director_txt.Text, Year_cmbo.SelectedItem.ToString(), Rating_combo.SelectedItem.ToString(), List); MessageBox.Show("Edited Successfully :)", "Message", MessageBoxButtons.OK, MessageBoxIcon.None); FileNA_TXT.Clear(); EMovieTitle_txt.Clear(); ID_txt.Clear(); Title_txt.Clear(); Director_txt.Clear(); Year_cmbo.Text = ""; Rating_combo.Text = ""; bool state = false; for (int i = 0; i < Genree_lst.Items.Count; i++) { Genree_lst.SetItemCheckState(i, (state ? CheckState.Checked : CheckState.Unchecked)); } }
private void A_add_btn_Click(object sender, EventArgs e) { Movie m = new Movie(); string ID = ID_txt.Text; string FileName = FileName_txt.Text; if (m.SearchUniquID(ID_txt.Text, FileName_txt.Text)) { string Title = Title_txt.Text; List <Genree> g = new List <Genree>(); for (int i = 0; i < Genre_lst.CheckedItems.Count; i++) { Genree ge = new Genree(Genre_lst.CheckedItems[i].ToString()); g.Add(ge); } string Director = Director_txt.Text; string Year = Year_cmbo.Text; string Rating = Rating_combo.Text; string path = imageLocation; m.AddToExist(ID, Title, g, Director, Year, Rating, FileName, path); MessageBox.Show("Added Successfully ^_^", "File", MessageBoxButtons.OK, MessageBoxIcon.None); FileName_txt.Clear(); ID_txt.Clear(); Title_txt.Clear(); Director_txt.Clear(); Rating_combo.Text = ""; Year_cmbo.Text = ""; Poster_pic.ImageLocation = ""; bool state = false; for (int j = 0; j < Genre_lst.CheckedItems.Count; j++) { Genre_lst.SetItemCheckState(j, (state ? CheckState.Checked : CheckState.Unchecked)); } } else { MessageBox.Show("You must enter a unique ID", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }