Example #1
0
        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));
        }
Example #2
0
        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));
        }