private static async Task <string> GetRedemptionList(string memberCode, DateTime dateFrom, DateTime dateTo) { try { using (var client = new RewardsServicesClient()) { var dateFromString = string.Format("{0:yyyy/M/d HH:mm:ss}", dateFrom); var dateToString = string.Format("{0:yyyy/M/d HH:mm:ss}", dateTo); var dataSet = await client.getRedemptionFEAsync(Convert.ToString(Settings.OperatorId), memberCode, dateFromString, dateToString); if (dataSet.Tables.Count == 0 || dataSet.Tables[0].Rows.Count == 0) { return(string.Empty); } dataSet.Tables[0].Columns.Add("rType"); var dataTable = dataSet.Tables[0]; var headers = string.Empty; var rows = string.Empty; for (var i = 0; i < dataTable.Rows.Count; i++) { if (dataTable.Rows[i]["rType"].ToString() != "0") { dataTable.Rows[i]["rType"] = "Spin Wheel Prize"; } else { dataTable.Rows[i]["rType"] = "Redemption"; } rows += "<tr>"; for (var j = 0; j < dataTable.Columns.Count; j++) { if (i == 0) { switch (dataTable.Columns[j].ColumnName) { case "createdDateTime": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0}</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Label.Date)); break; case "redemptionId": headers += "<td><div class='pointDetailMainHeader'><span>ID</span></div></td>"; break; case "categoryCode": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0} ({1})</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Redemption.Category), RewardsHelper.GetTranslation(TranslationKeys.Label.Points)); break; case "statusName": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0}</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Label.Status)); break; } } switch (j) { case 0: rows += string.Format(@"<td><div class='points'><span>{0}</span></div></td>", string.Format("{0:d/M/yyyy}", Convert.ToDateTime(dataTable.Rows[i].ItemArray[0].ToString()))); break; case 3: rows += string.Format(@"<td><div class='points'><span>{0} ({1})</span></div></td>", dataTable.Rows[i].ItemArray[j], string.Format("{0:#,###,##0.##}", dataTable.Rows[i].ItemArray[4])); break; case 1: rows += string.Format(@"<td><div class='points'><span>{0}</span></div></td>", dataTable.Rows[i].ItemArray[j]); break; case 5: rows += string.Format(@"<td><div class='points'><span>{0}</span></div></td>", dataTable.Rows[i].ItemArray[j]); break; default: rows += string.Empty; break; } } rows += "</tr>"; } return(string.Format(@"<table id='transactions' width='100%'><tr>{0}</tr>{1}</table>", headers, rows)); } } catch (Exception) { return(string.Empty); } }
private static async Task <string> GetTotalStakeDetail(string memberCode, string walletId, string yearMonth) { using (var client = new RewardsServicesClient()) { var year = int.Parse(yearMonth.Substring(0, 4)); var month = (yearMonth.Length > 5) ? int.Parse(yearMonth.Substring(4, 2)) : int.Parse(yearMonth.Substring(4, 1)); var dataSet = await client.getEarnDetailFEAsync(Convert.ToString(Settings.OperatorId), memberCode, walletId, month, year); if (dataSet.Tables.Count == 0 || dataSet.Tables[0].Rows.Count == 0) { return(string.Empty); } var dataTable = dataSet.Tables[0]; var headers = string.Empty; var rows = string.Empty; for (var i = 0; i < dataTable.Rows.Count; i++) { rows += "<tr>"; for (var j = 0; j < dataTable.Columns.Count; j++) { if (i == 0) { switch (dataTable.Columns[j].ColumnName) { case "createdDateTime": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0}</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Label.Date)); break; case "transactionDateTime": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0}</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Redemption.BetDate)); break; case "totalStake": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0}</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Redemption.TotalStake)); break; case "pointsAwarded": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0}</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Redemption.PointsEarned)); break; } } switch (j) { case 2: rows += string.Format(@"<td><div class='points'><span>{0}</span></div></td>", string.Format("{0:#,###,##0.##}", dataTable.Rows[i].ItemArray[j])); break; case 3: rows += string.Format(@"<td><div class='points'><span>{0}</span></div></td>", string.Format("{0:#,###,##0.##}", dataTable.Rows[i].ItemArray[j])); break; default: rows += string.Format(@"<td><div class='points'><span>{0}</span></div></td>", Convert.ToString(DateTime.Parse(dataTable.Rows[i].ItemArray[j].ToString()).ToString("yyyy/MM/dd"))); break; } } rows += "</tr>"; } return(string.Format(@"<table id='transactions' width='100%'><tr>{0}</tr>{1}</table>", headers, rows)); } }
private static async Task <string> GetExpiredList(string memberCode, DateTime dateFrom, DateTime dateTo) { try { using (var client = new RewardsServicesClient()) { var dateFromString = String.Format("{0:yyyy/M/d HH:mm:ss}", dateFrom); var dateToString = String.Format("{0:yyyy/M/d HH:mm:ss}", dateTo); var dataSet = await client.getExpiredFEAsync(Convert.ToString(Settings.OperatorId), memberCode, dateFromString, dateToString); if (dataSet.Tables.Count == 0 || dataSet.Tables[0].Rows.Count == 0) { return(string.Empty); } var dataTable = dataSet.Tables[0]; var headers = string.Empty; var rows = string.Empty; for (var i = 0; i < dataTable.Rows.Count; i++) { if (string.IsNullOrEmpty(dataTable.Rows[i]["remarks"].ToString())) { dataTable.Rows[i]["remarks"] = "-"; } rows += "<tr>"; for (var j = 0; j < dataTable.Columns.Count; j++) { if (i == 0) { switch (dataTable.Columns[j].ColumnName) { case "createdDateTime": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0}</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Label.Date)); break; case "pointsExpired": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0}</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Redemption.PointsExpired)); break; case "remarks": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0}</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Label.Remarks)); break; } } switch (j) { case 8: rows += string.Format(@"<td><div class='points'><span>{0}</span></div></td>", string.Format("{0:dd/MM/yyyy}", Convert.ToDateTime(dataTable.Rows[i].ItemArray[j].ToString()))); break; case 5: rows += string.Format(@"<td><div class='points'><span>{0}</span></div></td>", dataTable.Rows[i].ItemArray[j]); break; case 6: rows += string.Format(@"<td><div class='points'><span>{0}</span></div></td>", dataTable.Rows[i].ItemArray[j]); break; default: rows += string.Empty; break; } } rows += "</tr>"; } return(string.Format(@"<table id='transactions' width='100%'><tr>{0}</tr>{1}</table>", headers, rows)); } } catch (Exception) { return(string.Empty); } }
private static async Task <string> GetTotalStakeByMonth(string memberCode, string walletId) { using (var client = new RewardsServicesClient()) { var dataSet = await client.getEarnMonthFEAsync(Convert.ToString(Settings.OperatorId), memberCode, walletId); if (dataSet.Tables.Count == 0 || dataSet.Tables[0].Rows.Count == 0) { return(string.Empty); } var dataTable = dataSet.Tables[0]; var headers = string.Empty; var rows = string.Empty; for (var i = 0; i < dataTable.Rows.Count; i++) { rows += "<tr>"; for (var j = 0; j < dataTable.Columns.Count; j++) { if (i == 0) { switch (dataTable.Columns[j].ColumnName) { case "pointsYear": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0}</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Label.Year)); break; case "pointsMonth": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0}</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Label.Month)); break; case "totalStake": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0}</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Redemption.TotalStake)); break; case "pointsAwarded": headers += string.Format(@"<td><div class='pointDetailMainHeader'><span>{0}</span></div></td>", RewardsHelper.GetTranslation(TranslationKeys.Redemption.PointsEarned)); break; } } switch (j) { case 2: rows += string.Format(@"<td><div class='points'><span>{0}</span></div></td>", string.Format("{0:#,###,##0.##}", dataTable.Rows[i].ItemArray[j])); break; case 3: rows += string.Format(@"<td><a href='/Account?type=stake&walletid={0}&yearmonth={1}'><div class='points'><span>{2}</span></div></a></td>", walletId, ((string)dataTable.Rows[i].ItemArray[0] + (string)dataTable.Rows[i].ItemArray[1]), string.Format("{0:#,###,##0.##}", dataTable.Rows[i].ItemArray[j])); break; default: rows += string.Format(@"<td><div class='points'><span>{0}</span></div></td>", dataTable.Rows[i].ItemArray[j]); break; } } rows += "</tr>"; } return(string.Format(@"<table id='transactions' width='100%'><tr>{0}</tr>{1}</table>", headers, rows)); } }