예제 #1
0
        // スーパーユーザーに限り、登録済みトレーをキャンセルできる(パック後は不可)
        private void btnCancelTray_Click(object sender, EventArgs e)
        {
            // 本当に削除してよいか、2重で確認する。
            DialogResult result1 = MessageBox.Show("Do you really want to cancel this tray?",   "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);

            if (result1 == DialogResult.No)
            {
                return;
            }

            DialogResult result2 = MessageBox.Show("Are you really sure? Please select NO if you are not sure.", "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);

            if (result2 == DialogResult.No)
            {
                return;
            }

            // キャンセルの実行
            string trayId = txtTrayId.Text;
            TfSQL  tf     = new TfSQL();
            bool   res    = tf.sqlCancelModuleInTray(trayId, txtLoginDept.Text, txtLoginName.Text);

            if (res)
            {
                //本フォームのデータグリットビュー更新
                dtModule.Clear();
                updateDataGridViews(dtModule, ref dgvModule);

                //親フォームfrmTrayのデータグリットビューを更新するため、デレゲートイベントを発生させる
                this.RefreshEvent(this, new EventArgs());
                this.Focus();
                MessageBox.Show("Tray ID " + trayId + " and its modules were canceled.", "Process Result", MessageBoxButtons.OK, MessageBoxIcon.Information);

                // メッセージボックスの確認後、閉じる
                Close();
            }
            else
            {
                MessageBox.Show("Cancel process was not successful.", "Process Result", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }