using System; using System.Collections.Generic; using Oracle.ManagedDataAccess.Client; using System.Linq; using System.Web; namespace ReportWeb.Models { public class PhoneInfo { public string id { get; set; } public string code { get; set; } public string msisdn { get; set; } public string insert_time { get; set; } public string last_update { get; set; } public int status { get; set; } public static List Parse(OracleDataReader reader) { List result = new List(); try { while (reader.Read()) { PhoneInfo sv = new PhoneInfo(); for (int i = 0; i < reader.FieldCount; i++) { if (reader.GetName(i).ToUpper() == "MSISDN") try { sv.msisdn = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "CODE") try { sv.code = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "INSERT_TIME") try { sv.insert_time = reader.GetDateTime(i).ToString("dd/MM/yyyy HH:mm:ss"); } catch { } else if (reader.GetName(i).ToUpper() == "LAST_UPDATE") try { sv.last_update = reader.GetDateTime(i).ToString("dd/MM/yyyy HH:mm:ss"); } 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; } } }