| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- using System;
- using System.Collections.Generic;
- using Oracle.ManagedDataAccess.Client;
- namespace ReportWeb.Models
- {
- public class ReportDetail
- {
- public ReportDetail()
- { }
- public int service_id { get; set; }
- public string service_name { get; set; }
- public string report_date { get; set; }
- public long revenue_others { get; set; }
- public long revenue_mocha { get; set; }
- public long revenue_web { get; set; }
- public long revenue_buy_others { get; set; }
- public long revenue_buy_mocha { get; set; }
- public long revenue_buy_web { get; set; }
- public long count_reg_others { get; set; }
- public long count_reg_mocha { get; set; }
- public long count_reg_web { get; set; }
- public static List<ReportDetail> Parse(OracleDataReader reader)
- {
- List<ReportDetail> result = new List<ReportDetail>();
- try
- {
- while (reader.Read())
- {
- ReportDetail report = new ReportDetail();
- for (int i = 0; i < reader.FieldCount; i++)
- {
- if (reader.GetName(i).ToUpper() == "SERVICE_ID")
- {
- try
- {
- report.service_id = int.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- }
- else if (reader.GetName(i).ToUpper() == "SERVICE_NAME")
- try
- {
- report.service_name = reader.GetValue(i).ToString();
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "REPORT_DATE")
- try
- {
- report.report_date = reader.GetValue(i).ToString();
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "REVENUE_MOCHA")
- try
- {
- report.revenue_mocha = long.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "REVENUE_WEB")
- try
- {
- report.revenue_web = long.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "REVENUE_OTHERS")
- try
- {
- report.revenue_others = long.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "REVENUE_BUY_MOCHA")
- try
- {
- report.revenue_buy_mocha = long.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "REVENUE_BUY_WEB")
- try
- {
- report.revenue_buy_web = long.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "REVENUE_BUY_OTHERS")
- try
- {
- report.revenue_buy_others = long.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "COUNT_REG_OTHERS")
- try
- {
- report.count_reg_others = long.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "COUNT_REG_MOCHA")
- try
- {
- report.count_reg_mocha = long.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- else if (reader.GetName(i).ToUpper() == "COUNT_REG_WEB")
- try
- {
- report.count_reg_web = long.Parse(reader.GetValue(i).ToString());
- }
- catch { }
- }
- result.Add(report);
- }
- reader.Close();
- }
- catch (Exception ex)
- {
- result = null;
- }
- finally
- {
- try
- {
- reader.Close();
- }
- catch { }
- }
- return result;
- }
- }
- }
|