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(); }