Пример #1
0
        private void BtnManageUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                //Error for input string not found
                DAL.InspectionClass inspection = new DAL.InspectionClass(DAL.InspectionClass.InspectionCode, Convert.ToDateTime(dateInspection.Text), txtTime.Text, txtComment.Text, int.Parse(cmbVenueCode.SelectedValue.ToString()), int.Parse(cmbStaffCode.SelectedValue.ToString()));
                int x = bll.UpdateInspection(inspection);

                if (x > 0)
                {
                    dateInspection.ResetText();
                    txtTime.Clear();
                    txtComment.Clear();
                    cmbVenueCode.ValueMember = "";
                    cmbStaffCode.ValueMember = "";
                }
                else
                {
                    MessageBox.Show("Please input valid data.");
                }
            }
#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
            {
                MessageBox.Show("Please input valid data.");
            }

            dgvInspection.DataSource = bll.GetInspection();
        }
Пример #2
0
        protected void btnManageUpdate(object sender, EventArgs e)
        {
            try
            {
                //Error for input string not found
                DAL.InspectionClass inspection = new DAL.InspectionClass(DAL.InspectionClass.InspectionCode, calInspectDate.SelectedDate, txtInspectTime.Text, txtComment.Text, int.Parse(cmbVenue.SelectedValue.ToString()), int.Parse(cmbStaffCode.SelectedValue.ToString()));
                int x = bll.UpdateInspection(inspection);

                if (x > 0)
                {
                    calInspectDate.SelectedDate = DateTime.Now;
                    txtInspectTime.Text         = "";
                    txtComment.Text             = "";
                    cmbVenue.Text     = " ";
                    cmbStaffCode.Text = " ";
                }
                else
                {
                }
            }
            catch (Exception b)
            {
            }

            dgInspection.DataSource = bll.GetInspection();
            dgInspection.DataBind();
        }
Пример #3
0
        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();
        }
Пример #4
0
        private void cmbStaffCode_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                DAL.InspectionClass inspection = new DAL.InspectionClass
                {
                    StaffCode = int.Parse(cmbStaffCode.SelectedValue.ToString())
                };

                dgvInspectionReport.DataSource = bll.Report_DisplayInspectionByStaffCode(inspection);
            }
#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
            {
            }
        }
Пример #5
0
        private void dateInspection_ValueChanged(object sender, EventArgs e)
        {
            try
            {
                DAL.InspectionClass inspection = new DAL.InspectionClass
                {
                    InspectionDate = Convert.ToDateTime(dateInspection.Text)
                };

                dgvInspectionReport.DataSource = bll.Report_DisplayInspectionByDate(inspection);
            }
#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
            {
            }
        }
Пример #6
0
        protected void calInspectDate_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                DAL.InspectionClass inspection = new DAL.InspectionClass
                {
                    InspectionDate = Convert.ToDateTime(calInspectDate.SelectedDate)
                };

                dgInspection.DataSource = bll.Report_DisplayInspectionByDate(inspection);
                dgInspection.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
            {
            }
        }
Пример #7
0
        protected void cmbVenueInspection_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                DAL.InspectionClass inspection = new DAL.InspectionClass
                {
                    VenueCode = int.Parse(cmbVenueInspection.SelectedValue.ToString())
                };

                dgInspection.DataSource = bll.Report_DisplayInspectionByVenue(inspection);
                dgInspection.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
            {
            }
        }
Пример #8
0
        protected void dgInspection_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                DAL.InspectionClass inspectClass = new DAL.InspectionClass(int.Parse(dgInspection.SelectedItem.Cells[1].Text.ToString()));

                var values = bll.SelectedForUpdateInspection(inspectClass);


                txtInspectTime.Text         = values.Rows[0].Table.Rows[0].ItemArray[4].ToString();
                txtComment.Text             = values.Rows[0].Table.Rows[0].ItemArray[5].ToString();
                calInspectDate.SelectedDate = DateTime.Parse(values.Rows[0].Table.Rows[0].ItemArray[3].ToString());
                calInspectDate.VisibleDate  = DateTime.Parse(values.Rows[0].Table.Rows[0].ItemArray[3].ToString());
                cmbVenue.SelectedValue      = values.Rows[0].Table.Rows[0].ItemArray[1].ToString();
                cmbStaffCode.SelectedValue  = values.Rows[0].Table.Rows[0].ItemArray[2].ToString();
            }
            catch (Exception b)
            {
            }
        }
Пример #9
0
        private void dgvInspection_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DAL.InspectionClass inspectClass = new DAL.InspectionClass(int.Parse(dgvInspection.SelectedRows[0].Cells[0].Value.ToString()));

                var values = bll.SelectedForUpdateInspection(inspectClass);

                dateInspection.Text = values.Rows[0].Table.Rows[0].ItemArray[3].ToString();
                txtTime.Text        = values.Rows[0].Table.Rows[0].ItemArray[4].ToString();
                txtComment.Text     = values.Rows[0].Table.Rows[0].ItemArray[5].ToString();

                cmbVenueCode.SelectedValue = values.Rows[0].Table.Rows[0].ItemArray[1];
                cmbStaffCode.SelectedValue = values.Rows[0].Table.Rows[0].ItemArray[2];
            }
#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
            {
            }
        }