private static void PrepareValueField(Control multiplier, Label label, Control field, WebControl requiredValidator, WebControl numericValidator, PackageProperties property) { PropertyTypes propertyType = PackagePropertiesHelper.GetPropertyType(property); PrepareValueField(multiplier, label, field, requiredValidator, numericValidator, propertyType); }
/// <summary> /// Describers the use of HTML element (tag), as part of microformat format description /// </summary> /// <param name="name">Element name</param> /// <param name="mandatory">Is mandatory</param> /// <param name="multiples">Allow multiples</param> /// <param name="type">Property type</param> public UfElementDescriber(string name, bool mandatory, bool multiples, PropertyTypes type) { this.Name = name; this.Mandatory = mandatory; this.Multiples = multiples; this.Type = type; }
public static string ToString(PropertyTypes propertyType) { switch (propertyType) { case PropertyTypes.String: return("string"); case PropertyTypes.Integer: return("int"); case PropertyTypes.Double: return("double"); case PropertyTypes.DateTime: return("DateTime"); case PropertyTypes.Boolean: return("bool"); case PropertyTypes.Guid: return("Guid"); default: return("object"); } }
public Accommodation(int id, MultiLanguage <string> name, MultiLanguage <string> address, MultiLanguage <TextualDescription> description, GeoPoint coordinates, AccommodationStars rating, string checkInTime, string checkOutTime, ContactInfo contactInfo, PropertyTypes type, MultiLanguage <List <string> > amenities, MultiLanguage <string> additionalInfo, OccupancyDefinition occupancyDefinition, int locationId, MultiLanguage <List <string> > leisureAndSports, Status status, RateOptions rateOptions, int?floors, int?buildYear, string postalCode, List <Room> rooms) { Id = id; Name = name; Address = address; Description = description; Coordinates = coordinates; Rating = rating; CheckInTime = checkInTime; CheckOutTime = checkOutTime; ContactInfo = contactInfo; Type = type; Amenities = amenities; AdditionalInfo = additionalInfo; OccupancyDefinition = occupancyDefinition; LocationId = locationId; RateOptions = rateOptions; Status = status; LeisureAndSports = leisureAndSports; Rooms = rooms; Floors = floors; BuildYear = buildYear; PostalCode = postalCode; }
private void Track(string key, PropertyTypes type, IReloadable target) { Debug.Assert(map.ContainsKey(key), $"Missing property '{key}'."); // This is useful for properties that should never be iterated during gameplay (or where live modification // would be too cumbersome or error-prone). if (target == null) { return; } var matchedProperty = tracker.Keys.FirstOrDefault(p => p.Key == key); // This means that the given target is the first to track the given key. if (matchedProperty.Key == null) { var list = new List <IReloadable>(); list.Add(target); tracker.Add((key, type), list); } else { Debug.Assert(type == matchedProperty.Type, $"Type conflict for property '{key}' (was previously " + $"retrieved as {matchedProperty.Type}, but is now being retrieved as {type})."); var targets = tracker[matchedProperty]; if (!targets.Contains(target)) { targets.Add(target); } } }
public Property(string key, PropertyTypes type) { Debug.Assert(!string.IsNullOrEmpty(key), "Property key is null or empty."); Key = key; Type = type; }
/// <summary> /// returns a default value based on a propertytype /// </summary> /// <param name="typ"></param> /// <returns></returns> public static object InitContent(PropertyTypes typ) { switch (typ) { case PropertyTypes.String: return(""); case PropertyTypes.Int: return(0); case PropertyTypes.Color: return(null); case PropertyTypes.Date: return(DateTime.MinValue); case PropertyTypes.Boolean: return(false); default: return(null); break; } }
public ParameterInfo(string name, PropertyTypes dataType, int size = 0, bool output = false) { Name = name; DataType = dataType; Size = size; Output = output; }
public static SqlDbType GetDbType(PropertyTypes type) { switch (type) { case PropertyTypes.Boolean: return(SqlDbType.Bit); case PropertyTypes.Date: return(SqlDbType.DateTime); case PropertyTypes.EnumValue: return(SqlDbType.TinyInt); case PropertyTypes.Integer: return(SqlDbType.Int); case PropertyTypes.Number: return(SqlDbType.Decimal); case PropertyTypes.String: return(SqlDbType.NVarChar); case PropertyTypes.Computed: return(SqlDbType.NVarChar); default: throw new NotImplementedException(string.Format("Type {0} is not reconginzed!", type)); } }
private static void PrepareValueField(Control multiplier, Label label, Control field, WebControl requiredValidator, WebControl numericValidator, PropertyTypes propertyType) { if (propertyType == PropertyTypes.Numeric) { multiplier.Visible = true; field.Visible = true; label.Text = "Multiplier"; label.ToolTip = "<p>Enter the multiplier. If the final cost is less than 0, the rate will not be displayed to the customer.</p>"; requiredValidator.Enabled = true; numericValidator.Enabled = true; } else if (propertyType == PropertyTypes.Fixed) { multiplier.Visible = false; field.Visible = true; label.Text = "Value"; label.ToolTip = "<p>Enter the fixed cost.</p>"; requiredValidator.Enabled = true; numericValidator.Enabled = true; } else { multiplier.Visible = false; field.Visible = false; requiredValidator.Enabled = false; numericValidator.Enabled = false; } }
private void GetUsageData() { int nodeId = Int32.Parse(Request.QueryString["id"]); var criteria = searcher.CreateSearchCriteria(IndexTypes.Content); string[] fields = PropertyTypes.Split(new[] { ',' }); var query = criteria.OrderBy("__nodeName"); query = fields.Aggregate(query, (current, field) => current.Or().Field(field, nodeId.ToString())); _results = searcher.Search(query.Compile()); queryGenerated.Value = criteria.ToString(); if (_results.Any()) { rptItemUsage.DataSource = _results; rptItemUsage.DataBind(); litMessage.Text = "The page is referenced by the pages listed below"; } else { rptItemUsage.Visible = false; litMessage.Text = NoResultstext; } }
/// <summary> /// Pretend the get on the property object was called /// This will invoke the normal get, going through all the registered getters /// </summary> /// <param name="propertyName">Name of the property</param> public GetInfo Get(string propertyName) { if (!PropertyTypes.TryGetValue(propertyName, out var propertyType)) { propertyType = typeof(object); } var hasValue = _properties.TryGetValue(propertyName, out var value); var getInfo = new GetInfo { Interceptor = this, PropertyName = propertyName, PropertyType = propertyType, CanContinue = true, Value = value, HasValue = hasValue }; foreach (var getter in _getters) { getter.GetterAction(getInfo); if (!getInfo.CanContinue || getInfo.Error != null) { break; } } return(getInfo); }
public object Execute(TransformContext context) { var logger = context.Service <ILogger>(); logger.LogDebug("ExecuteScalar transform"); var sql = context.Arguments.Get <string>("sql"); var dataType = context.Arguments.Get <string>("dataType"); var sqlHelper = new SqlHelper(sql); foreach (var pair in context.Arguments) { logger.LogDebug("arg {0}:{1}", pair.Key, pair.Value); if (!pair.Key.ToLower().StartsWith("param.")) { continue; } var key = pair.Key.Substring(6); sqlHelper.Parameters.Add(key, pair.Value); } var result = sqlHelper.ExecuteScalar(); var targetType = PropertyTypes.Parse(dataType); if (result == null || DBNull.Value.Equals(result)) { return(null); } return(Convert.ChangeType(result, targetType)); }
private void Validate(string key, PropertyTypes type, IReloadable target, bool shouldTrack) { Debug.Assert(map.ContainsKey(key), $"Missing property '{key}'."); // This is useful for properties that should never be iterated during gameplay (or where live modification // would be too cumbersome or error-prone). if (target == null || !shouldTrack) { return; } var matchedProperty = tracker.Keys.FirstOrDefault(p => p.Key == key); if (matchedProperty == null) { var list = new List <IReloadable>(); list.Add(target); tracker.Add(new Property(key, type), list); } else { Debug.Assert(type == matchedProperty.Type, $"Type conflict for property '{key}' (was previously " + $"retrieved as {matchedProperty.Type}, but is now {type})."); var targets = tracker[matchedProperty]; // It's fine for the same object accesses the same property multiple times (this most commonly occurs // when a property is modified, triggering a reload). if (!targets.Contains(target)) { targets.Add(target); } } }
public ReadOnlyActiveDirectorySchemaPropertyCollection FindAllProperties(PropertyTypes type) { base.CheckIfDisposed(); if (((int)type & -7) == 0) { StringBuilder stringBuilder = new StringBuilder(25); stringBuilder.Append("(&("); stringBuilder.Append(PropertyManager.ObjectCategory); stringBuilder.Append("=attributeSchema)"); stringBuilder.Append("(!("); stringBuilder.Append(PropertyManager.IsDefunct); stringBuilder.Append("=TRUE))"); if ((type & PropertyTypes.Indexed) != 0) { stringBuilder.Append("("); stringBuilder.Append(PropertyManager.SearchFlags); stringBuilder.Append(":1.2.840.113556.1.4.804:="); stringBuilder.Append(1); stringBuilder.Append(")"); } if ((type & PropertyTypes.InGlobalCatalog) != 0) { stringBuilder.Append("("); stringBuilder.Append(PropertyManager.IsMemberOfPartialAttributeSet); stringBuilder.Append("=TRUE)"); } stringBuilder.Append(")"); return(ActiveDirectorySchema.GetAllProperties(this.context, this.schemaEntry, stringBuilder.ToString())); } else { throw new ArgumentException(Res.GetString("InvalidFlags"), "type"); } }
public Filter CreateFilter() { var expression = new FilterExpression(); var dataType = PropertyTypes.Parse(_dataType); var value = Convert.ChangeType(_value, dataType); if (dataType == typeof(int)) { return(expression.NotEqual(_field, (int)value)); } if (dataType == typeof(string)) { return(expression.NotEqual(_field, (string)value)); } if (dataType == typeof(DateTime)) { return(expression.NotEqual(_field, (DateTime)value)); } if (dataType == typeof(decimal)) { return(expression.NotEqual(_field, (decimal)value)); } throw new NotSupportedException("Unsupported data type: " + _dataType); }
/// <summary> /// Moves a PropertyType to a specified PropertyGroup /// </summary> /// <param name="propertyTypeAlias">Alias of the PropertyType to move</param> /// <param name="propertyGroupName">Name of the PropertyGroup to move the PropertyType to</param> /// <returns></returns> public bool MovePropertyType(string propertyTypeAlias, string propertyGroupName) { if (PropertyTypes.Any(x => x.Alias == propertyTypeAlias) == false || PropertyGroups.Any(x => x.Name == propertyGroupName) == false) { return(false); } var propertyType = PropertyTypes.First(x => x.Alias == propertyTypeAlias); //The PropertyType already belongs to a PropertyGroup, so we have to remove the PropertyType from that group if (PropertyGroups.Any(x => x.PropertyTypes.Any(y => y.Alias == propertyTypeAlias))) { var oldPropertyGroup = PropertyGroups.First(x => x.PropertyTypes.Any(y => y.Alias == propertyTypeAlias)); oldPropertyGroup.PropertyTypes.RemoveItem(propertyTypeAlias); } propertyType.PropertyGroupId = new Lazy <int>(() => default(int)); propertyType.ResetDirtyProperties(); var propertyGroup = PropertyGroups.First(x => x.Name == propertyGroupName); propertyGroup.PropertyTypes.Add(propertyType); return(true); }
private string GetSqlType(PropertyTypes dataType) { switch (dataType) { case PropertyTypes.Integer: return(SqlDbType.Int.ToString()); case PropertyTypes.Number: return(SqlDbType.Decimal.ToString()); case PropertyTypes.String: return(SqlDbType.NVarChar.ToString()); case PropertyTypes.EnumValue: return(SqlDbType.TinyInt.ToString()); case PropertyTypes.Date: return(SqlDbType.DateTime.ToString()); case PropertyTypes.Boolean: return(SqlDbType.Bit.ToString()); default: throw new NotImplementedException(string.Format("GetSqlType for type {0} is not yet implemented.", dataType)); } }
public AnimationEventArgs(string name, ActorComponent component, PropertyTypes type, float keyframeTime, float elapsedTime) { m_Name = name; m_Component = component; m_PropertyType = type; m_KeyFrameTime = keyframeTime; m_ElapsedTime = elapsedTime; }
public ColumnInfo(string name, PropertyTypes dataType, int size = 0, bool nullable = true, bool identity = false) { Name = name; DataType = dataType; Nullable = nullable; Identity = identity; Size = size; }
/// <summary> /// Indicates whether the current entity is dirty. /// </summary> /// <returns>True if entity is dirty, otherwise False</returns> public override bool IsDirty() { bool dirtyEntity = base.IsDirty(); bool dirtyGroups = PropertyGroups.Any(x => x.IsDirty()); bool dirtyTypes = PropertyTypes.Any(x => x.IsDirty()); return(dirtyEntity || dirtyGroups || dirtyTypes); }
/// <summary> /// Indicates whether a specific property on the current <see cref="IContent"/> entity is dirty. /// </summary> /// <param name="propertyName">Name of the property to check</param> /// <returns>True if Property is dirty, otherwise False</returns> public override bool IsPropertyDirty(string propertyName) { bool existsInEntity = base.IsPropertyDirty(propertyName); bool anyDirtyGroups = PropertyGroups.Any(x => x.IsPropertyDirty(propertyName)); bool anyDirtyTypes = PropertyTypes.Any(x => x.IsPropertyDirty(propertyName)); return(existsInEntity || anyDirtyGroups || anyDirtyTypes); }
public static void Update(this BaseObject baseObject, PropertyTypes addressType, double doubleValue) { switch (addressType) { case PropertyTypes.LightGroup_Setpoint: ((LightGroup)baseObject).LightLevelSetpoint = (int)doubleValue; break; case PropertyTypes.LightGroup_State: ((LightGroup)baseObject).IsOn = ((int)doubleValue) == 1; break; case PropertyTypes.LightGroup_Level: ((LightGroup)baseObject).LightLevel = (int)doubleValue; break; case PropertyTypes.Light_Level: ((Lamp)baseObject).LightLevel = (int)doubleValue; break; case PropertyTypes.Thermometer_Level: ((TemperatureSensor)baseObject).Temperature.Update(doubleValue); break; case PropertyTypes.Thermometer_Setpoint: ((TemperatureSensor)baseObject).TemperatureSetpoint.Update(doubleValue); break; case PropertyTypes.Thermometer_AllowManual: ((TemperatureSensor)baseObject).AllowManual.Update(doubleValue); break; case PropertyTypes.AC_FanLevel: ((Conditioner)baseObject).FanLevel = (int)doubleValue; break; case PropertyTypes.Heater_Mode: ((Heater)baseObject).IsBacstatAllowed = ((int)doubleValue) == 1; break; case PropertyTypes.Heater_Manual: ((Heater)baseObject).ManualLevel = doubleValue; break; case PropertyTypes.LightSensor_Level: ((LightSensor)baseObject).LightLevel.Update(doubleValue); break; case PropertyTypes.WdSensor_Alarm: ((WdSensor)baseObject).IsLeaked.Update(doubleValue); break; default: throw new ArgumentOutOfRangeException("addressType"); } }
public NodeData(NodeType nodeType, ContentListType contentListType) { staticDataIsModified = new bool[StaticDataSlotCount]; staticData = new object[StaticDataSlotCount]; PropertyTypes = NodeTypeManager.GetDynamicSignature(nodeType.Id, contentListType == null ? 0 : contentListType.Id); TextPropertyIds = PropertyTypes.Where(p => p.DataType == DataType.Text).Select(p => p.Id).ToArray(); dynamicData = new Dictionary <int, object>(); }
// ----------------------------------------------------------------------------------- // CalculateProperties // ----------------------------------------------------------------------------------- public float CalculateProperties(PropertyModifier[] modifiers, PropertyTypes valueType, float baseValue = 0) { float tmpValue = 0; foreach (PropertyModifier modifier in modifiers) { tmpValue += GetPropertySum(modifier, valueType, 0); } return(baseValue + tmpValue); }
public SchemaProperty(string name, PropertyTypes type, bool isCustom) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("message", nameof(name)); } Type = type; IsCustom = isCustom; Name = name; }
/// <summary> /// Initializes a new instance of the <see cref="AutoProperty"/> class. /// </summary> /// <param name="name">Name of the property.</param> /// <param name="type">The property type.</param> /// <param name="propertyType">What kind of of property to geneate (get or get/set).</param> /// <param name="modifiers">The properpty modifiers.</param> /// <param name="attributes">Attributes on the property.</param> public AutoProperty( string name, Type type, PropertyTypes propertyType, IEnumerable <Code.Modifiers> modifiers = null, IEnumerable <Attribute> attributes = null) : base(name, type, modifiers, attributes) { PropertyType = propertyType; }
public void parses_known_types() { PropertyTypes.Parse("int").ShouldEqual(typeof(int)); PropertyTypes.Parse("string").ShouldEqual(typeof(string)); PropertyTypes.Parse("dateTime").ShouldEqual(typeof(DateTime)); PropertyTypes.Parse("decimal").ShouldEqual(typeof(decimal)); PropertyTypes.Parse("bool").ShouldEqual(typeof(bool)); PropertyTypes.Parse("double").ShouldEqual(typeof(double)); PropertyTypes.Parse("float").ShouldEqual(typeof(float)); PropertyTypes.Parse("short").ShouldEqual(typeof(short)); }
public Filter CreateFilter() { var expression = new FilterExpression(); var dataType = PropertyTypes.Parse(_dataType); if (dataType == typeof(string)) { return(expression.IsIn(_field, _values)); } throw new NotSupportedException("Unsupported data type: " + _dataType); }
/// <summary> /// Initializes a new instance of the <see cref="AutoProperty"/> class. /// </summary> /// <param name="name">Name of the property.</param> /// <param name="type">The property type.</param> /// <param name="propertyType">What kind of of property to generate (get or get/set).</param> /// <param name="modifiers">The property modifiers.</param> /// <param name="attributes">Attributes on the property.</param> /// <param name="getModifiers">The get modifiers.</param> /// <param name="setModifiers">The set modifiers.</param> /// <param name="summary">XML documentation summary</param> public AutoProperty( string name, Type type, PropertyTypes propertyType, IEnumerable <Code.Modifiers> modifiers = null, IEnumerable <Attribute> attributes = null, IEnumerable <Modifiers> getModifiers = null, IEnumerable <Modifiers> setModifiers = null, string summary = null) : base(name, type, modifiers, attributes, getModifiers, setModifiers, summary) { PropertyType = propertyType; }
public static bool WDSetCustomProperty( string docName, string propertyName, object propertyValue, PropertyTypes propertyType ) { // Given a document name, a property name/value, and the property type, add a custom property // to a document. Return True if the property was added/updated, or False if the property cannot be updated. // The function's return value is true if the code could add/update the property, // and false otherwise. // If the custom.xml part is not already added to the document, add it. // If the custom.xml part is there, but the property is not, add it. // If the property exists and is of the same type, replace the value. // If the property exists and is of a different type, update the existing property. const string documentRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"; const string customPropertiesRelationshipType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties"; const string customPropertiesSchema = "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"; const string customVTypesSchema = "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"; bool retVal = false; PackagePart documentPart = null; string propertyTypeName = "vt:lpwstr"; string propertyValueString = null; // Calculate the correct type. switch( propertyType ) { case PropertyTypes.DateTime: propertyTypeName = "vt:filetime"; // Make sure you were passed a real date, // and if so, format in the correct way. The date/time // value passed in should represent a UTC date/time. if( propertyValue.GetType( ) == typeof( System.DateTime ) ) { propertyValueString = string.Format( "{0:s}Z", Convert.ToDateTime( propertyValue ) ); } break; case PropertyTypes.NumberInteger: propertyTypeName = "vt:i4"; if( propertyValue.GetType( ) == typeof( System.Int32 ) ) { propertyValueString = Convert.ToInt32( propertyValue ).ToString( ); } break; case PropertyTypes.NumberDouble: propertyTypeName = "vt:r8"; if( propertyValue.GetType( ) == typeof( System.Double ) ) { propertyValueString = Convert.ToDouble( propertyValue ).ToString( ); } break; case PropertyTypes.Text: propertyTypeName = "vt:lpwstr"; propertyValueString = Convert.ToString( propertyValue ); break; case PropertyTypes.YesNo: propertyTypeName = "vt:bool"; if( propertyValue.GetType( ) == typeof( System.Boolean ) ) { // Must be lower case! propertyValueString = Convert.ToBoolean( propertyValue ).ToString( ).ToLower( ); } break; } if( propertyValueString == null ) { // If the code cannot convert the // property to a valid value, throw an exception. throw new InvalidDataException( "Invalid parameter value." ); } using( Package wdPackage = Package.Open( docName, FileMode.Open, FileAccess.ReadWrite ) ) { // Get the main document part (document.xml). foreach( System.IO.Packaging.PackageRelationship relationship in wdPackage.GetRelationshipsByType( documentRelationshipType ) ) { Uri documentUri = PackUriHelper.ResolvePartUri( new Uri( "/", UriKind.Relative ), relationship.TargetUri ); documentPart = wdPackage.GetPart( documentUri ); // There is only one document. break; } // Work with the custom properties part. PackagePart customPropsPart = null; // Get the custom part (custom.xml). It may not exist. foreach( System.IO.Packaging.PackageRelationship relationship in wdPackage.GetRelationshipsByType( customPropertiesRelationshipType ) ) { Uri documentUri = PackUriHelper.ResolvePartUri( new Uri( "/", UriKind.Relative ), relationship.TargetUri ); customPropsPart = wdPackage.GetPart( documentUri ); // There is only one custom properties part, if it exists at all. break; } // Manage namespaces to perform Xml XPath queries. NameTable nt = new NameTable( ); XmlNamespaceManager nsManager = new XmlNamespaceManager( nt ); nsManager.AddNamespace( "d", customPropertiesSchema ); nsManager.AddNamespace( "vt", customVTypesSchema ); Uri customPropsUri = new Uri( "/docProps/custom.xml", UriKind.Relative ); XmlDocument customPropsDoc = null; XmlNode rootNode = null; // There may not be a custom properties part. if( customPropsPart == null ) { customPropsDoc = new XmlDocument( nt ); // The part does not exist. Create it now. customPropsPart = wdPackage.CreatePart( customPropsUri, "application/xml" ); // Set up the rudimentary custom part. rootNode = customPropsDoc.CreateElement( "Properties", customPropertiesSchema ); rootNode.Attributes.Append( customPropsDoc.CreateAttribute( "xmlns:vt" ) ); rootNode.Attributes[ "xmlns:vt" ].Value = customVTypesSchema; customPropsDoc.AppendChild( rootNode ); // Create the document's relationship to the new custom properties part: wdPackage.CreateRelationship( customPropsUri, TargetMode.Internal, customPropertiesRelationshipType ); } else { // Load the contents of the custom properties part into an XML document. customPropsDoc = new XmlDocument( nt ); customPropsDoc.Load( customPropsPart.GetStream( ) ); rootNode = customPropsDoc.DocumentElement; } // Now that you have a reference to an XmlDocument object that // corresponds to the custom properties part, // check to see if the required property is already there. string searchString = string.Format( "d:Properties/d:property[@name='{0}']", propertyName ); XmlNode node = customPropsDoc.SelectSingleNode( searchString, nsManager ); // If you did not find the node, add it. If you found it, and the type is // different than the new property, delete it. If you found it, and the type // is the same, replace the property value. Otherwise, add a new // element with the new value and type. XmlNode valueNode = null; if( node != null ) { // You found the node. Now check its type. if( node.HasChildNodes ) { valueNode = node.ChildNodes[ 0 ]; if( valueNode != null ) { string typeName = valueNode.Name; if( propertyTypeName == typeName ) { // The types are the same. // Replace the value of the node. valueNode.InnerText = propertyValueString; // If the property existed, and its type // has not changed, you are finished. retVal = true; } else { // Types are different. Delete the node // and clear the node variable. node.ParentNode.RemoveChild( node ); node = null; } } } } // The previous block of code may have cleared the value in the // variable named node. if( node == null ) { // Either you did not find the node, or you // found it, its type was incorrect, and you deleted it. // Either way, you need to create the new property node now. // Find the highest existing "pid" value. // The default value for the "pid" attribute is "2". string pidValue = "2"; XmlNode propertiesNode = customPropsDoc.DocumentElement; if( propertiesNode.HasChildNodes ) { XmlNode lastNode = propertiesNode.LastChild; if( lastNode != null ) { XmlAttribute pidAttr = lastNode.Attributes[ "pid" ]; if( !( pidAttr == null ) ) { pidValue = pidAttr.Value; // Increment pidValue, so that the new property // gets a pid value one higher. This value should be // numeric, but it never hurt so to confirm: int value = 0; if( int.TryParse( pidValue, out value ) ) { pidValue = Convert.ToString( value + 1 ); } } } } node = customPropsDoc.CreateElement( "property", customPropertiesSchema ); node.Attributes.Append( customPropsDoc.CreateAttribute( "name" ) ); node.Attributes[ "name" ].Value = propertyName; node.Attributes.Append( customPropsDoc.CreateAttribute( "fmtid" ) ); node.Attributes[ "fmtid" ].Value = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"; node.Attributes.Append( customPropsDoc.CreateAttribute( "pid" ) ); node.Attributes[ "pid" ].Value = pidValue; valueNode = customPropsDoc.CreateElement( propertyTypeName, customVTypesSchema ); valueNode.InnerText = propertyValueString; node.AppendChild( valueNode ); rootNode.AppendChild( node ); retVal = true; } // Save the properties XML back to its part. customPropsDoc.Save( customPropsPart.GetStream( FileMode.Create, FileAccess.Write ) ); } return retVal; }
/// <summary> /// Thrift Protocol Member's Attribute /// </summary> /// <param name="id">Property ID</param> /// <param name="propertyType">Property Type</param> /// <param name="needWriteOverheads">A flag indicated that whether applies Thrift's TField binary format while serializing.</param> public ThriftPropertyAttribute(short id, PropertyTypes propertyType, bool needWriteOverheads = true) { _propertyType = propertyType; _id = id; NeedWriteOverheads = needWriteOverheads; }
private string GetSqlType(PropertyTypes dataType) { switch (dataType) { case PropertyTypes.Integer: return SqlDbType.Int.ToString(); case PropertyTypes.Number: return SqlDbType.Decimal.ToString(); case PropertyTypes.String: return SqlDbType.NVarChar.ToString(); case PropertyTypes.EnumValue: return SqlDbType.TinyInt.ToString(); case PropertyTypes.Date: return SqlDbType.DateTime.ToString(); case PropertyTypes.Boolean: return SqlDbType.Bit.ToString(); default: throw new NotImplementedException(string.Format("GetSqlType for type {0} is not yet implemented.", dataType)); } }
public ReadOnlyActiveDirectorySchemaPropertyCollection FindAllProperties(PropertyTypes type) {}
// // This method returns only non-defunct properties meeting the specified criteria // public ReadOnlyActiveDirectorySchemaPropertyCollection FindAllProperties(PropertyTypes type) { CheckIfDisposed(); // check validity of type if ((type & (~(PropertyTypes.Indexed | PropertyTypes.InGlobalCatalog))) != 0) { throw new ArgumentException(Res.GetString(Res.InvalidFlags), "type"); } // start the filter StringBuilder str = new StringBuilder(25); str.Append("(&("); str.Append(PropertyManager.ObjectCategory); str.Append("=attributeSchema)"); str.Append("(!("); str.Append(PropertyManager.IsDefunct); str.Append("=TRUE))"); if (((int)type & (int)PropertyTypes.Indexed) != 0) { str.Append("("); str.Append(PropertyManager.SearchFlags); str.Append(":1.2.840.113556.1.4.804:="); str.Append((int)SearchFlags.IsIndexed); str.Append(")"); } if (((int)type & (int)PropertyTypes.InGlobalCatalog) != 0) { str.Append("("); str.Append(PropertyManager.IsMemberOfPartialAttributeSet); str.Append("=TRUE)"); } str.Append(")"); // end filter return GetAllProperties(context, _schemaEntry, str.ToString()); }
public ReadOnlyActiveDirectorySchemaPropertyCollection FindAllProperties(PropertyTypes type) { base.CheckIfDisposed(); if ((type & ~(PropertyTypes.InGlobalCatalog | PropertyTypes.Indexed)) != 0) { throw new ArgumentException(Res.GetString("InvalidFlags"), "type"); } StringBuilder builder = new StringBuilder(0x19); builder.Append("(&("); builder.Append(PropertyManager.ObjectCategory); builder.Append("=attributeSchema)"); builder.Append("(!("); builder.Append(PropertyManager.IsDefunct); builder.Append("=TRUE))"); if ((type & PropertyTypes.Indexed) != 0) { builder.Append("("); builder.Append(PropertyManager.SearchFlags); builder.Append(":1.2.840.113556.1.4.804:="); builder.Append(1); builder.Append(")"); } if ((type & PropertyTypes.InGlobalCatalog) != 0) { builder.Append("("); builder.Append(PropertyManager.IsMemberOfPartialAttributeSet); builder.Append("=TRUE)"); } builder.Append(")"); return GetAllProperties(base.context, this.schemaEntry, builder.ToString()); }
private static void PrepareLimitField(Control multiplier, Label label, Control field, WebControl requiredValidator, WebControl numericValidator, PropertyTypes propertyType) { if (propertyType == PropertyTypes.Numeric) { multiplier.Visible = true; field.Visible = true; label.Text = "Multiplier"; label.ToolTip = "<p>Enter the multiplier.</p>"; requiredValidator.Enabled = true; numericValidator.Enabled = true; } else if (propertyType == PropertyTypes.Fixed) { multiplier.Visible = false; field.Visible = true; label.Text = "Limit"; label.ToolTip = "<p>Enter the limit used in the comparison.</p>"; requiredValidator.Enabled = false; numericValidator.Enabled = false; } else { multiplier.Visible = false; field.Visible = false; requiredValidator.Enabled = false; numericValidator.Enabled = false; } }
public ReadOnlyActiveDirectorySchemaPropertyCollection FindAllProperties (PropertyTypes type) { throw new NotImplementedException (); }
public static SqlDbType GetDbType(PropertyTypes type) { switch (type) { case PropertyTypes.Boolean: return SqlDbType.Bit; case PropertyTypes.Date: return SqlDbType.DateTime; case PropertyTypes.EnumValue: return SqlDbType.TinyInt; case PropertyTypes.Integer: return SqlDbType.Int; case PropertyTypes.Number: return SqlDbType.Decimal; case PropertyTypes.String: return SqlDbType.NVarChar; case PropertyTypes.Computed: return SqlDbType.NVarChar; default: throw new NotImplementedException(string.Format("Type {0} is not reconginzed!", type)); } }
public ReadOnlyActiveDirectorySchemaPropertyCollection FindAllProperties(PropertyTypes type) { Contract.Ensures(Contract.Result<ReadOnlyActiveDirectorySchemaClassCollection>() != null); return default(ReadOnlyActiveDirectorySchemaPropertyCollection); }