private bool EditMovie() { Movie edittedMovie = movie; if (TitleBox.Text != movie.Name) { Console.WriteLine("CHANGE TITLE"); edittedMovie.Name = TitleBox.Text; } if (GenreBox.Text != movie.Genre) { edittedMovie.Genre = GenreBox.Text; } if (float.Parse(FeesBox.Text) != movie.Fees) { edittedMovie.Fees = (float.Parse(FeesBox.Text)); } if (int.Parse(CopyAmountBox.Text) != movie.Num_copies) { edittedMovie.Num_copies = int.Parse(CopyAmountBox.Text); } if (DBEnvironment.Edit(edittedMovie)) { return(true); } else { return(false); } }
private bool EditMovie() { 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 = movie.Id; DBEnvironment.Edit(newMovie); Starred starred = new Starred(this.movieActors.ToArray(), deletedActors.ToArray(), newMovie); DBEnvironment.Edit(starred); } catch (Exception e) { } } return(true); }
private bool EditUser() { if ((MessageBox.Show("Edit new Employee with current information?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)) { try { Employee updatedEmployee = CreateEmployee(); updatedEmployee.Id = employee.Id; DBEnvironment.Edit(updatedEmployee); MessageBox.Show("Customer successfully Edited!"); 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(); }
private void EditUser() { Customer updatedCustomer = customer; if (customer.Name.FirstName != FirstNameBox.Text) { updatedCustomer.Name.FirstName = FirstNameBox.Text; } if (customer.Name.LastName != LastNameBox.Text) { updatedCustomer.Name.LastName = LastNameBox.Text; } if (customer.Address.City != CityBox.Text) { updatedCustomer.Address.City = CityBox.Text; } if (customer.Address.HouseNumber != HouseBox.Text) { updatedCustomer.Address.HouseNumber = HouseBox.Text; } if (customer.Address.PostalCode != PostalBox.Text) { if (PostalBox.Text == "") { updatedCustomer.Address.PostalCode = ""; } else { updatedCustomer.Address.PostalCode = PostalBox.Text; } } if (customer.Address.Province != ProvinceBox.Text) { updatedCustomer.Address.Province = ProvinceBox.Text; } if (customer.Address.StreetNumber != StreetBox.Text) { updatedCustomer.Address.StreetNumber = StreetBox.Text; } if (customer.Address.SuiteNumber != SuiteBox.Text) { updatedCustomer.Address.SuiteNumber = SuiteBox.Text; } if (customer.ContactInformation.Email != EmailBox.Text) { if (EmailBox.Text == "") { updatedCustomer.ContactInformation.Email = ""; } else { updatedCustomer.ContactInformation.Email = EmailBox.Text; } } if (customer.ContactInformation.PhoneNumber != PhoneBox.Text) { if (PhoneBox.Text == "") { updatedCustomer.ContactInformation.PhoneNumber = ""; } else { updatedCustomer.ContactInformation.PhoneNumber = PhoneBox.Text; } } if (customer.Type.ToString() != TypeBox.SelectedItem.ToString()) { updatedCustomer.Type = GetAccountType(); } DBEnvironment.Edit(updatedCustomer); MessageBox.Show("Customer edit complete!"); }