private static bool ValidateDrawingDate(DrawingDateBO drawingDateToValidate, ref BrokenRuleCollection brokenRules)
        {
            //Set default return value to true
            bool returnValue = true;

            //Validate email address
            if (drawingDateToValidate != null)
            {
                if (drawingDateToValidate.DrawingDate == DateTime.MinValue)
                {
                    //Email was not in a valid format
                    brokenRules.Add("Drawing Date", "is an invalid email format.");
                    returnValue = false;
                }
                if (drawingDateToValidate.DrawingDate > DateTime.Now)
                {
                    //Email cannot be a date beyond the current date
                    brokenRules.Add("Drawing Date " + drawingDateToValidate.DrawingDate.ToString(), "cannot be a future date.");

                }
                if(drawingDateToValidate.DrawingDate == DateTime.MinValue)
                {
                    //Emailis required
                    brokenRules.Add("Drawing Date", "Drawing date is required");
                    returnValue = false;
                }
            }
            else
            {
                //Generic error - class not instantiated
                brokenRules.Add("Drawing Date", "Drawing Date was not instantiated.");
                returnValue = false;
            }
            return returnValue;
        }
        public static int Save(int drawingDateId, int gameId, DrawingDateBO drawingDateToSave)
        {
            //Instantiates a brokenRules collection and check for any validation errors
            BrokenRuleCollection saveBrokenRules = new BrokenRuleCollection();

            if (gameId <= 0)
            {
                saveBrokenRules.Add("Drawing date", "Invalid game id");
            }

            ValidateDrawingDate(drawingDateToSave, ref saveBrokenRules);

            if (saveBrokenRules.Count() > 0)
            {
                throw new BLLException("There was an error saving email.", saveBrokenRules);
            }
            else
            {
                //Call DAL to save
                return DrawingDateDAL.Save(drawingDateId, gameId, drawingDateToSave);
            }
        }
        /// <summary>
        /// Initializes a new instance of the DrawingDate class and fills it with the data from the IDataRecord
        /// </summary>
        /// <param name="myDataRecord"></param>
        /// <returns></returns>
        private static DrawingDateBO FillDataRecord(IDataRecord myDataRecord)
        {
            DrawingDateBO myDrawingDateObject = new DrawingDateBO();
            myDrawingDateObject.WinningNumbers = new WinningNumbers();

            myDrawingDateObject.DrawingDateId = myDataRecord.GetInt32(myDataRecord.GetOrdinal("DrawingDateId"));

            if (!myDataRecord.IsDBNull(myDataRecord.GetOrdinal("DrawingDate")))
            {
                myDrawingDateObject.DrawingDate = myDataRecord.GetDateTime(myDataRecord.GetOrdinal("DrawingDate"));
            }
            if (!myDataRecord.IsDBNull(myDataRecord.GetOrdinal("Jackpot")))
            {
                myDrawingDateObject.Jackpot = myDataRecord.GetInt32(myDataRecord.GetOrdinal("Jackpot"));
            }

            return myDrawingDateObject;
        }
        /// <summary>
        /// Initializes a new instance of the DrawingDate class and fills it with the data from the IDataRecord
        /// </summary>
        /// <param name="myDataRecord"></param>
        /// <returns></returns>
        private static DrawingDateBO FillDataRecordWinningNums(IDataRecord myDataRecord)
        {
            DrawingDateBO myDrawingDateObject = new DrawingDateBO();
            myDrawingDateObject.WinningNumbers = new WinningNumbers();

            if (!myDataRecord.IsDBNull(myDataRecord.GetOrdinal("WinningNumbersId")))
            {
                myDrawingDateObject.WinningNumbers.WinningNumbersId = myDataRecord.GetInt32(myDataRecord.GetOrdinal("WinningNumbersId"));
            }
            if (!myDataRecord.IsDBNull(myDataRecord.GetOrdinal("NumberValue")))
            {
                myDrawingDateObject.WinningNumbers.NumberValue = myDataRecord.GetInt32(myDataRecord.GetOrdinal("NumberValue"));
            }

            return myDrawingDateObject;
        }
        public static int Save(int drawingDateId, int gameId, DrawingDateBO drawingDateToSave)
        {
            ExecuteTypeEnum queryId = ExecuteTypeEnum.InsertItem;
            int result = 0;

            if (drawingDateId > 0)
            {
                queryId = ExecuteTypeEnum.UpdateItem;
            }

            using (SqlConnection myConnection = new SqlConnection(AppConfiguration.ConnectionString))
            {
                using (SqlCommand myCommand = new SqlCommand("usp_ExecuteDrawingDate", myConnection))
                {
                    myCommand.CommandType = CommandType.StoredProcedure;

                    myCommand.Parameters.AddWithValue("@QueryId", queryId);
                    myCommand.Parameters.AddWithValue("@DrawingDateId", drawingDateId);

                    if (drawingDateToSave.DrawingDate != null)
                    {
                        myCommand.Parameters.AddWithValue("@DrawingDate", drawingDateToSave.DrawingDate);
                    }
                    if (drawingDateToSave.Jackpot != null)
                    {
                        myCommand.Parameters.AddWithValue("@Jackpot", drawingDateToSave.Jackpot);
                    }
                    if (gameId != null)
                    {
                        myCommand.Parameters.AddWithValue("@GameId", gameId);
                    }

                    //add return output parameter to command object
                    myCommand.Parameters.Add(HelperDAL.GetReturnParameterInt("ReturnValue"));

                    myConnection.Open();
                    myCommand.ExecuteNonQuery();

                    //Get return value from stored procedure and return Id
                    result = (int)myCommand.Parameters["@ReturnValue"].Value;
                }
                myConnection.Close();
            }
            return result;
        }