using System; using System.Collections.Generic; using Oracle.ManagedDataAccess.Client; using System.Linq; using System.Web; namespace ReportWeb.Models { public class Services { public Services() { // // TODO: Add constructor logic here // } public int id { get; set; } public string sv_name { get; set; } public string sv_code { get; set; } // service report public string db_name { get; set; } public string connection_string { get; set; } public string db_username { get; set; } public string db_password { get; set; } public string sql_report_daily { get; set; } public string sql_report_hourly { get; set; } // service adv public int adv_id { get; set; } public string msg_adv { get; set; } public string adv_name { get; set; } public string channel_adv { get; set; } public string message_type { get; set; } public string from_money { get; set; } public string active_hour { get; set; } public int max_number_msg { get; set; } // status public int status { get; set; } public static List Parse(OracleDataReader reader) { List result = new List(); try { while (reader.Read()) { Services sv = new Services(); for (int i = 0; i < reader.FieldCount; i++) { if (reader.GetName(i).ToUpper() == "ID") try { sv.id = int.Parse(reader.GetValue(i).ToString()); } catch { } else if (reader.GetName(i).ToUpper() == "SV_NAME") { try { sv.sv_name = reader.GetValue(i).ToString(); } catch { } } else if (reader.GetName(i).ToUpper() == "SV_CODE") { try { sv.sv_code = reader.GetValue(i).ToString(); } catch { } } else if (reader.GetName(i).ToUpper() == "DB_NAME") { try { sv.db_name = reader.GetValue(i).ToString(); } catch { } } else if (reader.GetName(i).ToUpper() == "CONNECTION_STRING") try { sv.connection_string = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "DB_USERNAME") try { sv.db_username = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "DB_PASSWORD") try { sv.db_password = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "SQL_REPORT_DAILY") try { sv.sql_report_daily = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "SQL_REPORT_HOURLY") try { sv.sql_report_hourly = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "ADV_ID") try { sv.adv_id = int.Parse(reader.GetValue(i).ToString()); } catch { } else if (reader.GetName(i).ToUpper() == "MSG_ADV") try { sv.msg_adv = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "ADV_NAME") try { sv.adv_name = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "MESSAGE_TYPE") try { sv.message_type = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "CHANNEL_ADV") try { sv.channel_adv = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "FROM_MONEY") try { sv.from_money = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "ACTIVE_HOUR") try { sv.active_hour = reader.GetValue(i).ToString(); } catch { } else if (reader.GetName(i).ToUpper() == "MAX_NUMBER_MSG") try { sv.max_number_msg = int.Parse(reader.GetValue(i).ToString()); } 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; } } }