//Convert parameters into object, save to database, and return object
        public void DBSaveWinInfo(string mobile, int gameID, string gameToken, string objectsSelected)
        {
            try
            {
                string CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);

                DataSet             result   = new DataSet();
                List <SqlParameter> spParams = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                spParams.Add(new SqlParameter("@GameID", gameID));
                spParams.Add(new SqlParameter("@GameToken", gameToken));
                spParams.Add(new SqlParameter("@ObjectsSelected", objectsSelected));

                result = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);
                if (result.Tables[0].Rows.Count > 0)
                {
                    GameNameForDisplay      = result.Tables[0].Rows[0]["GameName"].ToString();
                    ClosingCaption          = result.Tables[0].Rows[0]["ClosingCaption"].ToString();
                    PrizePickUpDescription  = result.Tables[0].Rows[0]["PrizePickupDescription"].ToString();
                    CallToActionCaption     = result.Tables[0].Rows[0]["CallToActionCaption"].ToString();
                    CallToActionText        = result.Tables[0].Rows[0]["CallToActionText"].ToString();
                    CallToActionIsScrolling = Convert.ToBoolean(result.Tables[0].Rows[0]["CallToActionScrolling"].ToString());
                }
                else
                {
                    throw new Exception("DBSaveWinInfo Failed");
                }
            }

            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
                RemoveData();
            }
        }
Exemplo n.º 2
0
 public void DBGetLogo(string mobile)
 {
     try
     {
         string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
         DataSet             result      = new DataSet();
         List <SqlParameter> spParams    = new List <SqlParameter>();
         spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
         result = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);
         if (result.Tables[0].Rows.Count > 0)
         {
             MemoryStream ms    = new MemoryStream((byte[])result.Tables[0].Rows[0][""]);
             byte[]       bytes = ms.ToArray();
             logo = bytes;
         }
         else
         {
             logo = null;
         }
     }
     catch (SqlException ex)
     {
         string errorMessage = ex.Message;
         logo = null;
     }
 }
Exemplo n.º 3
0
        public void DBEnterRemoteEntry(string mobile, int promotionID)
        {
            PromotionID = promotionID;
            try
            {
                string CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);

                DataSet             result   = new DataSet();
                List <SqlParameter> spParams = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                spParams.Add(new SqlParameter("@PromotionID", promotionID));
                result = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);

                if (result.Tables[0].Rows.Count > 0)
                {
                    UpdateEntryCount     = Convert.ToInt32(result.Tables[0].Rows[0]["UpdateEntryCount"].ToString());
                    RemoteEntryAvaliable = Convert.ToBoolean(result.Tables[0].Rows[0]["RemoteEntryAvaliable"].ToString());
                }
                else
                {
                    RemoveData();
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
                RemoveData();
            }
        }
        public void DBStartGame(string mobile, int gameID, long PromotionID)
        {
            try
            {
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                StartGameReturn     data        = new StartGameReturn();
                DataSet             result      = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@GameID", gameID));
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                spParams.Add(new SqlParameter("@PromotionID", PromotionID));
                result = DataAcess.ExecuteQuerySP("PEC.MG_PROMOTION_StartGame", spParams);

                if (result.Tables[0].Rows.Count > 0)
                {
                    GameToken        = result.Tables[0].Rows[0]["GameToken"].ToString();
                    StartGameCaption = result.Tables[0].Rows[0]["StartGameCaption"].ToString();
                    StartGameText    = result.Tables[0].Rows[0]["StartGameText"].ToString();
                }
                else
                {
                    RemoveData();
                }
            }

            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
                RemoveData();
            }
        }
        public void DBExecuteRedemptionOption(string mobile, int offerID, int optionReferenceID)
        {
            try
            {
                OfferID           = offerID;
                OptionReferenceID = optionReferenceID;
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                DataSet             result      = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                spParams.Add(new SqlParameter("@OfferID", OfferID));
                spParams.Add(new SqlParameter("@OptionReferenceID", OptionReferenceID));

                result = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);

                if (result.Tables[0].Rows.Count > 0)
                {
                    RedemptionExecutionSucess = true;
                    HeaderCaptionLine1        = result.Tables[0].Rows[0][""].ToString();
                    BodyCaptionLine1          = result.Tables[0].Rows[0][""].ToString();
                    HeaderCaptionLine2        = result.Tables[0].Rows[0][""].ToString();
                    BodyCaptionLine2          = result.Tables[0].Rows[0][""].ToString();
                    FooterCaptionLine1        = result.Tables[0].Rows[0][""].ToString();
                    FooterCaptionLine2        = result.Tables[0].Rows[0][""].ToString();

                    MemoryStream ms    = new MemoryStream((byte[])result.Tables[0].Rows[0][""]);
                    byte[]       bytes = ms.ToArray();
                    if (bytes != null)
                    {
                        BodyImage1 = bytes;
                    }
                    else
                    {
                        BodyImage1 = null;
                    }

                    MemoryStream bodyImage2MS    = new MemoryStream((byte[])result.Tables[0].Rows[0][""]);
                    byte[]       bodyImage2Bytes = bodyImage2MS.ToArray();
                    if (bodyImage2Bytes != null)
                    {
                        BodyImage2 = bodyImage2Bytes;
                    }
                    else
                    {
                        BodyImage2 = null;
                    }
                    BodyImage2 = bodyImage2Bytes;
                }
                else
                {
                    RemoveData();
                    RedemptionExecutionSucess = false;
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
                RemoveData();
            }
        }
