Esempio n. 1
0
        // スーパーユーザーに限り、登録済パックをキャンセルできる(カートン処理後は不可)
        private void btnCancelPack_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 packId = txtPackId.Text;
            TfSQL  tf     = new TfSQL();
            bool   res    = tf.sqlCancelTrayInPack(dtTray, packId, txtLoginName.Text);

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

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

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