private void butOK_Click(object sender, System.EventArgs e) { CountyCur.CountyName = textCountyName.Text; CountyCur.CountyCode = textCountyCode.Text; if (IsNew) { if (Counties.DoesExist(CountyCur.CountyName)) { MessageBox.Show(Lan.g(this, "County name already exists. Duplicate not allowed.")); return; } Counties.Insert(CountyCur); } else //existing County { if (CountyCur.CountyName != CountyCur.OldCountyName) //County name was changed { if (Counties.DoesExist(CountyCur.CountyName)) //changed to a name that already exists. { MessageBox.Show(Lan.g(this, "County name already exists. Duplicate not allowed.")); return; } } Counties.Update(CountyCur); } DialogResult = DialogResult.OK; }
private void FormScreenGroup_Load(object sender, System.EventArgs e) { if (IsNew) { ScreenGroups.Insert(ScreenGroupCur); } if (PrefC.GetBool(PrefName.PublicHealthScreeningUsePat)) { labelScreener.Visible = false; textProvName.Visible = false; labelProv.Visible = false; comboProv.Visible = false; ScreenList = new OpenDentBusiness.Screen[0]; FillGridScreenPat(); } else { ListPats = new List <Patient>(); FillGrid(); } if (ScreenList.Length > 0) { OpenDentBusiness.Screen ScreenCur = ScreenList[0]; ScreenGroupCur.SGDate = ScreenCur.ScreenDate; ScreenGroupCur.ProvName = ScreenCur.ProvName; ScreenGroupCur.ProvNum = ScreenCur.ProvNum; ScreenGroupCur.County = ScreenCur.County; ScreenGroupCur.GradeSchool = ScreenCur.GradeSchool; ScreenGroupCur.PlaceService = ScreenCur.PlaceService; } textScreenDate.Text = ScreenGroupCur.SGDate.ToShortDateString(); textDescription.Text = ScreenGroupCur.Description; textProvName.Text = ScreenGroupCur.ProvName; //has to be filled before provnum for (int i = 0; i < ProviderC.ListShort.Count; i++) { comboProv.Items.Add(ProviderC.ListShort[i].Abbr); if (ScreenGroupCur.ProvNum == ProviderC.ListShort[i].ProvNum) { comboProv.SelectedIndex = i; } } string[] CountiesListNames = Counties.GetListNames(); comboCounty.Items.AddRange(CountiesListNames); if (ScreenGroupCur.County == null) { ScreenGroupCur.County = ""; //prevents the next line from crashing } comboCounty.SelectedIndex = comboCounty.Items.IndexOf(ScreenGroupCur.County); //"" etc OK for (int i = 0; i < SiteC.List.Length; i++) { comboGradeSchool.Items.Add(SiteC.List[i].Description); } if (ScreenGroupCur.GradeSchool == null) { ScreenGroupCur.GradeSchool = ""; //prevents the next line from crashing } comboGradeSchool.SelectedIndex = comboGradeSchool.Items.IndexOf(ScreenGroupCur.GradeSchool); //"" etc OK comboPlaceService.Items.AddRange(Enum.GetNames(typeof(PlaceOfService))); comboPlaceService.SelectedIndex = (int)ScreenGroupCur.PlaceService; }
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(); }
private void FillList() { CountiesList = Counties.Refresh(); listCounties.Items.Clear(); string s = ""; for (int i = 0; i < CountiesList.Length; i++) { s = CountiesList[i].CountyName; if (CountiesList[i].CountyCode != "") { s += ", " + CountiesList[i].CountyCode; } listCounties.Items.Add(s); } }
private void butDelete_Click(object sender, System.EventArgs e) { if (listCounties.SelectedIndex == -1) { MessageBox.Show(Lan.g(this, "Please select an item first.")); return; } County CountyCur = CountiesList[listCounties.SelectedIndex]; string usedBy = Counties.UsedBy(CountyCur.CountyName); if (usedBy != "") { MessageBox.Show(Lan.g(this, "Cannot delete County because it is already in use by the following patients: \r") + usedBy); return; } Counties.Delete(CountyCur); FillList(); }