| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- using Oracle.ManagedDataAccess.Client;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace ReportWeb.Models
- {
- public class LuckyCode
- {
- public long id { get; set; }
- public string msisdn { get; set; }
- public string code { get; set; }
- public DateTime? insert_time { get; set; }
- public DateTime? expire_time { get; set; }
- public int period { get; set; }
- public int status { get; set; }
- public DateTime? confirm_time { get; set; }
- public int confirm_channel { get; set; }
- public int fee { get; set; }
- public int count_times { get; set; }
- public int code_type { get; set; }
- public static List<LuckyCode> Parse(OracleDataReader reader)
- {
- List<LuckyCode> result = new List<LuckyCode>();
- try
- {
- while (reader.Read())
- {
- LuckyCode chargeLog = new LuckyCode();
- for (int i = 0; i < reader.FieldCount; i++)
- {
- if (reader.GetName(i).ToUpper() == "MSISDN")
- {
- try
- {
- chargeLog.msisdn = reader.GetValue(i).ToString();
- }
- catch { }
- }
- else if (reader.GetName(i).ToUpper() == "CODE")
- {
- try
- {
- chargeLog.code = reader.GetValue(i).ToString();
- }
- catch { }
- }
- else if (reader.GetName(i).ToUpper() == "INSERT_TIME")
- try
- {
- chargeLog.insert_time = reader.GetDateTime(i);
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "EXPIRE_TIME")
- try
- {
- chargeLog.expire_time = reader.GetDateTime(i);
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "CONFIRM_TIME")
- try
- {
- chargeLog.confirm_time = reader.GetDateTime(i);
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "ID")
- try
- {
- chargeLog.id = long.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "STATUS")
- try
- {
- chargeLog.status = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "PERIOD")
- try
- {
- chargeLog.period = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "CONFIRM_CHANNEL")
- try
- {
- chargeLog.confirm_channel = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "FEE")
- try
- {
- chargeLog.fee = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "COUNT_TIMES")
- try
- {
- chargeLog.count_times = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "CODE_TYPE")
- try
- {
- chargeLog.code_type = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- }
- result.Add(chargeLog);
- }
- reader.Close();
- }
- catch (Exception ex)
- {
- throw ex;
- }
- finally
- {
- try
- {
- reader.Close();
- }
- catch { }
- }
- return result;
- }
- }
- }
|