| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
-
- using System;
- using System.Collections.Generic;
- using Oracle.ManagedDataAccess.Client;
- using System.Linq;
- using System.Web;
- namespace ReportWeb.Models
- {
- public class UserCoin
- {
- public UserCoin()
- { }
- public string msisdn { get; set; }
- public int rank { get; set; }
- public DateTime? start_time { get; set; }
- public DateTime? end_time { get; set; }
- public DateTime? last_update { get; set; }
- public int total_coin { get; set; }
- public string product_name { get; set; }
- public static List<UserCoin> Parse(OracleDataReader reader)
- {
- List<UserCoin> result = new List<UserCoin>();
- try
- {
- while (reader.Read())
- {
- UserCoin UserCoin = new UserCoin();
- for (int i = 0; i < reader.FieldCount; i++)
- {
- if (reader.GetName(i).ToUpper() == "MSISDN")
- {
- try
- {
- UserCoin.msisdn = reader.GetValue(i).ToString();
- }
- catch { }
- }
- else if (reader.GetName(i).ToUpper() == "START_TIME")
- try
- {
- UserCoin.start_time = reader.GetDateTime(i);
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "END_TIME")
- try
- {
- UserCoin.end_time = reader.GetDateTime(i);
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "LAST_UPDATE")
- try
- {
- UserCoin.last_update = reader.GetDateTime(i);
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "TOTAL_COIN")
- {
- try
- {
- UserCoin.total_coin = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- }
- else if (reader.GetName(i).ToUpper() == "PRODUCT_NAME")
- {
- try
- {
- UserCoin.product_name = (string)reader.GetValue(i);
- }
- catch { }
- }
- else if (reader.GetName(i).ToUpper() == "RANK")
- {
- try
- {
- UserCoin.rank = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- }
- }
- result.Add(UserCoin);
- }
- reader.Close();
- }
- catch
- {
- }
- finally
- {
- try
- {
- reader.Close();
- }
- catch { }
- }
- return result;
- }
- }
- }
|