Ejemplo n.º 1
0
        // スーパーユーザーに限り、登録済カートンをキャンセルできる(インボイス処理後は不可)
        private void btnCancelCarton_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 cartonId = txtCarton.Text;
            TfSQL  tf       = new TfSQL();
            bool   res      = tf.sqlCancelPackInCarton(dtPack, cartonId, txtLoginName.Text);

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

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

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