Exemplo n.º 6
0
        public void DBEnrollGuestInEvent(string mobile, int eventID, int optionReferenceID)
        {
            try
            {
                EventID           = eventID;
                OptionReferenceID = optionReferenceID;
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                DataSet             result      = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                spParams.Add(new SqlParameter("@EventID", eventID));
                result             = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);
                HeaderCaptionLine1 = result.Tables[0].Rows[0]["HeaderCaptionLine1"].ToString();
                HeaderCaptionLine2 = result.Tables[0].Rows[0][""].ToString();
                IsEnrolled         = Convert.ToBoolean(result.Tables[0].Rows[0][""].ToString());
                ConfirmationNumber = result.Tables[0].Rows[0][""].ToString();
                MemoryStream bodyImage1MS   = new MemoryStream((byte[])result.Tables[0].Rows[0][""]);
                byte[]       bodyImage1Byte = bodyImage1MS.ToArray();
                BodyImage1 = bodyImage1Byte;

                MemoryStream bodyImage2MS   = new MemoryStream((byte[])result.Tables[0].Rows[0][""]);
                byte[]       bodyImage2Byte = bodyImage2MS.ToArray();
                BodyImage2 = bodyImage2Byte;

                FooterCaptionLine1 = result.Tables[0].Rows[0][""].ToString();
                FooterCaptionLine2 = result.Tables[0].Rows[0][""].ToString();
            }
            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
                RemoveData();
            }
        }
Exemplo n.º 7
0
        public void DBGetAccountBalancesSet(string mobile)
        {
            try
            {
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                DataSet             result      = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                result = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);
                if (result.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < result.Tables[0].Rows.Count; i++)
                    {
                        Account newAccount = new Account();
                        newAccount.accountName    = result.Tables[0].Rows[i][""].ToString();
                        newAccount.accountBalance = result.Tables[0].Rows[i][""].ToString();

                        AccountBalances.Add(newAccount);
                    }
                }
                else
                {
                    AccountBalances = null;
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
            }
        }
Exemplo n.º 8
0
        // Generate a one way hash, API does not specify implementation
        public void GenerateOneWayHash(string mobile)
        {
            //SHould set userToken = to something
            string CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
            //Generate hash based on mobile and current time
            string generatedHash = "hash";

            userToken = generatedHash;
        }
Exemplo n.º 9
0
        public void DBGetEventsScreenWrapper(string mobile)
        {
            try
            {
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                DataSet             result      = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));

                result = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);

                if (result.Tables[0].Rows.Count > 0)
                {
                    Line1Caption = result.Tables[0].Rows[0][""].ToString();
                    Line1Data    = result.Tables[0].Rows[0][""].ToString();
                    Line2Caption = result.Tables[0].Rows[0][""].ToString();
                    Line2Data    = result.Tables[0].Rows[0][""].ToString();


                    DataSet             buttonDS     = new DataSet();
                    List <SqlParameter> buttonParams = new List <SqlParameter>();
                    buttonParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                    buttonDS = DataAcess.ExecuteQuerySP("PEC.TODO", buttonParams);

                    if (buttonDS.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < buttonDS.Tables[0].Rows.Count; i++)
                        {
                            EventButton newButton = new EventButton();
                            newButton.ButtonCaption = result.Tables[0].Rows[i][""].ToString();
                            newButton.ButtonOrdPos  = Convert.ToInt32(result.Tables[0].Rows[i][""].ToString());
                            newButton.ButtonEventID = Convert.ToInt32(result.Tables[0].Rows[i][""].ToString());
                            MemoryStream ButtonMS    = new MemoryStream((byte[])result.Tables[0].Rows[i][""]);
                            byte[]       ButtonBytes = ButtonMS.ToArray();
                            newButton.ButtonImage = ButtonBytes;
                            Buttons.Add(newButton);
                        }
                    }
                    else
                    {
                        Buttons = null;
                    }
                }
                else
                {
                    RemoveData();
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
                RemoveData();
            }
        }
