//OKボタン private void button3_Click(object sender, EventArgs e) { if (!initialAvailableTransRule_.All(tr => tr == textBox1.Text || listBox1.Items.Contains(tr))) { DialogResult res = MessageBox.Show("変換キーが削除されています。削除された変換キーは二度と復元できませんが、よろしいですか?", "設定保存確認", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2); if (res == DialogResult.No) { this.DialogResult = DialogResult.None; return; } } if (!listBox1.Items.Contains(textBox1.Text)) { MessageBox.Show("選択されている変換キーが候補一覧に含まれていません。候補一覧に追加します。", "設定保存確認"); listBox1.Items.Add(textBox1.Text); } sd_ = new SettingData(); foreach (string str in listBox1.Items) { sd_.encryptStrings.Add(str); } sd_.selectedEnc = textBox1.Text; sd_.encryptId = checkBox1.Checked; sd_.ambiguousBirthDate = checkBox2.Checked; sd_.ambiguousPostalCode = checkBox3.Checked; sd_.birthDateModifyType = BirthDateModifier.getTypeNum(comboBox1.Text); sd_.postalCodeModifyType = PostalCodeModifier.getTypeNum(comboBox2.Text); sd_.serialize(); }
//編集(登録)ボタン private void button3_Click(object sender, EventArgs e) { if (textBox1.ReadOnly) { if (listBox1.SelectedIndex == -1) { return; } listBoxEventEnable = false; //編集可にする tboxs.ToList().ForEach(tb => tb.ReadOnly = false); button3.Text = "登録"; listBoxEventEnable = true; } else { //登録する uint idcp, bdcp, pccp, bdccp, pcccp, adcp; if (!validateInt(textBox2, out idcp, label3)) { return; } if (!validateInt(textBox3, out bdcp, label4)) { return; } if (!validateInt(textBox4, out pccp, label5)) { return; } if (!validateInt(textBox5, out bdccp, label6)) { return; } if (!validateInt(textBox7, out pcccp, label8)) { return; } if (!validateInt(textBox9, out adcp, label10)) { return; } listBoxEventEnable = false; FileType selft = sd_.types[listBox1.SelectedItem.ToString()]; if (!sd_.types.ContainsKey(textBox1.Text)) { sd_.types.Remove(listBox1.SelectedItem.ToString()); sd_.types.Add(textBox1.Text, selft); listBox1.Items[listBox1.SelectedIndex] = textBox1.Text; } selft.typeName = textBox1.Text; selft.idColumn = idcp; selft.birthDateColumn = bdcp; selft.postalCodeColumn = pccp; selft.birthDateConditionColumn = bdccp; selft.birthDateConditionMatch = textBox6.Text; selft.postalCodeConditionColumn = pcccp; selft.postalCodeConditionMatch = textBox8.Text; selft.admissionDateColumn = adcp; selft.namingRule = textBox10.Text; sd_.serialize(); tboxs.ToList().ForEach(tb => tb.ReadOnly = true); button3.Text = "編集"; listBoxEventEnable = true; } }