public Property(int Id, propertytype.PropertyType pt) { _pt = pt; _id = Id; _data = _pt.DataTypeDefinition.DataType.Data; _data.PropertyId = Id; }
/// <summary> /// Get an true/false if the Member can edit the given data defined in the propertytype /// </summary> /// <param Name="pt">Propertytype to edit</param> /// <returns>True if the Member can edit the data</returns> public bool MemberCanEdit(propertytype.PropertyType pt) { if (propertyTypeRegistered(pt)) { return(bool.Parse(Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(_ConnString, CommandType.Text, "Select memberCanEdit from cmsMemberType where NodeId = " + this.Id + " And propertytypeId = " + pt.Id).ToString())); } return(false); }
public static Property MakeNew(propertytype.PropertyType pt, Content c, Guid VersionId) { int newPropertyId = int.Parse(Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(_connstring, CommandType.Text, "Insert into cmsPropertyData (contentNodeId, versionId, propertyTypeId) values (" + c.Id.ToString() + ", '" + VersionId.ToString() + "'," + pt.Id.ToString() + ") select @@identity").ToString()); interfaces.IData d = pt.DataTypeDefinition.DataType.Data; d.MakeNew(newPropertyId); return(new Property(newPropertyId, pt)); }
public Property(int Id) { _id = Id; _pt = Umbraco.Cms.BusinessLogic.propertytype.PropertyType.GetPropertyType(int.Parse( Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(GlobalSettings.DbDSN, CommandType.Text, "select propertytypeid from cmsPropertyData where id = @id", new SqlParameter("@id", Id)).ToString())); _data = _pt.DataTypeDefinition.DataType.Data; _data.PropertyId = Id; }
public Property(int Id) { _id = Id; _pt = umbraco.cms.businesslogic.propertytype.PropertyType.GetPropertyType( SqlHelper.ExecuteScalar<int>("select propertytypeid from cmsPropertyData where id = @id", SqlHelper.CreateParameter("@id", Id))); _data = _pt.DataTypeDefinition.DataType.Data; _data.PropertyId = Id; }
public Property(int Id) { _id = Id; _pt = umbraco.cms.businesslogic.propertytype.PropertyType.GetPropertyType( SqlHelper.ExecuteScalar <int>("select propertytypeid from cmsPropertyData where id = @id", SqlHelper.CreateParameter("@id", Id))); _data = _pt.DataTypeDefinition.DataType.Data; _data.PropertyId = Id; }
public Property(int Id, propertytype.PropertyType pt) { _pt = pt; _id = Id; if (_pt.DataTypeDefinition.DataType == null) { throw new Exception(string.Format("Could not load datatype '{0}'", _pt.DataTypeDefinition.Text)); } _data = _pt.DataTypeDefinition.DataType.Data; _data.PropertyId = Id; }
public static Property MakeNew(propertytype.PropertyType pt, Content c, Guid versionId) { int newPropertyId = 0; // The method is synchronized SqlHelper.ExecuteNonQuery("INSERT INTO cmsPropertyData (contentNodeId, versionId, propertyTypeId) VALUES(@contentNodeId, @versionId, @propertyTypeId)", SqlHelper.CreateParameter("@contentNodeId", c.Id), SqlHelper.CreateParameter("@versionId", versionId), SqlHelper.CreateParameter("@propertyTypeId", pt.Id)); newPropertyId = SqlHelper.ExecuteScalar <int>("SELECT MAX(id) FROM cmsPropertyData"); interfaces.IData d = pt.DataTypeDefinition.DataType.Data; d.MakeNew(newPropertyId); return(new Property(newPropertyId, pt)); }
/// <summary> /// Set if the data should be displayed on members of this type's profilepage /// </summary> /// <param Name="pt">PropertyType</param> /// <param Name="value">True/False if the data should be displayed</param> public void setMemberViewOnProfile(propertytype.PropertyType pt, bool value) { int tmpval = 0; if (value) { tmpval = 1; } if (propertyTypeRegistered(pt)) { Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text, "Update cmsMemberType set viewOnProfile = " + tmpval + " where NodeId = " + this.Id + " And propertytypeId = " + pt.Id); } else { Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(_ConnString, CommandType.Text, "insert into cmsMemberType (NodeId, propertytypeid, viewOnProfile) values (" + this.Id + "," + pt.Id + ", " + tmpval + ")"); } }
private bool propertyTypeRegistered(propertytype.PropertyType pt) { return(int.Parse(Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteScalar(_ConnString, CommandType.Text, "Select count(pk) as tmp from cmsMemberType where NodeId = " + this.Id + " And propertytypeId = " + pt.Id).ToString()) > 0); }