Exemple #1
0
        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();
            }
        }
Exemple #2
0
        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();
        }