예제 #1
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (OldFieldName != textName.Text)
     {
         if (ApptFieldDefs.GetExists(x => x.FieldName == textName.Text))
         {
             MsgBox.Show(this, "Field name currently being used.");
             return;
         }
     }
     FieldDef.FieldName = textName.Text;
     FieldDef.FieldType = (ApptFieldType)comboFieldType.SelectedIndex;
     if (FieldDef.FieldType == ApptFieldType.PickList)
     {
         if (textPickList.Text == "")
         {
             MsgBox.Show(this, "List cannot be blank.");
             return;
         }
         FieldDef.PickList = textPickList.Text;
     }
     if (IsNew)
     {
         ApptFieldDefs.Insert(FieldDef);
     }
     else
     {
         ApptFieldDefs.Update(FieldDef, OldFieldName);
     }
     DialogResult = DialogResult.OK;
 }
예제 #2
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     FieldDef.FieldName = textName.Text;
     try {
         if (IsNew)
         {
             ApptFieldDefs.Insert(FieldDef);
         }
         else
         {
             ApptFieldDefs.Update(FieldDef, OldFieldName);
         }
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }