| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- using Newtonsoft.Json.Linq;
- using Oracle.ManagedDataAccess.Client;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace ReportWeb.Models
- {
- public class PrizeObj
- {
- public long id { get; set; }
- public string action_code { get; set; }
- public string msisdn { get; set; }
- public string code { get; set; }
- public int prize_id { get; set; }
- public string description { get; set; }
- public string description1 { get; set; }
- public string description2 { get; set; }
- public string prize_name { get; set; }
- public string prize_name1 { get; set; }
- public string prize_name2 { get; set; }
- public DateTime? code_time { get; set; }
- public DateTime? process_time { get; set; }
- public string process_by { get; set; }
- public int period { get; set; }
- public int times_prize { get; set; }
- public int status { get; set; }
- public int channel { get; set; }
- public int is_auto { get; set; }
- public int group_prize { get; set; }
- public int sub_group_prize { get; set; }
- public int code_type { get; set; }
- public string statusStr { get; set; }
- public static List<PrizeObj> Parse(OracleDataReader reader)
- {
- List<PrizeObj> result = new List<PrizeObj>();
- try
- {
- while (reader.Read())
- {
- PrizeObj chargeLog = new PrizeObj();
- for (int i = 0; i < reader.FieldCount; i++)
- {
- if (reader.GetName(i).ToUpper() == "ID")
- try
- {
- chargeLog.id = long.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "ACTION_CODE")
- {
- try
- {
- chargeLog.action_code = reader.GetValue(i).ToString();
- }
- catch { }
- }
- else 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() == "PRIZE_ID")
- try
- {
- chargeLog.prize_id = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "PRIZE_NAME")
- {
- try
- {
- JObject json = JObject.Parse(reader.GetValue(i).ToString());
- chargeLog.prize_name = (String)json.GetValue("prizeName");
- chargeLog.prize_name1 = (String)json.GetValue("prizeName1");
- chargeLog.prize_name2 = (String)json.GetValue("prizeName2");
- }
- catch { }
- }
- else if (reader.GetName(i).ToUpper() == "DESCRIPTION")
- {
- try
- {
- JObject json = JObject.Parse(reader.GetValue(i).ToString());
- chargeLog.description = (String)json.GetValue("description");
- chargeLog.description1 = (String)json.GetValue("description1");
- chargeLog.description2 = (String)json.GetValue("description2");
- }
- catch { }
- }
- else if (reader.GetName(i).ToUpper() == "CODE_TIME")
- try
- {
- chargeLog.code_time = reader.GetDateTime(i);
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "PROCESS_TIME")
- try
- {
- chargeLog.process_time = reader.GetDateTime(i);
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "PROCESS_BY")
- {
- try
- {
- chargeLog.process_by = 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() == "TIMES_PRIZE")
- try
- {
- chargeLog.times_prize = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "CHANNEL")
- try
- {
- chargeLog.channel = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "IS_AUTO")
- try
- {
- chargeLog.is_auto = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "GROUP_PRIZE")
- try
- {
- chargeLog.group_prize = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "SUB_GROUP_PRIZE")
- try
- {
- chargeLog.sub_group_prize = 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;
- }
- }
- }
|