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