예제 #1
0
        private void BtnManageAdd_Click(object sender, EventArgs e)
        {
            try
            {
                //Error for input string not found
                DAL.InspectionDetailClass inspection = new DAL.InspectionDetailClass(int.Parse(cmbInspectionCode.SelectedValue.ToString()), int.Parse(cmbEquipmentCode.SelectedValue.ToString()), int.Parse(cmbStaffCode.SelectedValue.ToString()), txtFaultComment.Text, cmbStatus.SelectedItem.ToString());
                int x = bll.AddInspectionDetail(inspection);

                if (x > 0)
                {
                    txtFaultComment.Clear();
                    cmbEquipmentCode.ValueMember  = "";
                    cmbInspectionCode.ValueMember = "";
                    cmbStaffCode.ValueMember      = "";
                    cmbStatus.ValueMember         = "";
                }
                else
                {
                    MessageBox.Show("Please input valid data.");
                }
            }
            catch
            {
                MessageBox.Show("Please input valid data.");
            }

            dgvInspectionDetails.DataSource = bll.GetInspectionDetail();
        }
        protected void btnManageAdd(object sender, EventArgs e)
        {
            try
            {
                //Error for input string not found
                DAL.InspectionDetailClass inspection = new DAL.InspectionDetailClass(int.Parse(cmbInspectionCode.SelectedValue.ToString()), int.Parse(cmbEquipment.SelectedValue.ToString()), int.Parse(cmbStaffMember.SelectedValue.ToString()), txtFaultComment.Text, cmbStatus.SelectedValue.ToString());
                int x = bll.AddInspectionDetail(inspection);

                if (x > 0)
                {
                    txtFaultComment.Text   = "";
                    cmbEquipment.Text      = "";
                    cmbInspectionCode.Text = "";
                    cmbStaffMember.Text    = "";
                    cmbStatus.Text         = "";
                }
                else
                {
                }
            }
            catch
            {
            }

            dgInspectionDetails.DataSource = bll.GetInspectionDetail();
            dgInspectionDetails.DataBind();
        }