private void FrmSetRaspberryRelays_Load(object sender, EventArgs e)
        {
            DataBaseDataContext myConnection = Setting.DataBase;

            RaspBerryPlayingBoard.ShowList(lstRaspberryRelays, myConnection);

            RaspberryPin.LoadComboBoxAvailables(cmbRaspberryRelay, myConnection);

            PlayingBoardGroupTitle.LoadComboBox(cmbPlayingBoardGroupTitle, myConnection);

            if (myConnection.PlayingBoardGroupTitles.Any())
            {
                #region PlayingBoardGroupTitle Cast

                int playingBoardGroupTitleId = ((PlayingBoardGroupTitle)cmbPlayingBoardGroupTitle.SelectedItem).ID;

                if (!PlayingBoardGroupTitle.Validation(playingBoardGroupTitleId, myConnection))
                {
                    DataValidationMesaage.NoDataInBank();

                    return;
                }

                PlayingBoardGroupTitle playingBoardGroupTitle = PlayingBoardGroupTitle.Get(playingBoardGroupTitleId,
                                                                                           myConnection);

                #endregion

                PlayingBoardTitle.LoadComboBox_By_PlayingBoardGroupTitle(cmbPlayingBoardTitle, playingBoardGroupTitle,
                                                                         myConnection);

                if (myConnection.PlayingBoardTitles.Any(a => a.PlayingBoardGroupTitle.Equals(playingBoardGroupTitle)))
                {
                    #region PlayingBoardTitle Cast

                    int playingBoardTitleId = ((PlayingBoardTitle)cmbPlayingBoardTitle.SelectedItem).ID;

                    if (!PlayingBoardTitle.Validation(playingBoardTitleId, myConnection))
                    {
                        DataValidationMesaage.NoDataInBank();

                        return;
                    }

                    PlayingBoardTitle playingBoardTitle = PlayingBoardTitle.Get(playingBoardTitleId, myConnection);

                    #endregion

                    PlayingBoard.LoadComboBoxByFilter(cmbPlayingBoard, playingBoardTitle, myConnection);
                }
            }
        }
        private void cmbPlayingBoardGroupTitle_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataBaseDataContext myConnection = Setting.DataBase;

            if (myConnection.PlayingBoardGroupTitles.Any())
            {
                #region PlayingBoardGroupTitle Cast

                int playingBoardGroupTitleId = ((PlayingBoardGroupTitle)cmbPlayingBoardGroupTitle.SelectedItem).ID;

                if (!PlayingBoardGroupTitle.Validation(playingBoardGroupTitleId, myConnection))
                {
                    DataValidationMesaage.NoDataInBank();

                    return;
                }

                PlayingBoardGroupTitle playingBoardGroupTitle = PlayingBoardGroupTitle.Get(playingBoardGroupTitleId,
                                                                                           myConnection);

                #endregion

                PlayingBoardTitle.LoadComboBox_By_PlayingBoardGroupTitle(cmbPlayingBoardTitle, playingBoardGroupTitle,
                                                                         myConnection);

                if (myConnection.PlayingBoardTitles.Any(a => a.PlayingBoardGroupTitle.Equals(playingBoardGroupTitle)))
                {
                    #region PlayingBoardTitle Cast

                    int playingBoardTitleId = ((PlayingBoardTitle)cmbPlayingBoardTitle.SelectedItem).ID;

                    if (!PlayingBoardTitle.Validation(playingBoardTitleId, myConnection))
                    {
                        DataValidationMesaage.NoDataInBank();

                        return;
                    }

                    PlayingBoardTitle playingBoardTitle = PlayingBoardTitle.Get(playingBoardTitleId, myConnection);

                    #endregion

                    PlayingBoard.LoadComboBoxByFilter(cmbPlayingBoard, playingBoardTitle, myConnection);
                }
            }
        }
Exemplo n.º 3
0
        private void cmbPlayingBoardGroupTitle_SelectedIndexChanged(object sender, EventArgs e)
        {
            gridPlayingBoard.Rows.Clear();

            DataBaseDataContext myConnection = Setting.DataBase;

            if (myConnection.PlayingBoardGroupTitles.Any())
            {
                btnAddPlayingboardTitle.Visible = true;

                #region PlayingBoardGroupTitle Cast

                int playingBoardGroupTitleId = ((PlayingBoardGroupTitle)cmbPlayingBoardGroupTitle.SelectedItem).ID;

                if (!PlayingBoardGroupTitle.Validation(playingBoardGroupTitleId, myConnection))
                {
                    DataValidationMesaage.NoDataInBank();

                    return;
                }

                PlayingBoardGroupTitle playingBoardGroupTitle = PlayingBoardGroupTitle.Get(playingBoardGroupTitleId,
                                                                                           myConnection);

                #endregion

                PlayingBoardTitle.LoadComboBox_By_PlayingBoardGroupTitle(cmbPlayingBoardTitle, playingBoardGroupTitle,
                                                                         myConnection);

                if (myConnection.PlayingBoardTitles.Any(a => a.PlayingBoardGroupTitle.Equals(playingBoardGroupTitle)))
                {
                    #region PlayingBoardTitle Cast

                    int playingBoardTitleId = ((PlayingBoardTitle)cmbPlayingBoardTitle.SelectedItem).ID;

                    if (!PlayingBoardTitle.Validation(playingBoardTitleId, myConnection))
                    {
                        DataValidationMesaage.NoDataInBank();

                        return;
                    }

                    PlayingBoardTitle playingBoardTitle = PlayingBoardTitle.Get(playingBoardTitleId, myConnection);

                    #endregion

                    PlayingBoard.LoadGridColorful_By_PlayingBoardTitle(gridPlayingBoard, playingBoardTitle, myConnection);
                }
            }

            else
            {
                btnAddPlayingboardTitle.Visible = false;

                cmbPlayingBoardTitle.Items.Add("گروه بازی کامل شود");

                cmbPlayingBoardTitle.SelectedIndex = 0;

                return;
            }
        }