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 Parse(OracleDataReader reader) { List result = new List(); 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; } } }