protected void buttonSubmit_Click(object sender, EventArgs e) { //Ensure the page is valid before you submit to the database if (Page.IsValid) { //Create instance of compost db and load values to go into the db AquaFarming plant = new AquaFarming { Date = Convert.ToDateTime(datepicker.Text), GreenHouseTemp = Convert.ToDouble(green_temp.Text), GreenHouseHumidity = Convert.ToDouble(green_humidity.Text), PlantType = Convert.ToString(species.Text), AmountHarvested = Convert.ToInt16(num_plant.Text), HarvestedBedNumber = Convert.ToInt16(plant_bed.Text), PlantHealth = Convert.ToString(health_plant.SelectedItem.Text), Notes = Notes1.Text }; //Insert fw into db db.AquaFarmings.InsertOnSubmit(plant); //Submit the changes and go home page //NOTE: Will not go to home page runnign in VS due to the way master pages work. try { db.SubmitChanges(); Response.Redirect("~/Default.aspx"); } //If not throw error catch { Console.WriteLine(e); db.SubmitChanges(); } } }
partial void DeleteAquaFarming(AquaFarming instance);
partial void UpdateAquaFarming(AquaFarming instance);
partial void InsertAquaFarming(AquaFarming instance);