protected void btnManageAdd(object sender, EventArgs e) { try { //Error for input string not found DAL.InspectionClass inspection = new DAL.InspectionClass(calInspectDate.SelectedDate, txtInspectTime.Text, txtComment.Text, int.Parse(cmbVenue.SelectedValue.ToString()), int.Parse(cmbStaffCode.SelectedValue.ToString())); int x = bll.AddInspection(inspection); if (x > 0) { calInspectDate.SelectedDate = DateTime.Now; txtInspectTime.Text = ""; txtComment.Text = ""; cmbVenue.Text = " "; cmbStaffCode.Text = " "; } else { } } catch { } dgInspection.DataSource = bll.GetInspection(); dgInspection.DataBind(); }
private void BtnManageAdd_Click(object sender, EventArgs e) { try { //Error for input string not found DAL.InspectionClass inspection = new DAL.InspectionClass(Convert.ToDateTime(dateInspection.Text), txtTime.Text, txtComment.Text, int.Parse(cmbVenueCode.SelectedValue.ToString()), int.Parse(cmbStaffCode.SelectedValue.ToString())); int x = bll.AddInspection(inspection); if (x > 0) { dateInspection.ResetText(); txtTime.Clear(); txtComment.Clear(); cmbVenueCode.ValueMember = ""; cmbStaffCode.ValueMember = ""; } else { MessageBox.Show("Please input valid data."); } } catch { MessageBox.Show("Please input valid data."); } dgvInspection.DataSource = bll.GetInspection(); }