コード例 #1
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDescription.Text == "")
            {
                MsgBox.Show(this, "Please enter a description");
                return;
            }
            if (this.textDataFileName.Text == "" ||
                this.textTemplateName.Text == "")
            {
                MsgBox.Show(this, "Filenames cannot be left blank.");
                return;
            }
            if (comboCategory.SelectedIndex == -1)
            {
                MsgBox.Show(this, "Please select a category");
                return;
            }
            if (listPatSelect.SelectedIndices.Count == 0 &&
                listReferral.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "Please select at least one field.");
                return;
            }
            Cursor.Current              = Cursors.WaitCursor;
            LetterMergeCur.Description  = textDescription.Text;
            LetterMergeCur.TemplateName = textTemplateName.Text;
            LetterMergeCur.DataFileName = textDataFileName.Text;
            LetterMergeCur.Category
                = DefB.Short[(int)DefCat.LetterMergeCats][comboCategory.SelectedIndex].DefNum;
            if (IsNew)
            {
                LetterMerges.Insert(LetterMergeCur);
            }
            else
            {
                LetterMerges.Update(LetterMergeCur);
            }
            LetterMergeFields.DeleteForLetter(LetterMergeCur.LetterMergeNum);
            LetterMergeField field;

            for (int i = 0; i < listPatSelect.SelectedItems.Count; i++)
            {
                field = new LetterMergeField();
                field.LetterMergeNum = LetterMergeCur.LetterMergeNum;
                field.FieldName      = (string)listPatSelect.SelectedItems[i];
                //(string)listPatSelect.Items[listPatSelect.SelectedIndices[i]];
                LetterMergeFields.Insert(field);
            }
            for (int i = 0; i < listReferral.SelectedItems.Count; i++)
            {
                field = new LetterMergeField();
                field.LetterMergeNum = LetterMergeCur.LetterMergeNum;
                field.FieldName      = "referral." + (string)listReferral.SelectedItems[i];
                LetterMergeFields.Insert(field);
            }
            Cursor.Current = Cursors.Default;
            DialogResult   = DialogResult.OK;
        }
コード例 #2
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (!MsgBox.Show(this, true, "Delete?"))
     {
         return;
     }
     LetterMerges.Delete(LetterMergeCur);
     DialogResult = DialogResult.OK;
 }
コード例 #3
0
ファイル: FormLetterMerges.cs プロジェクト: royedwards/DRDNet
 private void FillLetters()
 {
     listLetters.Items.Clear();
     if (listCategories.SelectedIndex == -1)
     {
         ListForCat = new List <LetterMerge>();
         return;
     }
     LetterMergeFields.RefreshCache();
     LetterMerges.RefreshCache();
     ListForCat = LetterMerges.GetListForCat(listCategories.SelectedIndex);
     for (int i = 0; i < ListForCat.Count; i++)
     {
         listLetters.Items.Add(ListForCat[i].Description);
     }
 }