Пример #1
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     SchoolCur.SchoolName = textSchoolName.Text;
     SchoolCur.SchoolCode = textSchoolCode.Text;
     if (IsNew)
     {
         if (Schools.DoesExist(SchoolCur.SchoolName))
         {
             MessageBox.Show(Lan.g(this, "School name already exists. Duplicate not allowed."));
             return;
         }
         Schools.Insert(SchoolCur);
     }
     else                                                     //existing school
     {
         if (SchoolCur.SchoolName != SchoolCur.OldSchoolName) //school name was changed
         {
             if (Schools.DoesExist(SchoolCur.SchoolName))     //changed to a name that already exists.
             {
                 MessageBox.Show(Lan.g(this, "School name already exists. Duplicate not allowed."));
                 return;
             }
         }
         Schools.Update(SchoolCur);
     }
     DialogResult = DialogResult.OK;
 }
Пример #2
0
 private void FormScreenings_Load(object sender, System.EventArgs e)
 {
     Location          = new Point(200, 200);
     textDateFrom.Text = DateTime.Today.AddMonths(-1).ToShortDateString();
     textDateTo.Text   = DateTime.Today.ToShortDateString();
     Counties.GetListNames();
     Schools.GetListNames();
     FillGrid();
 }
Пример #3
0
        private void FillList()
        {
            Schools.Refresh();
            listSchools.Items.Clear();
            string s = "";

            for (int i = 0; i < Schools.List.Length; i++)
            {
                s = Schools.List[i].SchoolName;
                if (Schools.List[i].SchoolCode != "")
                {
                    s += ", " + Schools.List[i].SchoolCode;
                }
                listSchools.Items.Add(s);
            }
        }
Пример #4
0
        private void butDelete_Click(object sender, System.EventArgs e)
        {
            if (listSchools.SelectedIndex == -1)
            {
                MessageBox.Show(Lan.g(this, "Please select an item first."));
                return;
            }
            School SchoolCur = Schools.List[listSchools.SelectedIndex];
            string usedBy    = Schools.UsedBy(SchoolCur.SchoolName);

            if (usedBy != "")
            {
                MessageBox.Show(Lan.g(this, "Cannot delete site because it is already in use by the following patients: \r") + usedBy);
                return;
            }
            Schools.Delete(SchoolCur);
            FillList();
        }