protected void buttonSubmit_Click(object sender, EventArgs e) { //Ensure the page is valid before you submit to the database if (Page.IsValid) { //See if the biodesial is a pass or faile if fail switch present to false Boolean qual = true; if ((quality.SelectedItem.Text).Equals("Fail")) { qual = false; } //Create instance of compost db and load values to go into the db Biodiesel bd = new Biodiesel { BatchNumber = Convert.ToInt16(batch_num.Text), StartRunDate = Convert.ToDateTime(startdatepicker.Text), EndRunDate = Convert.ToDateTime(finishdatepicker.Text), TotalProcessingTime = Convert.ToDouble(process_time.Text), VolumeWasteOilColleted = Convert.ToDouble(Collected_kwo.Text), VolumeWasteOilProduced = Convert.ToDouble(Processed_kwo.Text), VolumeBiodieselProduced = Convert.ToDouble(bio_produce.Text), VolumeWasteProduced = Convert.ToDouble(waste_produce.Text), EnergyRequired = Convert.ToDouble(energy_bio.Text), MethanolUsed = Convert.ToDouble(methanol.Text), PotassiumHydroxideUsed = Convert.ToDouble(KH2.Text), QualityPassFail = qual, CostOfWasteOil = Convert.ToDecimal(cost_kwo.Text), ManHours = Convert.ToDouble(Manhrs.Text), CostOfDisposal = Convert.ToDecimal(cost_wd.Text), MarketCostBiodiesel = Convert.ToDecimal(martketcostbd.Text), Notes = Notes1.Text }; //Insert fw into db db.Biodiesels.InsertOnSubmit(bd); //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("../Widgets.aspx"); } //If not throw error catch { Console.WriteLine(e); db.SubmitChanges(); } } }
partial void DeleteBiodiesel(Biodiesel instance);
partial void UpdateBiodiesel(Biodiesel instance);
partial void InsertBiodiesel(Biodiesel instance);