private List <TnfStructuredValueDomainPropertyType> GetAll(int catalogueOid, int fromDate, int toDate, bool bTimeInterval) { var tnfStructuredValueDomainPropertyTypes = new List <TnfStructuredValueDomainPropertyType>(); string commandText = "SELECT catalogue_oid, oid, structured_value_domain_oid, name, shortname, description, multiplicity_min, " + String.Format("multiplicity_max, mandatory, valid_from, valid_to, value_domain_oid FROM {0} ", TnfStructuredValueDomainPropertyTableName) + "WHERE catalogue_oid = " + catalogueOid; if (bTimeInterval) { commandText += " AND from_date >= " + fromDate + " AND to_date <= " + toDate; } using (IDataReader idataReader = Db.ExecuteReader(commandText)) { while (idataReader != null && idataReader.Read()) { TnfStructuredValueDomainPropertyType structuredValueDomainPropertyType = ReadObject(idataReader); tnfStructuredValueDomainPropertyTypes.Add(structuredValueDomainPropertyType); } } return(tnfStructuredValueDomainPropertyTypes); }
public int Update(TnfStructuredValueDomainPropertyType tnfStructuredValueDomainPropertyType) { return(Update(new object[] { tnfStructuredValueDomainPropertyType.Oid, tnfStructuredValueDomainPropertyType.CatalogueOid, tnfStructuredValueDomainPropertyType.StructuredValueDomainOid, tnfStructuredValueDomainPropertyType.ValueDomainOid, tnfStructuredValueDomainPropertyType.MultiplicityMin, tnfStructuredValueDomainPropertyType.MultiplicityMax, tnfStructuredValueDomainPropertyType.Mandatory, tnfStructuredValueDomainPropertyType.Name, tnfStructuredValueDomainPropertyType.Description, tnfStructuredValueDomainPropertyType.ShortName, tnfStructuredValueDomainPropertyType.ValidFrom?.Date, tnfStructuredValueDomainPropertyType.ValidTo?.Date })); }
private static TnfStructuredValueDomainPropertyType ReadObject(IDataRecord reader) { var tnfStructuredValueDomainPropertyType = new TnfStructuredValueDomainPropertyType(); tnfStructuredValueDomainPropertyType.CatalogueOid = reader["catalogue_oid"].ToInt(); tnfStructuredValueDomainPropertyType.Oid = reader["oid"].ToInt(); tnfStructuredValueDomainPropertyType.StructuredValueDomainOid = reader["structured_value_domain_oid"].ToInt(); tnfStructuredValueDomainPropertyType.Name = reader["name"].FromDbString(); tnfStructuredValueDomainPropertyType.ShortName = reader["shortname"].FromDbString(); tnfStructuredValueDomainPropertyType.Description = reader["description"].FromDbString(); tnfStructuredValueDomainPropertyType.MultiplicityMin = reader["multiplicity_min"].ToInt32(); tnfStructuredValueDomainPropertyType.MultiplicityMax = reader["multiplicity_max"].ToInt32(); tnfStructuredValueDomainPropertyType.Mandatory = (bool)reader["mandatory"].ToBoolean(); tnfStructuredValueDomainPropertyType.ValidFrom = reader["valid_from"].ToDateTime(); tnfStructuredValueDomainPropertyType.ValidTo = reader["valid_to"].ToDateTime(); tnfStructuredValueDomainPropertyType.ValueDomainOid = reader["value_domain_oid"].ToInt(); return(tnfStructuredValueDomainPropertyType); }
/// <summary> /// Get a single structured value domain property type /// </summary> /// <param name="oid">OID for the structured value domain property type</param> /// <param name="catalogueOid">OID for the data catalogue</param> /// <returns></returns> public TnfStructuredValueDomainPropertyType Get(int oid, int catalogueOid) { TnfStructuredValueDomainPropertyType structuredValueDomainPropertyType = null; string commandText = "SELECT catalogue_oid, oid, structured_value_domain_oid, name, shortname, description, multiplicity_min, " + String.Format("multiplicity_max, mandatory, valid_from, valid_to, value_domain_oid FROM {0} ", TnfStructuredValueDomainPropertyTableName) + "WHERE catalogue_oid = " + catalogueOid + " AND oid = '" + oid + "'"; using (IDataReader idataReader = Db.ExecuteReader(commandText)) { if (idataReader != null && idataReader.Read()) { structuredValueDomainPropertyType = ReadObject(idataReader); } } return(structuredValueDomainPropertyType); }