using System; using System.Collections.Generic; using Oracle.ManagedDataAccess.Client; namespace ReportWeb.Models { public class DailyReport { public DailyReport() { } public int service_id { get; set; } public string service_name { get; set; } public string report_date { get; set; } public long revenue { get; set; } public long revenue_buy { get; set; } public long count_reg { get; set; } public long paid_money { get; set; } public long count_active { get; set; } public long count_deactive { get; set; } public static List Parse(OracleDataReader reader) { List result = new List(); try { while (reader.Read()) { DailyReport report = new DailyReport(); 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") try { report.revenue = long.Parse(reader.GetValue(i).ToString()); } catch { } else if (reader.GetName(i).ToUpper() == "REVENUE_BUY") try { report.revenue_buy = long.Parse(reader.GetValue(i).ToString()); } catch { } else if (reader.GetName(i).ToUpper() == "COUNT_REG") try { report.count_reg = long.Parse(reader.GetValue(i).ToString()); } catch { } else if (reader.GetName(i).ToUpper() == "PAID_MONEY") try { report.paid_money = long.Parse(reader.GetValue(i).ToString()); } catch { } else if (reader.GetName(i).ToUpper() == "COUNT_ACTIVE") try { report.count_active = long.Parse(reader.GetValue(i).ToString()); } catch { } else if (reader.GetName(i).ToUpper() == "COUNT_DEACTIVE") try { report.count_deactive = long.Parse(reader.GetValue(i).ToString()); } catch { } } result.Add(report); } reader.Close(); } catch (Exception ex) { result = null; } finally { try { reader.Close(); } catch { } } return result; } } }