Exemplo n.º 10
0
        //DB Get Promotions Screen Wrapper from SQL Server
        public void DBGetPromotionsScreenWrapperReturn(string mobile)
        {
            try
            {
                string CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);

                DataSet             result   = new DataSet();
                List <SqlParameter> spParams = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                result = DataAcess.ExecuteQuerySP("PEC.PROMOTIONS_GetWrapper", spParams);

                if (result.Tables[0].Rows.Count > 0)
                {
                    Line1Caption = result.Tables[0].Rows[0]["Line1Caption"].ToString();
                    Line1Data    = result.Tables[0].Rows[0]["Line1Data"].ToString();
                    Line2Caption = result.Tables[0].Rows[0]["Line2Caption"].ToString();
                    Line2Data    = result.Tables[0].Rows[0]["Line2Data"].ToString();

                    DataSet             buttonDS     = new DataSet();
                    List <SqlParameter> buttonParams = new List <SqlParameter>();
                    buttonParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                    buttonDS = DataAcess.ExecuteQuerySP("PEC.PROMOTIONS_WrapperButtons", buttonParams);

                    if (buttonDS.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < buttonDS.Tables[0].Rows.Count; i++)
                        {
                            PromoButton newButton = new PromoButton();
                            newButton.ButtonCaption = buttonDS.Tables[0].Rows[i]["ButtonCaption"].ToString();
                            newButton.ButtonOrdPos  = Convert.ToInt32(buttonDS.Tables[0].Rows[i]["ButtonOrdPos"].ToString());
                            Buttons.Add(newButton);
                        }
                    }
                    else
                    {
                        RemoveData();
                    }
                }
                else
                {
                    RemoveData();
                }
            }



            catch (SqlException ex)
            {
                RemoveData();
                string errorMessage = ex.Message;
            }
        }
Exemplo n.º 11
0
        public void DBListEntriesInNextDraw(string mobile, int promotionID)
        {
            try
            {
                PromotionID = promotionID;
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                DataSet             result      = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                spParams.Add(new SqlParameter("@PromotionID", PromotionID));
                result = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);

                if (result.Tables[0].Rows.Count > 0)
                {
                    NextDrawDate       = Convert.ToDateTime(result.Tables[0].Rows[0]["NextDrawDate"].ToString());
                    NextDrawTime       = Convert.ToDateTime(result.Tables[0].Rows[0]["NextDrawTime"].ToString());
                    EntriesForNextDraw = Convert.ToInt32(result.Tables[0].Rows[0]["EntriesForNextDraw"].ToString());
                    IsDrumPopulated    = Convert.ToBoolean(result.Tables[0].Rows[0]["IsPopulated"].ToString());
                    SpecialMessage     = result.Tables[0].Rows[0]["SpecialMessage"].ToString();
                    if (IsDrumPopulated)
                    {
                        DataSet entryDS = new DataSet();
                        entryDS = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);
                        if (entryDS.Tables[0].Rows.Count > 0)
                        {
                            for (int i = 0; i < entryDS.Tables[0].Rows.Count; i++)
                            {
                                string entryNum = entryDS.Tables[0].Rows[i]["EntryNumber"].ToString();
                                EntryNumbers.Add(entryNum);
                            }
                        }
                        else
                        {
                            EntryNumbers = null;
                        }
                    }
                    else
                    {
                        EntryNumbers = null;
                    }
                }
                else
                {
                    RemoveData();
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
                RemoveData();
            }
        }
        // TODO: Binary Data for background
        // LARS: What is the binary data I'm looking for here? Not sure based on API Doc
        public void DBGetIntervalsAndBackgrounds(string mobile, int gameID, int variantID)
        {
            string CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);

            DataSet             result   = new DataSet();
            List <SqlParameter> spParams = new List <SqlParameter>();

            spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
            spParams.Add(new SqlParameter("@GameID", gameID));
            spParams.Add(new SqlParameter("@VariantID", variantID));

            result = DataAcess.ExecuteQuerySP("MG_PROMOTION_BACKGROUND_GetByGameID", spParams);

            if (result.Tables[0].Rows.Count > 0)
            {
                for (int j = 0; j < result.Tables[0].Rows.Count; j++)
                {
                    AttributeInfo gameAttributes = new AttributeInfo();
                    gameAttributes.GameName       = result.Tables[0].Rows[j]["gameName"].ToString();
                    gameAttributes.PageName       = result.Tables[0].Rows[j]["pageName"].ToString();
                    gameAttributes.TypeName       = result.Tables[0].Rows[j]["typename"].ToString();
                    gameAttributes.ObjectName     = result.Tables[0].Rows[j]["objectName"].ToString();
                    gameAttributes.AttributeName  = result.Tables[0].Rows[j]["attributeName"].ToString();
                    gameAttributes.AttributeValue = result.Tables[0].Rows[j]["attributeValue"].ToString();

                    DataSet             binaryData   = new DataSet();
                    List <SqlParameter> binaryParams = new List <SqlParameter>();
                    binaryParams.Add(new SqlParameter("@GameID", gameID));
                    binaryParams.Add(new SqlParameter("@VariantID", variantID));

                    binaryData = DataAcess.ExecuteQuerySP("TODO", binaryParams);

                    if (binaryData.Tables[0].Rows.Count > 0)
                    {
                        MemoryStream ms    = new MemoryStream((byte[])binaryData.Tables[0].Rows[0]["attributeBinaryData"]);
                        byte[]       bytes = ms.ToArray();
                        gameAttributes.AttributeBinaryValue = bytes;
                    }
                    else
                    {
                        gameAttributes.AttributeBinaryValue = null;
                    }
                    Attributes.Add(gameAttributes);
                }
            }

            else
            {
                RemoveData();
            }
        }
