private bool InsertMovie() { if ((MessageBox.Show("Add new Movie with current information?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)) { try { String title = TitleBox.Text; String genre = GenreComboBox.Text; int copies = int.Parse(CopyAmountBox.Text); float fees = float.Parse(FeesBox.Text); Movie newMovie = new Movie(title, genre, fees, copies, copies, 0); newMovie.Id = -1; DBEnvironment.Add(newMovie); movie = newMovie; return(true); } catch (Exception Ex) { return(false); } } else { return(false); } }
private bool InsertUser() { if ((MessageBox.Show("Add new Customer with current information?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)) { try { Customer newCustomer = CreateCustomer(); DBEnvironment.Add(newCustomer); MessageBox.Show("Customer successfully added!"); parent.Refresh(); return(true); } catch (Exception Ex) { HandleException(Ex); return(false); } } else { return(false); } }
private bool InsertActors(Movie movie) { Starred s = new Starred(movieActors.ToArray(), null, movie); if (!DBEnvironment.Add(s)) { return(false); } return(true); }
private bool InsertUser() { if ((MessageBox.Show("Add new Employee with current information?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)) { try { Employee newEmployee = CreateEmployee(); DBEnvironment.Add(newEmployee); MessageBox.Show("Customer successfully added!"); return(true); } catch (Exception Ex) { return(false); } } return(false); }
private void AddEdit_Click(object sender, EventArgs e) { if (!Validate()) { return; } UserName name = new UserName(this.FirstNameBox.Text, this.LastNameBox.Text); Actor newActor; if (FemaleRadio.Checked) { //Need to fix on database, reinit constraint from G to F newActor = new Actor(name, "F", validator.getDBReadyDate(DateOfBirthBox.Text), "", "", ""); } else if (MaleRadio.Checked) { newActor = new Actor(name, "M", validator.getDBReadyDate(DateOfBirthBox.Text), "", "", ""); } else { return; } if (actor == null) { DBEnvironment.Add(newActor); } else { newActor.Id = actor.Id; DBEnvironment.Edit(newActor); } parent.Reload(); this.Close(); }