Beispiel #1
0
        private void addLabourerBtn_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(labourerNameTextBox.Text))
            {
                MessageBox.Show("Please enter the name of labourer");
                return;
            }

            if (String.IsNullOrEmpty(ageTextBox.Text))
            {
                MessageBox.Show("Please enter the age of labourer");
                return;
            }

            if (genderComboBox.SelectedItem == null)
            {
                MessageBox.Show("Please select the gender");
                return;
            }

            if (String.IsNullOrEmpty(startWorkDate.Text))
            {
                MessageBox.Show("Please select Start Work Date");
                return;
            }

            if (String.IsNullOrEmpty(endWorkDate.Text))
            {
                MessageBox.Show("Please select End Work Date");
                return;
            }

            DBConnector dBConn = new DBConnector();

            dBConn.connect();

            Labourer labr = new Labourer();

            labr.Name      = labourerNameTextBox.Text;
            labr.Age       = int.Parse(ageTextBox.Text);
            labr.Gender    = genderComboBox.SelectedItem.ToString();
            labr.StartDate = startWorkDate.Text;
            labr.EndDate   = endWorkDate.Text;

            LabourerHandler labHnd    = new LabourerHandler();
            int             recordCnt = labHnd.addNewLabourer(dBConn.getConn(), labr);

            MessageBox.Show(recordCnt + "record has been inserted!!");
            labourerGridView.DataSource = labHnd.getAllLabourer(dBConn.getConn());
        }
Beispiel #2
0
        private void btnLabourer_Click(object sender, EventArgs e)
        {
            panel1.Hide();
            panel2.Hide();
            panel3.Hide();
            panel4.Show();
            panel5.Hide();
            panel6.Hide();
            DBConnector dBConn = new DBConnector();

            dBConn.connect();
            LabourerHandler labHnd = new LabourerHandler();

            //labourerGridView.DataSource = labHnd.BindSource();
            labourerGridView.DataSource = labHnd.getAllLabourer(dBConn.getConn());
        }