protected void AddServiceButton_Click(Object sender, EventArgs e) { MessageUserControl.TryRun(() => { JobController control = new JobController(); ServiceDetailPoco newItem = new ServiceDetailPoco(); newItem.Description = DescriptionTB.Text; newItem.JobID = int.Parse(JobNumberLabel.Text); bool success = decimal.TryParse(HoursTB.Text, out decimal hours); if (success) { newItem.JobHours = hours; } else { throw new Exception("Must enter a valid decimal for hours."); } newItem.CouponID = int.Parse(CouponDDL.SelectedValue); newItem.Comments = CommentsTB.Text; control.AddServiceDetail(newItem); List <ServiceDetailPoco> serviceDetail = control.ListServiceDetails(int.Parse(JobNumberLabel.Text)); CurrentJobGridView.DataSource = serviceDetail; CurrentJobGridView.DataBind(); DescriptionTB.Text = ""; HoursTB.Text = ""; CouponDDL.SelectedIndex = 0; CommentsTB.Text = ""; }, "Service Added", "Service was successfully added to job"); }