コード例 #1
0
 private void butOK_Click(object sender, EventArgs e)
 {
     AutoNoteCur.AutoNoteName = textBoxAutoNoteName.Text;
     AutoNoteCur.MainText     = textMain.Text;
     if (IsNew)
     {
         AutoNotes.Insert(AutoNoteCur);
     }
     else
     {
         AutoNotes.Update(AutoNoteCur);
     }
     DialogResult = DialogResult.OK;
 }
コード例 #2
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (textBoxAutoNoteName.Text == "")
            {
                MsgBox.Show(this, "Please enter a name for the Auto Note into the text box");
                return;
            }
            //bool IsUsed=AutoNotes.AutoNoteNameUsed(textBoxAutoNoteName.Text.ToString(),AutoNoteCur.AutoNoteName);
            //if(IsUsed) {
            //	MsgBox.Show(this,"This name is already used please choose a different name");
            //	return;
            //}

            /*if (listBoxControlsToIncl.Items.Count==0) {
             *      MsgBox.Show(this, "Please add some controls to the Auto Note");
             *      return;
             * }*/
            //Save changes to database here
            //Saves the items in the listboxControlsToIncl in a array that will be passed on
            string controlsToIncText = "";

            for (int i = 0; i < listBoxControlToIncNum.Items.Count; i++)
            {
                if (listBoxControlsToIncl.Items[i].ToString() != "")
                {
                    controlsToIncText = controlsToIncText + listBoxControlToIncNum.Items[i].ToString() + ",";
                }
            }
            AutoNoteCur.ControlsToInc = controlsToIncText;
            AutoNoteCur.AutoNoteName  = textBoxAutoNoteName.Text.ToString();
            if (IsNew)
            {
                AutoNotes.Insert(AutoNoteCur);
            }
            else
            {
                AutoNotes.Update(AutoNoteCur);
            }
            DialogResult = DialogResult.OK;
        }