using System; using System.Collections.Generic; using Oracle.ManagedDataAccess.Client; using System.Linq; using System.Web; namespace ReportWeb.Models { public class ChargeLog { public ChargeLog() { // // TODO: Add constructor logic here // } public string description { get; set; } public string msisdn { get; set; } public long fee { get; set; } public DateTime? chargeTime { get; set; } public DateTime? fromDate { get; set; } public DateTime? toDate { get; set; } public string service { get; set; } public long count_reg { get; set; } public long count_active { get; set; } public long count_destroy { get; set; } public string channel { get; set; } public string product_name { get; set; } public static List Parse(OracleDataReader reader) { List result = new List(); try { while (reader.Read()) { ChargeLog chargeLog = new ChargeLog(); for (int i = 0; i < reader.FieldCount; i++) { if (reader.GetName(i).ToUpper() == "DESCRIPTION") { try { chargeLog.description = reader.GetValue(i).ToString(); } catch { } } else if (reader.GetName(i).ToUpper() == "MSISDN") { try { chargeLog.msisdn = reader.GetValue(i).ToString(); } catch { } } else if (reader.GetName(i).ToUpper() == "CHARGE_TIME") try { chargeLog.chargeTime = reader.GetDateTime(i); } catch { } else if (reader.GetName(i).ToUpper() == "FEE") try { chargeLog.fee = long.Parse(reader.GetValue(i).ToString()); } catch { } else if (reader.GetName(i).ToUpper() == "COUNT_REG") try { chargeLog.count_reg = long.Parse(reader.GetValue(i).ToString()); } catch { } else if (reader.GetName(i).ToUpper() == "COUNT_DESTROY") try { chargeLog.count_destroy = long.Parse(reader.GetValue(i).ToString()); } catch { } else if (reader.GetName(i).ToUpper() == "COUNT_ACTIVE") try { chargeLog.count_active = long.Parse(reader.GetValue(i).ToString()); } catch { } else if (reader.GetName(i).ToUpper() == "CHANNEL") { try { chargeLog.channel = reader.GetValue(i).ToString(); } catch { } } else if (reader.GetName(i).ToUpper() == "PRODUCT_NAME") { try { chargeLog.product_name = reader.GetValue(i).ToString(); } catch { } } } result.Add(chargeLog); } reader.Close(); } catch { } finally { try { reader.Close(); } catch { } } return result; } } }