using System; using System.Collections.Generic; using Oracle.ManagedDataAccess.Client; using System.Linq; using System.Web; namespace ReportWeb.Models { public class Users { //public int account_id { get; set; } public string user_name { get; set; } public string password { get; set; } public int status { get; set; } public int role { get; set; } public static List Parse(OracleDataReader reader) { List result = new List(); try { while (reader.Read()) { Users sv = new Users(); for (int i = 0; i < reader.FieldCount; i++) { //if (reader.GetName(i).ToUpper() == "ACCOUNT_ID") // try // { // sv.account_id = int.Parse(reader.GetValue(i).ToString()); // } // catch { } //else if (reader.GetName(i).ToUpper() == "USERNAME") { try { sv.user_name = reader.GetValue(i).ToString(); } catch { } } else if (reader.GetName(i).ToUpper() == "PASSWORD") try { sv.password = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "STATUS") try { sv.status = int.Parse(reader.GetValue(i).ToString()); } catch { } else if (reader.GetName(i).ToUpper() == "ROLE") try { sv.role = int.Parse(reader.GetValue(i).ToString()); } catch { } } result.Add(sv); } reader.Close(); } catch { } finally { try { reader.Close(); } catch { } } return result; } } }