| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
-
- using System;
- using System.Collections.Generic;
- using Oracle.ManagedDataAccess.Client;
- using System.Linq;
- using System.Web;
- namespace ReportWeb.Models
- {
- public class Services
- {
- public Services()
- {
- //
- // TODO: Add constructor logic here
- //
- }
- public int id { get; set; }
- public string sv_name { get; set; }
- public string sv_code { get; set; }
- // service report
- public string db_name { get; set; }
- public string connection_string { get; set; }
- public string db_username { get; set; }
- public string db_password { get; set; }
- public string sql_report_daily { get; set; }
- public string sql_report_hourly { get; set; }
- // service adv
- public int adv_id { 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; }
- // status
- public int status { get; set; }
- public static List<Services> Parse(OracleDataReader reader)
- {
- List<Services> result = new List<Services>();
- try
- {
- while (reader.Read())
- {
- Services sv = new Services();
- 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_NAME")
- {
- try
- {
- sv.sv_name = 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() == "DB_NAME")
- {
- try
- {
- sv.db_name = reader.GetValue(i).ToString();
- }
- catch { }
- }
- else if (reader.GetName(i).ToUpper() == "CONNECTION_STRING")
- try
- {
- sv.connection_string = reader.GetValue(i).ToString();
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "DB_USERNAME")
- try
- {
- sv.db_username = reader.GetValue(i).ToString();
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "DB_PASSWORD")
- try
- {
- sv.db_password = reader.GetValue(i).ToString();
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "SQL_REPORT_DAILY")
- try
- {
- sv.sql_report_daily = reader.GetValue(i).ToString();
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "SQL_REPORT_HOURLY")
- try
- {
- sv.sql_report_hourly = reader.GetValue(i).ToString();
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "ADV_ID")
- try
- {
- sv.adv_id = int.Parse(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 { }
- }
- result.Add(sv);
- }
- reader.Close();
- }
- catch
- {
- }
- finally
- {
- try
- {
- reader.Close();
- }
- catch { }
- }
- return result;
- }
- }
- }
|