| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- using Newtonsoft.Json;
- using Oracle.ManagedDataAccess.Client;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- namespace ReportWeb.Models
- {
- public class ListAdv
- {
- public string id { get; set; }
- public string percent { get; set; }
- }
- public class Root
- {
- public List<ListAdv> listAdv { get; set; }
- }
- public class SvAdv
- {
- public int id { get; set; }
- public int schedule_detail_id { get; set; }
- public string sv_code { get; set; }
- public string msg_adv { get; set; }
- public string adv_name { get; set; }
- public string channel_adv { get; set; }
- public string message_type { get; set; }
- public string from_money { get; set; }
- public int status { get; set; }
- public int percent { get; set; }
- public int counter { get; set; }
- public DateTime report_date { get; set; }
- public DateTime start_time { get; set; }
- public DateTime end_time { get; set; }
- public static List<SvAdv> Parse(OracleDataReader reader)
- {
- List<SvAdv> result = new List<SvAdv>();
- try
- {
- while (reader.Read())
- {
- SvAdv sv = new SvAdv();
- for (int i = 0; i < reader.FieldCount; i++)
- {
- if (reader.GetName(i).ToUpper() == "ID")
- try
- {
- sv.id = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "SV_CODE")
- {
- try
- {
- sv.sv_code = reader.GetValue(i).ToString();
- }
- catch { }
- }
- else if (reader.GetName(i).ToUpper() == "MSG_ADV")
- try
- {
- sv.msg_adv = reader.GetValue(i).ToString();
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "ADV_NAME")
- try
- {
- sv.adv_name = reader.GetValue(i).ToString();
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "MESSAGE_TYPE")
- try
- {
- sv.message_type = reader.GetValue(i).ToString();
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "CHANNEL_ADV")
- try
- {
- sv.channel_adv = reader.GetValue(i).ToString();
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "FROM_MONEY")
- try
- {
- sv.from_money = reader.GetValue(i).ToString();
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "STATUS")
- try
- {
- sv.status = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "PERCENT")
- try
- {
- sv.percent = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "COUNTER")
- try
- {
- sv.counter = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "START_TIME")
- try
- {
- sv.start_time = reader.GetDateTime(i);
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "END_TIME")
- try
- {
- sv.end_time = reader.GetDateTime(i);
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "REPORT_DATE")
- try
- {
- sv.report_date = reader.GetDateTime(i);
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "SCHEDULE_DETAIL_ID")
- try
- {
- sv.schedule_detail_id = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- }
- result.Add(sv);
- }
- reader.Close();
- }
- catch
- {
- }
- finally
- {
- try
- {
- reader.Close();
- }
- catch { }
- }
- return result;
- }
- }
- }
|