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