private void uxButtonInsertProduction_Click(object sender, EventArgs e) { repo = new SqlProductionRepository("Data Source=mssql.cs.ksu.edu;" + "Initial Catalog=phyo;" + "User id=username;" + "Password=password;"); if (uxButtonInsertProduction.Text == "Insert") { var name = uxProductionName.Text; var location = uxProductionLocation.Text; try { var createdPH = repo.AddProductionHouse(name, location); MessageBox.Show("Production house succesfully added."); } catch (Exception exception) { MessageBox.Show("Sorry, the production company already exists."); } dataGridView1.DataSource = null; dataGridView1.DataSource = repo.RetrieveProduction2(); } else { var name = uxProductionName.Text; var location = uxProductionLocation.Text; //Should be modify stored procedure var createdPH = repo.UpdateProduction(name, location, ProductionId); dataGridView1.DataSource = null; dataGridView1.DataSource = repo.RetrieveProduction2(); } }
private void uxViewButton_Click(object sender, EventArgs e) { repo = new SqlProductionRepository("Data Source=mssql.cs.ksu.edu;" + "Initial Catalog=phyo;" + "User id=username;" + "Password=password;"); dataGridView1.DataSource = null; dataGridView1.Rows.Clear(); dataGridView1.DataSource = repo.RetrieveProduction2(); dataGridView1.Refresh(); }
private void uxViewMovies_Click(object sender, EventArgs e) { repo = new SqlProductionRepository("Data Source=mssql.cs.ksu.edu;" + "Initial Catalog=phyo;" + "User id=username;" + "Password=password;"); string Name = uxSearchTextBox.Text; dataGridView1.DataSource = null; dataGridView1.DataSource = repo.RetrieveProductionbyName(Name); }
public int GetId( ) { repo = new SqlProductionRepository("Data Source=mssql.cs.ksu.edu;" + "Initial Catalog=phyo;" + "User id=phyo;" + "Password=zinrocks@432;"); var name = uxProductionName.Text; var production = repo.GetProductionHouse(this.uxProductionName.Text); int pID = Convert.ToInt32(production.ProductionId.ToString()); return(pID); }
private void uxDeleteProduction_Click(object sender, EventArgs e) { repo = new SqlProductionRepository("Data Source=mssql.cs.ksu.edu;" + "Initial Catalog=phyo;" + "User id=username;" + "Password=password;"); var id = repo.GetProductionHouse(uxProductionName.Text); var createdPH = repo.DeleteProduction(uxProductionName.Text, uxProductionLocation.Text, id.ProductionId); MessageBox.Show("Production sucessfully deleted."); dataGridView1.DataSource = null; dataGridView1.DataSource = repo.RetrieveProduction2(); }
private void uxInsertButton_Click_1(object sender, EventArgs e) { sales = new SqlSalesRepository("Data Source = mssql.cs.ksu.edu; " + "Initial Catalog=phyo;" + "User id=username;" + "Password=password;"); repo = new SqlProductionRepository("Data Source = mssql.cs.ksu.edu; " + "Initial Catalog=phyo;" + "User id=username;" + "Password=password;"); movierepo = new SqlMovieRepository("Data Source = mssql.cs.ksu.edu; " + "Initial Catalog=phyo;" + "User id=username;" + "Password=password;"); try { var production = repo.GetProductionHouse(this.uxProductionName.Text); int pID = Convert.ToInt32(production.ProductionId.ToString()); var date = dateTimePicker1.Value.Date.ToString("yyyy-MM-dd"); movierepo.CreateMovie(pID, uxTextBoxMovieTitle.Text, date); } catch (Exception exception) { Form2 f2 = new Form2(); f2.ShowDialog(); int pID = f2.GetId(); var date = dateTimePicker1.Value.Date.ToString("yyyy-MM-dd"); uxProductionName.Text = f2.GetProductionName(); movierepo.CreateMovie(pID, uxTextBoxMovieTitle.Text, date); } dataGridView1.DataSource = movierepo.RetrieveMovie(); dataGridView3.DataSource = sales.RetrieveSales(); }
private void uxButtonInsertProduction_Click(object sender, EventArgs e) { repo = new SqlProductionRepository("Data Source=mssql.cs.ksu.edu;" + "Initial Catalog=phyo;" + "User id=phyo;" + "Password=zinrocks@432;"); var name = uxProductionName.Text; var location = uxProductionLocation.Text; try { var createdPH = repo.AddProductionHouse(name, location); MessageBox.Show("Production house succesfully added."); } catch (Exception exception) { MessageBox.Show("Sorry, the production company already exists."); } Close(); }