예제 #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (lstPlayingBoardTypes.SelectedItems.Count == 0)
            {
                DataValidationMesaage.NoSelectedItemFromList(lstPlayingBoardTypes.Text);

                return;
            }

            DataBaseDataContext myConnection = Setting.DataBase;

            PlayingBoardType playingBoardType = (PlayingBoardType)(lstPlayingBoardTypes.SelectedItems[0].Tag);

            if (!PlayingBoardType.Validation(playingBoardType.ID, myConnection))
            {
                DataValidationMesaage.NoDataInBank();

                return;
            }

            playingBoardType = PlayingBoardType.Get(playingBoardType.ID, myConnection);

            DialogResult message = DataValidationMesaage.ConfirmDeleteData(playingBoardType.Type);

            if (message == DialogResult.Yes)
            {
                PlayingBoardType.Delete(playingBoardType, myConnection);

                DataValidationMesaage.DeleteMessage();

                PlayingBoardType.ShowList_By_PlayingBoard(FrmPlayingBoard.SelectedPlayingBoard, lstPlayingBoardTypes,
                                                          myConnection);
            }

            myConnection.Dispose();
        }