Beispiel #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     ep.Clear();
     if (txtWorkCentre.Text != string.Empty && txtAbbreviation.Text != string.Empty)
     {
         try {
             WorkCentreData ed          = new WorkCentreData();
             int            ethnicityId = ed.Add(new WorkCentre {
                 WorkCentreName = txtWorkCentre.Text, Abbreviation = txtAbbreviation.Text
             });
             this.DialogResult = DialogResult.OK;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         if (txtWorkCentre.Text == string.Empty)
         {
             ep.SetError(txtWorkCentre, "Type Workcentre name");
         }
         if (txtAbbreviation.Text == string.Empty)
         {
             ep.SetError(txtAbbreviation, "Type Abbreviation");
         }
     }
 }
Beispiel #2
0
 private void PopulateWorkCentres()
 {
     try
     {
         WorkCentreData db = new WorkCentreData();
         _list = db.GetList();
         dgWorkCentre.AutoGenerateColumns = false;
         dgWorkCentre.DataSource          = _list;
         dgWorkCentre.Refresh();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #3
0
        private void populateWorkCentres()
        {
            WorkCentreData wcd = new WorkCentreData();

            WorkCentres = wcd.GetList();
            int i = 0;

            foreach (WorkCentre wc in WorkCentres)
            {
                _staffWorkCentreAllocation.checkedListBox1.Items.Add(wc.WorkCentreName);
                if (FindWorkCentre(wc.WorkCentreName))
                {
                    _staffWorkCentreAllocation.checkedListBox1.SetItemChecked(i, true);
                }
                i += 1;
            }
        }