public void AddOfferRecord(OfferRecord record) { if (OfferHistory.Count == _offerRecordsLimit) { OfferHistory.RemoveAt(0); } OfferHistory.Add(record); }
//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; } }