Exemplo n.º 13
0
        public void DBPurchaseTicketsToEventWithPoints(string mobile, int eventID, int optionReferenceID, int ticketCountRequested)
        {
            try
            {
                EventID           = eventID;
                OptionReferenceID = optionReferenceID;
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                DataSet             result      = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                spParams.Add(new SqlParameter("@EventID", eventID));
                spParams.Add(new SqlParameter("@OptionReferenceID", optionReferenceID));
                spParams.Add(new SqlParameter("@TicketCountRequested", ticketCountRequested));

                result                   = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);
                HeaderCaptionLine1       = result.Tables[0].Rows[0]["HeaderCaptionLine1"].ToString();
                HeaderCaptionLine2       = result.Tables[0].Rows[0][""].ToString();
                IsPurchaseSuccessful     = Convert.ToBoolean(result.Tables[0].Rows[0][""].ToString());
                NewPointsBalance         = float.Parse(result.Tables[0].Rows[0][""].ToString());
                IsEnrolled               = Convert.ToBoolean(result.Tables[0].Rows[0][""].ToString());
                ConfirmationNumber       = result.Tables[0].Rows[0][""].ToString();
                TicketCountAwarded       = Convert.ToInt32(result.Tables[0].Rows[0][""].ToString());
                IsOnWaitList             = Convert.ToBoolean(result.Tables[0].Rows[0][""].ToString());
                ExpectedResponseInterval = result.Tables[0].Rows[0][""].ToString();

                MemoryStream bodyImage1MS   = new MemoryStream((byte[])result.Tables[0].Rows[0][""]);
                byte[]       bodyImage1Byte = bodyImage1MS.ToArray();
                BodyImage1 = bodyImage1Byte;

                MemoryStream bodyImage2MS   = new MemoryStream((byte[])result.Tables[0].Rows[0][""]);
                byte[]       bodyImage2Byte = bodyImage2MS.ToArray();
                BodyImage2 = bodyImage2Byte;

                FooterCaptionLine1 = result.Tables[0].Rows[0][""].ToString();
                FooterCaptionLine2 = result.Tables[0].Rows[0][""].ToString();
            }
            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
                RemoveData();
            }
        }
Exemplo n.º 14
0
        public void DBClaimBonusCoupons(string mobile, int promotionID)
        {
            try
            {
                PromotionID = promotionID;
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                DataSet             result      = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                spParams.Add(new SqlParameter("@PromotionID", PromotionID));
                result = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);

                if (result.Tables[0].Rows.Count > 0)
                {
                    ClaimButtonRemainsVisible = Convert.ToBoolean(result.Tables[0].Rows[0][""].ToString());
                    ClaimButtonRemainsActive  = Convert.ToBoolean(result.Tables[0].Rows[0][""].ToString());
                    ClaimButtonNewCaption     = result.Tables[0].Rows[0][""].ToString();

                    MemoryStream ms    = new MemoryStream((byte[])result.Tables[0].Rows[0]["Image"]);
                    byte[]       bytes = ms.ToArray();
                    ClaimButtonNewImage = bytes;

                    DataSet             descDS     = new DataSet();
                    List <SqlParameter> descParams = new List <SqlParameter>();
                    descParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                    descParams.Add(new SqlParameter("@PromotionID", PromotionID));
                    descDS = DataAcess.ExecuteQuerySP("PEC.TODO", descParams);


                    if (descDS.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < descDS.Tables[0].Rows.Count; i++)
                        {
                            ResultDescriptionBonus newRDB = new ResultDescriptionBonus();
                            newRDB.ResultCaption        = descDS.Tables[0].Rows[i][""].ToString();
                            newRDB.ResultUpdatedElement = descDS.Tables[0].Rows[i][""].ToString();

                            MemoryStream msResult    = new MemoryStream((byte[])descDS.Tables[0].Rows[i]["Image"]);
                            byte[]       resultBytes = msResult.ToArray();
                            newRDB.ResultImage = resultBytes;

                            DataSet             dP           = new DataSet();
                            List <SqlParameter> pointsParams = new List <SqlParameter>();
                            pointsParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                            pointsParams.Add(new SqlParameter("@PromotionID", PromotionID));
                            dP = DataAcess.ExecuteQuerySP("PEC.TODO", pointsParams);
                            if (dP.Tables[0].Rows.Count > 0)
                            {
                                for (int j = 0; j < dP.Tables[0].Rows.Count; j++)
                                {
                                    DataPoint newPoint = new DataPoint();
                                    newPoint.DataPointCaption = dP.Tables[0].Rows[i]["DataPointCaption"].ToString();
                                    newPoint.DataPointData    = dP.Tables[0].Rows[i]["DataPointData"].ToString();
                                    newRDB.DataPoints.Add(newPoint);
                                }
                            }
                            else
                            {
                                newRDB.DataPoints = null;
                            }
                        }
                    }
                    else
                    {
                        ResultDescriptions = null;
                    }
                }
                else
                {
                    RemoveData();
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
                RemoveData();
            }
        }
