예제 #1
0
 protected virtual void OnValidateAeRole(AeRoleEventArgs e)
 {
     if (ValidateAeRoleData != null)
     {
         ValidateAeRoleData(this, e);
     }
 }
예제 #2
0
        private void Dialog_ValidateAeRoleData(object sender, AeRoleEventArgs e)
        {
            string error = string.Empty;
            InsertModifyAeRoleDialog dialog = (InsertModifyAeRoleDialog)sender;

            e.IsValid = true;

            // Clear existing errors
            dialog.ValidateAeTitle(string.Empty);
            dialog.ValidateRole(string.Empty);

            // AETitle
            if (!Leadtools.DicomDemos.Utils.IsValidApplicationEntity(e.AeRole.AeTitle, out error))
            {
                dialog.ValidateAeTitle(error);
                e.IsValid = false;
            }
            else if (e.IsInsert && (aeRoleList.MyContains(e.AeRole)))
            {
                // insert -- verify AeTile does not already exist
                dialog.ValidateAeTitle("Record already exists with this AE Title and Role.");
                e.IsValid = false;
            }
            else if (!e.IsInsert && e.IsNewAeTitle && (aeRoleList.MyContains(e.AeRole)))
            {
                // modify and the aeTitle has changed -- verify the AeTitle does not already exist
                dialog.ValidateAeTitle("Record already exists with this AE Title and Role.");
                e.IsValid = false;
            }
        }
예제 #3
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            AeRoleEventArgs eventArgs = new AeRoleEventArgs();

            eventArgs.IsInsert = DialogType == InsertModifyAeRoleControlType.Insert;
            eventArgs.IsValid  = true;
            eventArgs.AeRole   = aeRole;

            string newAeTitle = aeRole.AeTitle.Trim();

            eventArgs.IsNewAeTitle = string.Compare(newAeTitle, _originalAeTitle, true) != 0;
            OnValidateAeRole(eventArgs);
            if (eventArgs.IsValid)
            {
                DialogResult = DialogResult.OK;
                Close();
            }
        }