Esempio n. 1
0
        private void BtnManageUpdate_Click(object sender, EventArgs e)
        {
            dgvInspectionDetails.DataSource      = bll.GetInspectionDetail();
            dgvInspectionDetails.BackgroundColor = Color.White;

            try
            {
                //Error for input string not found
                DAL.InspectionDetailClass inspection = new DAL.InspectionDetailClass(DAL.InspectionDetailClass.InspectionDetailCode, int.Parse(cmbInspectionCode.SelectedValue.ToString()), int.Parse(cmbEquipmentCode.SelectedValue.ToString()), int.Parse(cmbStaffCode.SelectedValue.ToString()), txtFaultComment.Text, cmbStatus.Text.ToString());
                int x = bll.UpdateInspectionDetail(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();
        }
        protected void dgInspectionDetails_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                DAL.InspectionDetailClass inspectionDetailClass = new DAL.InspectionDetailClass(int.Parse(dgInspectionDetails.SelectedItem.Cells[1].Text.ToString()));

                var values = bll.SelectedForUpdateInspectionDetail(inspectionDetailClass);

                txtFaultComment.Text = values.Rows[0].Table.Rows[0].ItemArray[4].ToString();

                cmbInspectionCode.SelectedValue = values.Rows[0].Table.Rows[0].ItemArray[1].ToString();
                cmbEquipment.SelectedValue      = values.Rows[0].Table.Rows[0].ItemArray[2].ToString();
                cmbStaffMember.SelectedValue    = values.Rows[0].Table.Rows[0].ItemArray[3].ToString();
                cmbStatus.SelectedValue         = values.Rows[0].Table.Rows[0].ItemArray[5].ToString();
            }
            catch (Exception b)
            {
            }
        }
        private void cmbStaffCode_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmbStaffCode.ValueMember != "")
                {
                    DAL.InspectionDetailClass inspectionDetail = new DAL.InspectionDetailClass
                    {
                        StaffCode = int.Parse(cmbStaffCode.SelectedValue.ToString())
                    };

                    dgvInspectionReport.DataSource = bll.Report_DisplayInspectionDetailsByStaffCode(inspectionDetail);
                }
            }
#pragma warning disable CS0168 // The variable 'b' is declared but never used
            catch (Exception b)
#pragma warning restore CS0168 // The variable 'b' is declared but never used
            {
            }
        }
Esempio n. 5
0
        private void dgvinspectionDetails_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DAL.InspectionDetailClass inspectionDetailClass = new DAL.InspectionDetailClass(int.Parse(dgvInspectionDetails.SelectedRows[0].Cells[0].Value.ToString()));

                var values = bll.SelectedForUpdateInspectionDetail(inspectionDetailClass);

                txtFaultComment.Text = values.Rows[0].Table.Rows[0].ItemArray[4].ToString();

                cmbInspectionCode.SelectedValue = values.Rows[0].Table.Rows[0].ItemArray[1];
                cmbEquipmentCode.SelectedValue  = values.Rows[0].Table.Rows[0].ItemArray[2];
                cmbStaffCode.SelectedValue      = values.Rows[0].Table.Rows[0].ItemArray[3];
                cmbStatus.Text = values.Rows[0].Table.Rows[0].ItemArray[5].ToString();
            }
#pragma warning disable CS0168 // The variable 'b' is declared but never used
            catch (Exception b)
#pragma warning restore CS0168 // The variable 'b' is declared but never used
            {
            }
        }
Esempio n. 6
0
        protected void cmbEquipmentInspectionDetails_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmbEquipmentInspectionDetails.DataValueField != "")
                {
                    DAL.InspectionDetailClass inspectionDetail = new DAL.InspectionDetailClass
                    {
                        EquipmentCode = int.Parse(cmbEquipmentInspectionDetails.SelectedValue.ToString())
                    };

                    dgInspectionDetails.DataSource = bll.Report_DisplayInspectionDetailsByEquip(inspectionDetail);
                    dgInspectionDetails.DataBind();
                }
            }
#pragma warning disable CS0168 // The variable 'b' is declared but never used
            catch (Exception b)
#pragma warning restore CS0168 // The variable 'b' is declared but never used
            {
            }
        }