public void ClearCusomizeNames() { helper.ClearTextBox(TxtNewDr); helper.ClearTextBox(TxtNewHospital); helper.ClearTextBox(TxtNewLocation); helper.ClearTextBox(TxtNewLevel); helper.ClearTextBox(TxtNewCpt); helper.ClearTextBox(TxtNewDx); helper.ClearTextBox(TxtNewSurgery); helper.ClearTextBox(TxtNewInst); helper.ClearTextBox(TxtNewComp); TxtNewDr.Focus(); }
private bool IsDrValid() { bool result = true; string DisplayMsg = null; string DisplayTitle = null; // Can not add blank doctor if (TxtNewDr.Text.Trim() == "" || TxtNewDr.Text.Length == 0) { DisplayMsg = "Doctor can not be blank."; DisplayTitle = "Blank Doctor Name"; result = false; } // Can not be duplicate if (GlobalVar.Folders.Contains(TxtNewDr.Text.ToLower())) { DisplayMsg = "Doctor name already exists."; DisplayTitle = "Doctor Exists"; result = false; } // Can not be numeric var isNumeric = int.TryParse(TxtNewDr.Text.Trim(), out int n); if (isNumeric) { DisplayMsg = "Doctor name can not be numeric."; DisplayTitle = "Numeric Doctor Name"; result = false; } // No spaces if (TxtNewDr.Text.Trim().Contains(" ")) { DisplayMsg = "Doctor name can not contain spaces."; DisplayTitle = "Spaes in Doctor Name"; result = false; } if (result == false) { TxtNewDr.Focus(); TxtNewDr.SelectAll(); MessageBox.Show(DisplayMsg, DisplayTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } return(result); }