Exemplo n.º 15
0
        public void DBGetEventDetails(string mobile, int eventID)
        {
            try
            {
                EventID = eventID;
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                DataSet             result      = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                spParams.Add(new SqlParameter("@EventID", eventID));
                result = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);

                if (result.Tables[0].Rows.Count > 0)
                {
                    HeaderCaptionLine1 = result.Tables[0].Rows[0][""].ToString();
                    HeaderCaptionLine2 = result.Tables[0].Rows[0][""].ToString();
                    EventCaption       = result.Tables[0].Rows[0][""].ToString();
                    EventStartDate     = Convert.ToDateTime(result.Tables[0].Rows[0][""]);
                    EventStartTime     = Convert.ToDateTime(result.Tables[0].Rows[0][""]);
                    EventEndDate       = Convert.ToDateTime(result.Tables[0].Rows[0][""]);
                    EventEndTime       = Convert.ToDateTime(result.Tables[0].Rows[0][""]);
                    DisplayOptions     = Convert.ToBoolean(result.Tables[0].Rows[0][""]);
                    FooterCaptionLine1 = result.Tables[0].Rows[0][""].ToString();
                    FooterCaptionLine2 = result.Tables[0].Rows[0][""].ToString();
                    MemoryStream ms         = new MemoryStream((byte[])result.Tables[0].Rows[0]["LargeImage"]);
                    byte[]       largeImage = ms.ToArray();
                    EventLargeImage = largeImage;

                    if (DisplayOptions)
                    {
                        DataSet             optionDS     = new DataSet();
                        List <SqlParameter> optionParams = new List <SqlParameter>();
                        optionParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                        optionParams.Add(new SqlParameter("@EventID", EventID));
                        optionDS = DataAcess.ExecuteQuerySP("PEC.TODO", optionParams);
                        if (optionDS.Tables[0].Rows.Count > 0)
                        {
                            for (int i = 0; i < optionDS.Tables[0].Rows.Count; i++)
                            {
                                EventOption newEvent = new EventOption();
                                newEvent.OptionCaption    = optionDS.Tables[0].Rows[i]["OptionCaption"].ToString();
                                newEvent.OptionExecutable = Convert.ToBoolean(optionDS.Tables[0].Rows[i]["OptionExecutable"].ToString());
                                MemoryStream optionMS        = new MemoryStream((byte[])optionDS.Tables[0].Rows[i]["OptionImage"]);
                                byte[]       optionImageByte = optionMS.ToArray();
                                newEvent.OptionImage       = optionImageByte;
                                newEvent.OptionReferenceID = Convert.ToInt32(optionDS.Tables[0].Rows[i]["ReferenceID"].ToString());
                                EventOptions.Add(newEvent);
                            }
                        }
                        else
                        {
                            EventOptions = null;
                        }
                    }
                    else
                    {
                        EventOptions = null;
                    }
                }
                else
                {
                    RemoveData();
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
                RemoveData();
            }
        }
        //SQL DB Function to get games wrapper from DB
        public void DBGetGamesScreenWrapper(string mobile)
        {
            try
            {
                string CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);

                DataSet             headerDS     = new DataSet();
                List <SqlParameter> headerParams = new List <SqlParameter>();
                headerParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                headerDS = DataAcess.ExecuteQuerySP("PEC.", headerParams);

                if (headerDS.Tables[0].Rows.Count > 0)
                {
                    headerCaption = headerDS.Tables[0].Rows[0]["HeaderCaption"].ToString();
                    headerData    = headerDS.Tables[0].Rows[0]["HeaderData"].ToString();
                }

                DataSet             result   = new DataSet();
                List <SqlParameter> spParams = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                result = DataAcess.ExecuteQuerySP("PEC.PROMOTION_ID_GetByCMSPlayerID", spParams);


                if (result.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < result.Tables[0].Rows.Count; i++)
                    {
                        PromotionID.Add(Int64.Parse(result.Tables[0].Rows[i]["PromotionID"].ToString()));
                    }
                    foreach (long ID in PromotionID)
                    {
                        //GET Game Attributes from GD_PROMOtionGames
                        DataSet             ds         = new DataSet();
                        List <SqlParameter> gameParams = new List <SqlParameter>();
                        gameParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                        gameParams.Add(new SqlParameter("@PromotionID", ID));

                        ds = DataAcess.ExecuteQuerySP("PEC.MG_PROMOTION_WRAPPER_GetByPromotionID", gameParams);

                        DataSet imageSet = new DataSet();
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            Game newGame = new Game();
                            newGame.GameID            = ds.Tables[0].Rows[0]["GameID"].ToString();
                            newGame.GameName          = ds.Tables[0].Rows[0]["GameName"].ToString();
                            newGame.GameDescription   = ds.Tables[0].Rows[0]["GameDescription"].ToString();
                            newGame.ButtonDescription = ds.Tables[0].Rows[0]["ButtonDesc"].ToString();
                            newGame.IsButtonEnabled   = Convert.ToBoolean(ds.Tables[0].Rows[0]["isButtonEnabled"].ToString());

                            DataSet             imageData  = new DataSet();
                            List <SqlParameter> imageParam = new List <SqlParameter>();
                            imageParam.Add(new SqlParameter("@PromotionID", ID));
                            imageData = DataAcess.ExecuteQuerySP("MG_PROMOTION_WRAPPER_ReadGameIcon", imageParam);
                            if (imageData.Tables[0].Rows.Count > 0)
                            {
                                MemoryStream ms    = new MemoryStream((byte[])imageData.Tables[0].Rows[0]["promoKioskImage"]);
                                byte[]       bytes = ms.ToArray();
                                newGame.GameIcon = bytes;
                            }
                            else
                            {
                                newGame.GameIcon = null;
                            }
                            Games.Add(newGame);
                        }
                    }
                }
            }

            catch (SqlException ex)
            {
                RemoveData();
                string errorMessage = ex.Message;
            }
        }
        //SQL DB Retrieval Function:
        public void DBViewOfferRedemptionHistoryReturn(string mobile)
        {
            try
            {
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                DataSet             result      = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));

                result = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);

                if (result.Tables[0].Rows.Count > 0)
                {
                    HeaderCaptionLine1 = result.Tables[0].Rows[0]["HeaderCaption"].ToString();
                    HeaderCaptionLine2 = result.Tables[0].Rows[0]["HeaderCaptionLine2"].ToString();
                    OfferHistoryExists = Convert.ToBoolean(result.Tables[0].Rows[0]["OfferHistoryExists"].ToString());
                    FooterCaptionLine1 = result.Tables[0].Rows[0]["HeaderCaption"].ToString();
                    FooterCaptionLine2 = result.Tables[0].Rows[0]["HeaderCaption"].ToString();
                    if (OfferHistoryExists)
                    {
                        DataSet             oHDS = new DataSet();
                        List <SqlParameter> offerHistoryParams = new List <SqlParameter>();
                        offerHistoryParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));

                        oHDS = DataAcess.ExecuteQuerySP("PEC.TODO", offerHistoryParams);
                        for (int i = 0; i < oHDS.Tables[0].Rows.Count; i++)
                        {
                            Offer newOffer = new Offer();
                            newOffer.Description = oHDS.Tables[0].Rows[i][""].ToString();
                            newOffer.Value       = oHDS.Tables[0].Rows[i][""].ToString();
                            newOffer.ExpiresDate = Convert.ToDateTime(oHDS.Tables[0].Rows[i][""].ToString());
                            newOffer.IssuedDate  = Convert.ToDateTime(oHDS.Tables[0].Rows[i][""].ToString());
                            newOffer.PrizeType   = oHDS.Tables[0].Rows[i][""].ToString();
                            newOffer.IsExpired   = Convert.ToBoolean(oHDS.Tables[0].Rows[i][""].ToString());
                            newOffer.IsRedeemed  = Convert.ToBoolean(oHDS.Tables[0].Rows[i][""].ToString());
                            newOffer.HasBarcode  = Convert.ToBoolean(oHDS.Tables[0].Rows[i][""].ToString());
                            if (newOffer.HasBarcode)
                            {
                                MemoryStream ms    = new MemoryStream((byte[])oHDS.Tables[0].Rows[i][""]);
                                byte[]       bytes = ms.ToArray();
                                newOffer.Barcode = bytes;
                            }
                            else
                            {
                                newOffer.Barcode = null;
                            }

                            OfferHistory.Add(newOffer);
                        }
                    }
                }
                else
                {
                    RemoveData();
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
            }
        }
        // TODO: ADD binary data SP
        // LARS: Where do I find the binary data for page attributes? Not clear from API DOC
        public void DBGetPageAttributes(string mobile, string inPageName, int gameID)
        {
            try
            {
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                DataSet             result      = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@GameID", gameID));

                result = DataAcess.ExecuteQuerySP("PEC.MG_PROMOTION_GetGameNameANDCaption_ByGameID", spParams);
                if (result.Tables[0].Rows.Count > 0)
                {
                    GameName = result.Tables[0].Rows[0]["GameName"].ToString();
                    PageName = inPageName;
                    Caption  = result.Tables[0].Rows[0]["Caption"].ToString();

                    DataSet             aR        = new DataSet();
                    List <SqlParameter> attParams = new List <SqlParameter>();
                    attParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                    attParams.Add(new SqlParameter("@GameID", gameID));
                    attParams.Add(new SqlParameter("@PageName", PageName));

                    aR = DataAcess.ExecuteQuerySP("PEC.MG_PROMOTION_GetPageAttributes", attParams);

                    if (aR.Tables[0].Rows.Count > 0)
                    {
                        for (int j = 0; j < aR.Tables[0].Rows.Count; j++)
                        {
                            Attributes pageAttributes = new Attributes();
                            pageAttributes.TypeName       = aR.Tables[0].Rows[j]["TypeName"].ToString();
                            pageAttributes.ObjectName     = aR.Tables[0].Rows[j]["ObjectName"].ToString();
                            pageAttributes.AttributeName  = aR.Tables[0].Rows[j]["AttributeName"].ToString();
                            pageAttributes.AttributeValue = aR.Tables[0].Rows[j]["AttributeValue"].ToString();


                            DataSet             binaryData   = new DataSet();
                            List <SqlParameter> binaryParams = new List <SqlParameter>();
                            binaryParams.Add(new SqlParameter("@GameID", gameID));
                            binaryParams.Add(new SqlParameter("@PageName", PageName));

                            binaryData = DataAcess.ExecuteQuerySP("TODO", binaryParams);

                            if (binaryData.Tables[0].Rows.Count > 0)
                            {
                                MemoryStream ms    = new MemoryStream((byte[])binaryData.Tables[0].Rows[0]["attributeBinaryData"]);
                                byte[]       bytes = ms.ToArray();
                                pageAttributes.AttributeValueBinary = bytes;
                            }
                            else
                            {
                                pageAttributes.AttributeValueBinary = null;
                            }

                            listAttributes.Add(pageAttributes);
                        }
                    }
                    //ELSE: There are no attributes for a given pageNumber
                    else
                    {
                        RemoveData();
                    }
                }
                else
                {
                    RemoveData();
                }
            }

            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
                RemoveData();
            }
        }
        public void DBGetGameInfoForPromotion(string mobile, int gameID, string gameToken)
        {
            try
            {
                string CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);

                DataSet             result   = new DataSet();
                List <SqlParameter> spParams = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                spParams.Add(new SqlParameter("@GameID", gameID));
                spParams.Add(new SqlParameter("@GameToken", gameToken));


                result = DataAcess.ExecuteQuerySP("PEC.MG_", spParams);
                if (result.Tables[0].Rows.Count > 0)
                {
                    variantID          = Convert.ToInt32(result.Tables[0].Rows[0]["VariantID"].ToString());
                    gameNameForDisplay = result.Tables[0].Rows[0]["GameName"].ToString();
                    playInstructions   = result.Tables[0].Rows[0]["PlayInstructions"].ToString();
                    gameType           = result.Tables[0].Rows[0]["GameType"].ToString();



                    DataSet             gameDS  = new DataSet();
                    List <SqlParameter> gParams = new List <SqlParameter>();
                    gParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                    gParams.Add(new SqlParameter("@GameID", gameID));
                    gParams.Add(new SqlParameter("@VariantID", variantID));

                    gameDS = DataAcess.ExecuteQuerySP("PEC.MG_PROMOTIONS_GetGameObjects", gParams);

                    for (int i = 0; i < gameDS.Tables[0].Rows.Count; i++)
                    {
                        GameObject newObject = new GameObject();
                        newObject.ObjectName       = gameDS.Tables[0].Rows[i]["ObjectName"].ToString();
                        newObject.ObjectID         = Convert.ToInt32(gameDS.Tables[0].Rows[i]["ObjectID"].ToString());
                        newObject.GOAttributeName  = gameDS.Tables[0].Rows[i]["AttributeName"].ToString();
                        newObject.GOAttributeValue = gameDS.Tables[0].Rows[i]["AttributeValue"].ToString();

                        DataSet             imageData  = new DataSet();
                        List <SqlParameter> imageParam = new List <SqlParameter>();
                        imageParam.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                        imageParam.Add(new SqlParameter("@GameID", gameID));
                        imageParam.Add(new SqlParameter("@VariantID", variantID));

                        imageData = DataAcess.ExecuteQuerySP("MG_PROMOTION_GameObjectGetImage", imageParam);
                        if (imageData.Tables[0].Rows.Count > 0)
                        {
                            MemoryStream ms    = new MemoryStream((byte[])imageData.Tables[0].Rows[0]["GameObjectAttributeBinary"]);
                            byte[]       bytes = ms.ToArray();
                            newObject.GOAttributeValueBinary = bytes;
                        }
                        else
                        {
                            newObject.GOAttributeValueBinary = null;
                        }
                        GameObjects.Add(newObject);
                    }
                }
                else
                {
                    throw new Exception("No data");
                }
            }

            catch (Exception)
            {
                RemoveData();
            }
        }
        public void DBGetOfferDetails(string mobile, int offerID)
        {
            try
            {
                OfferID = offerID;
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                DataSet             result      = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                spParams.Add(new SqlParameter("@OfferID", OfferID));

                result = DataAcess.ExecuteQuerySP("PEC.TODO", spParams);

                if (result.Tables[0].Rows.Count > 0)
                {
                    HeaderCaptionLine1 = result.Tables[0].Rows[0][""].ToString();
                    HeaderCaptionLine2 = result.Tables[0].Rows[0][""].ToString();
                    OfferCaption       = result.Tables[0].Rows[0][""].ToString();
                    FooterCaptionLine1 = result.Tables[0].Rows[0][""].ToString();
                    FooterCaptionLine2 = result.Tables[0].Rows[0][""].ToString();
                    OfferID            = Convert.ToInt32(result.Tables[0].Rows[0][""].ToString());
                    DisplayOptions     = Convert.ToBoolean(result.Tables[0].Rows[0][""].ToString());

                    MemoryStream ms    = new MemoryStream((byte[])result.Tables[0].Rows[0][""]);
                    byte[]       bytes = ms.ToArray();
                    OfferLargeImage = bytes;

                    MemoryStream barcodeMS    = new MemoryStream((byte[])result.Tables[0].Rows[0][""]);
                    byte[]       barcodeBytes = barcodeMS.ToArray();
                    OfferBarcode = barcodeBytes;

                    if (DisplayOptions)
                    {
                        DataSet             optionDS     = new DataSet();
                        List <SqlParameter> optionParams = new List <SqlParameter>();
                        optionParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                        optionParams.Add(new SqlParameter("@OfferID", OfferID));

                        optionDS = DataAcess.ExecuteQuerySP("PEC.TODO", optionParams);
                        if (optionDS.Tables[0].Rows.Count > 0)
                        {
                            for (int i = 0; i < optionDS.Tables[0].Rows.Count; i++)
                            {
                                Option newOption = new Option();
                                newOption.OptionCaption = result.Tables[0].Rows[i][""].ToString();
                                MemoryStream optionMS    = new MemoryStream((byte[])result.Tables[0].Rows[i][""]);
                                byte[]       optionBytes = optionMS.ToArray();
                                newOption.OptionImage       = optionBytes;
                                newOption.OptionExecutable  = Convert.ToBoolean(result.Tables[0].Rows[i][""].ToString());
                                newOption.OptionReferenceID = Convert.ToInt32(result.Tables[0].Rows[i][""].ToString());

                                OfferOptions.Add(newOption);
                            }
                        }
                        else
                        {
                            OfferOptions = null;
                        }
                    }
                    else
                    {
                        OfferOptions = null;
                    }
                }
                else
                {
                    RemoveData();
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
                RemoveData();
            }
        }
Exemplo n.º 21
0
        //DB Get Promotion List
        public void DBGetPromotionList(string mobile)
        {
            try
            {
                string              CMSPlayerID = ServerSide.DBGetCMSPlayerID(mobile);
                DataSet             ds          = new DataSet();
                List <SqlParameter> spParams    = new List <SqlParameter>();
                spParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                ds = DataAcess.ExecuteQuerySP("PEC.PROMOTIONS_GetPromotionList_ByCMSPlayerID", spParams);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        Promotion newPromo = new Promotion();
                        newPromo.PromotionID          = Convert.ToInt32(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.PromoVersionID       = Convert.ToInt32(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.GameID               = Convert.ToInt32(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.PromotionName        = ds.Tables[0].Rows[i][""].ToString();
                        newPromo.StartDate            = Convert.ToDateTime(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.EndDate              = Convert.ToDateTime(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.Enrolled             = Convert.ToBoolean(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.CouponsAvaliable     = Convert.ToBoolean(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.NextDrawingDate      = Convert.ToDateTime(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.CheckInAvaliable     = Convert.ToBoolean(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.CheckInStatusMessage = ds.Tables[0].Rows[i][""].ToString();
                        newPromo.FreeEntryAvaliable   = Convert.ToBoolean(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.RemoteEntryAvaliable = Convert.ToBoolean(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.PointsToDate         = Convert.ToInt32(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.EntriesToDate        = Convert.ToInt32(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.PointsPerEntry       = Convert.ToInt32(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.TodaysPoint          = Convert.ToInt32(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.DailyEntryLImit      = Convert.ToInt32(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.ThresholdType        = ds.Tables[0].Rows[i][""].ToString();
                        newPromo.ThresholdPoints      = Convert.ToInt32(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.PrizeName            = ds.Tables[0].Rows[i][""].ToString();
                        newPromo.ThresholdReached     = Convert.ToBoolean(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.PrizeClaimed         = Convert.ToBoolean(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.GameAvaliable        = Convert.ToBoolean(ds.Tables[0].Rows[i][""].ToString());
                        newPromo.RaffleAvaliable      = Convert.ToBoolean(ds.Tables[0].Rows[i][""].ToString());

                        DataSet             raffleDS     = new DataSet();
                        List <SqlParameter> raffleParams = new List <SqlParameter>();
                        raffleParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                        raffleDS = DataAcess.ExecuteQuerySP("PEC.PROMOTIONS_GetPromotionRaffleTickets", raffleParams);

                        if (raffleDS.Tables[0].Rows.Count > 0)
                        {
                            for (int j = 0; j < raffleDS.Tables[0].Rows.Count; j++)
                            {
                                RaffleTicketList newRaffleTicket = new RaffleTicketList();
                                newRaffleTicket.RaffleTicket = raffleDS.Tables[0].Rows[j][""].ToString();
                                newPromo.RaffleTickets.Add(newRaffleTicket);
                            }
                        }
                        else
                        {
                            newPromo.RaffleTickets = null;
                        }

                        DataSet             imageDS     = new DataSet();
                        List <SqlParameter> imageParams = new List <SqlParameter>();
                        imageParams.Add(new SqlParameter("@CMSPlayerID", CMSPlayerID));
                        imageDS = DataAcess.ExecuteQuerySP("PEC.PROMOTIONS_GetPromotionImage", imageParams);

                        if (imageDS.Tables[0].Rows.Count > 0)
                        {
                            MemoryStream ms    = new MemoryStream((byte[])imageDS.Tables[0].Rows[0]["Image"]);
                            byte[]       bytes = ms.ToArray();
                            newPromo.PromotionImage = bytes;
                        }
                        else
                        {
                            newPromo.PromotionImage = null;
                        }

                        Promotions.Add(newPromo);
                    }
                }
                else
                {
                    RemoveData();
                }
            }
            catch (SqlException ex)
            {
                string errorMessage = ex.Message;
                RemoveData();
            }
        }