Exemplo n.º 1
0
        public static void Save(MySqlConnection sqlConnection, S_Game game, S_Frame frame)
        {
            long?frameId = null;

            frame.gameId = game.id;

            if (!FrameManager.FrameExistByGameIdAndFrameNumber(sqlConnection, game.id, frame.frameNumber, out frameId))
            {
                frame.id = Insert(sqlConnection, frame).Value;
            }
            else
            {
                frame.id = frameId.Value;
                // update progressiveTotal and isConvertedsplit
                Update(sqlConnection, frame);
            }

            if (frame.bowl1 != null)
            {
                frame.bowl1.bowlNumber = 1;
                BowlManager.Save(sqlConnection, frame, frame.bowl1);
            }

            if (frame.bowl2 != null)
            {
                frame.bowl2.bowlNumber = 2;
                BowlManager.Save(sqlConnection, frame, frame.bowl2);
            }

            if (frame.bowl3 != null)
            {
                frame.bowl3.bowlNumber = 3;
                BowlManager.Save(sqlConnection, frame, frame.bowl3);
            }
        }
Exemplo n.º 2
0
        public static void Save(MySqlConnection sqlConnection, S_Frame frame, S_Bowl bowl)
        {
            long?bowlId = null;

            bowl.frameId = frame.id;

            if (!BowlManager.BowlExistByFrameIdAndBowlNumber(sqlConnection, frame.id, bowl.bowlNumber, out bowlId))
            {
                bowl.id = Insert(sqlConnection, bowl).Value;
            }
            else
            {
                bowl.id = bowlId.Value;
                // Update total, is... and pins
                Update(sqlConnection, bowl);
            }
        }