public static List <string> GetUniqueTypes( Int64 APartnerKey ) { TDBTransaction T = new TDBTransaction(); TDataBase DB = DBAccess.Connect("Get get unique data types"); List <OdbcParameter> SQLParameter = new List <OdbcParameter>(); List <string> Types = new List <string>(); DB.ReadTransaction(ref T, delegate { string sql = "SELECT DISTINCT `p_type_c` FROM `p_data_history` " + "WHERE `p_partner_key_n` = ?"; SQLParameter.Add(new OdbcParameter("PartnerKey", OdbcType.VarChar) { Value = APartnerKey.ToString() }); DataTable AllTypes = DB.SelectDT(sql, "UniqueTypes", T, SQLParameter.ToArray()); foreach (DataRow TypeRow in AllTypes.Rows) { Types.Add(TypeRow.Field <string>("p_type_c")); } }); return(Types); }
public static List <string> GetUniqueTypes( Int64 APartnerKey ) { TDBTransaction T = new TDBTransaction(); TDataBase DB = DBAccess.Connect("Get get unique data types"); List <OdbcParameter> SQLParameter = new List <OdbcParameter>(); List <string> Types = new List <string>(); DB.ReadTransaction(ref T, delegate { string sql = "SELECT DISTINCT `p_type_c` FROM `p_consent_history` " + "WHERE `p_partner_key_n` = ?"; SQLParameter.Add(new OdbcParameter("PartnerKey", OdbcType.BigInt) { Value = APartnerKey }); DataTable AllTypes = DB.SelectDT(sql, "UniqueTypes", T, SQLParameter.ToArray()); foreach (DataRow TypeRow in AllTypes.Rows) { Types.Add(TypeRow.Field <string>("p_type_c")); } // also get types for existing values of the address that don't have a consent yet if (!Types.Contains(MPartnerConstants.CONSENT_TYPE_ADDRESS)) { Types.Add(MPartnerConstants.CONSENT_TYPE_ADDRESS); } if (!Types.Contains(MPartnerConstants.CONSENT_TYPE_EMAIL)) { Types.Add(MPartnerConstants.CONSENT_TYPE_EMAIL); } if (!Types.Contains(MPartnerConstants.CONSENT_TYPE_LANDLINE)) { Types.Add(MPartnerConstants.CONSENT_TYPE_LANDLINE); } if (!Types.Contains(MPartnerConstants.CONSENT_TYPE_MOBILE)) { Types.Add(MPartnerConstants.CONSENT_TYPE_MOBILE); } }); return(Types); }