private void butOK_Click(object sender, System.EventArgs e) { //can only get to here if not IsNew FillCur(); Screens.Update(ScreenCur); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { //the first 6 fields are handled when the ScreenGroup is saved. if (!_isValid) //If validation failed and they still want to continue, do Cancel instead. { DialogResult = DialogResult.Cancel; return; } ScreenCur.ScreenGroupOrder = PIn.Int(textScreenGroupOrder.Text); ScreenCur.ScreenGroupNum = ScreenGroupCur.ScreenGroupNum; if (radioUnknown.Checked) { ScreenCur.Gender = PatientGender.Unknown; } else if (radioM.Checked) { ScreenCur.Gender = PatientGender.Male; } else if (radioF.Checked) { ScreenCur.Gender = PatientGender.Female; } ScreenCur.RaceOld = (PatientRaceOld)listRace.SelectedIndex; ScreenCur.GradeLevel = (PatientGrade)comboGradeLevel.SelectedIndex; if (textBirthdate.Text != "" && textAge.Text == "") //Birthdate is present but age isn't entered, calculate it. { ScreenCur.Age = PIn.Byte(Patients.DateToAge(PIn.DateT(textBirthdate.Text)).ToString()); } else if (textAge.Text != "") //Age was manually entered, use it. { ScreenCur.Age = PIn.Byte(textAge.Text); } else //No age information was entered at all. { ScreenCur.Age = 0; } ScreenCur.Urgency = (TreatmentUrgency)listUrgency.SelectedIndex; ScreenCur.HasCaries = GetCheckState(checkHasCaries); ScreenCur.NeedsSealants = GetCheckState(checkNeedsSealants); ScreenCur.CariesExperience = GetCheckState(checkCariesExperience); ScreenCur.EarlyChildCaries = GetCheckState(checkEarlyChildCaries); ScreenCur.ExistingSealants = GetCheckState(checkExistingSealants); ScreenCur.MissingAllTeeth = GetCheckState(checkMissingAllTeeth); ScreenCur.Birthdate = PIn.Date(textBirthdate.Text); //"" is OK ScreenCur.Comments = textComments.Text; if (IsNew) { Screens.Insert(ScreenCur); } else { Screens.Update(ScreenCur); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { //the first 6 fields are handled when the ScreenGroup is saved. ScreenCur.ScreenGroupOrder = PIn.Int(textScreenGroupOrder.Text); ScreenCur.ScreenGroupNum = ScreenGroupCur.ScreenGroupNum; if (radioUnknown.Checked) { ScreenCur.Gender = PatientGender.Unknown; } else if (radioM.Checked) { ScreenCur.Gender = PatientGender.Male; } else if (radioF.Checked) { ScreenCur.Gender = PatientGender.Female; } ScreenCur.Race = (PatientRaceOld)listRace.SelectedIndex; ScreenCur.GradeLevel = (PatientGrade)comboGradeLevel.SelectedIndex; ScreenCur.Age = PIn.Byte(textAge.Text);//"" is OK ScreenCur.Urgency = (TreatmentUrgency)listUrgency.SelectedIndex; ScreenCur.HasCaries = GetCheckState(checkHasCaries); ScreenCur.NeedsSealants = GetCheckState(checkNeedsSealants); ScreenCur.CariesExperience = GetCheckState(checkCariesExperience); ScreenCur.EarlyChildCaries = GetCheckState(checkEarlyChildCaries); ScreenCur.ExistingSealants = GetCheckState(checkExistingSealants); ScreenCur.MissingAllTeeth = GetCheckState(checkMissingAllTeeth); ScreenCur.Birthdate = PIn.Date(textBirthdate.Text); //"" is OK ScreenCur.Comments = textComments.Text; if (IsNew) { Screens.Insert(ScreenCur); } else { Screens.Update(ScreenCur); } DialogResult = DialogResult.OK; }