//-------------------------------------------------------------- public static string Static_GetDisplayString(short ProvinceId) { string RetVal = ""; Provinces m_Provinces = new Provinces(); m_Provinces.ProvinceId = ProvinceId; m_Provinces = m_Provinces.Get(); RetVal = m_Provinces.ProvinceName; return(RetVal); }
//-------------------------------------------------------------- public static List <Provinces> Static_GetList(short countryId) { List <Provinces> retVal = new List <Provinces>(); try { retVal = new Provinces().GetList(countryId); } catch (Exception ex) { throw ex; } return(retVal); }
//-------------------------------------------------------------- public Provinces Get(short provinceId) { Provinces retVal = new Provinces(db.ConnectionString); try { List <Provinces> list = GetListByProvinceId(provinceId); if (list.Count > 0) { retVal = list[0]; } } catch (Exception ex) { throw ex; } return(retVal); }
//----------------------------------------------------------------- private List <Provinces> Init(SqlCommand cmd) { SqlConnection con = db.GetConnection(); cmd.Connection = con; List <Provinces> listProvinces = new List <Provinces>(); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SmartDataReader smartReader = new SmartDataReader(reader); while (smartReader.Read()) { Provinces province = new Provinces(db.ConnectionString) { ProvinceId = smartReader.GetInt16("ProvinceId"), ProvinceName = smartReader.GetString("ProvinceName"), ProvinceDesc = smartReader.GetString("ProvinceDesc"), CountryId = smartReader.GetInt16("CountryId"), DisplayOrder = smartReader.GetInt16("DisplayOrder"), CrUserId = smartReader.GetInt32("CrUserId"), CrDateTime = smartReader.GetDateTime("CrDateTime") }; listProvinces.Add(province); } reader.Close(); return(listProvinces); } catch (SqlException err) { throw new ApplicationException("Data error: " + err.Message); } finally { db.closeConnection(con); } }