diff --git a/src/umbraco.cms/businesslogic/member/MemberType.cs b/src/umbraco.cms/businesslogic/member/MemberType.cs
index 9d16490365..f1f448a8f1 100644
--- a/src/umbraco.cms/businesslogic/member/MemberType.cs
+++ b/src/umbraco.cms/businesslogic/member/MemberType.cs
@@ -78,12 +78,7 @@ namespace umbraco.cms.businesslogic.member
/// True if the Member can edit the data
public bool MemberCanEdit(PropertyType pt)
{
- if (PropertyTypeRegistered(pt))
- {
- var memberCanEdit = SqlHelper.ExecuteScalar("Select memberCanEdit from cmsMemberType where NodeId = " + this.Id + " And propertytypeId = " + pt.Id);
- return (Convert.ToBoolean(memberCanEdit));
- }
- return false;
+ return _contentType.MemberCanEditProperty(pt.Alias);
}
///
@@ -93,11 +88,7 @@ namespace umbraco.cms.businesslogic.member
/// True if the data should be displayed on the profilepage
public bool ViewOnProfile(PropertyType pt)
{
- if(PropertyTypeRegistered(pt))
- {
- return Convert.ToBoolean(SqlHelper.ExecuteScalar("Select viewOnProfile from cmsMemberType where NodeId = " + this.Id + " And propertytypeId = " + pt.Id));
- }
- return false;
+ return _contentType.MemberCanViewProperty(pt.Alias);
}
///
@@ -106,14 +97,9 @@ namespace umbraco.cms.businesslogic.member
/// PropertyType
/// True/False if Members of the type shośld be able to edit the data
public void setMemberCanEdit(PropertyType pt, bool value)
- {
- int tmpval = 0;
- if (value) tmpval = 1;
- if (PropertyTypeRegistered(pt))
- SqlHelper.ExecuteNonQuery("Update cmsMemberType set memberCanEdit = " + tmpval + " where NodeId = " + this.Id + " And propertytypeId = " + pt.Id);
- else
- SqlHelper.ExecuteNonQuery("insert into cmsMemberType (NodeId, propertytypeid, memberCanEdit,viewOnProfile) values (" + this.Id + "," + pt.Id + ", " + tmpval + ",0)");
-
+ {
+ _contentType.SetMemberCanEditProperty(pt.Alias, value);
+ ApplicationContext.Current.Services.MemberTypeService.Save(_contentType);
}
///
@@ -123,12 +109,8 @@ namespace umbraco.cms.businesslogic.member
/// True/False if the data should be displayed
public void setMemberViewOnProfile(PropertyType pt, bool value)
{
- int tmpval = 0;
- if (value) tmpval = 1;
- if (PropertyTypeRegistered(pt))
- SqlHelper.ExecuteNonQuery("Update cmsMemberType set viewOnProfile = " + tmpval + " where NodeId = " + this.Id +" And propertytypeId = "+pt.Id);
- else
- SqlHelper.ExecuteNonQuery("insert into cmsMemberType (NodeId, propertytypeid, viewOnProfile) values ("+this.Id+","+pt.Id+", "+tmpval+")");
+ _contentType.SetMemberCanViewProperty(pt.Alias, value);
+ ApplicationContext.Current.Services.MemberTypeService.Save(_contentType);
}
///
@@ -271,11 +253,6 @@ namespace umbraco.cms.businesslogic.member
base.PopulateCMSNodeFromUmbracoEntity(_contentType, ObjectType);
}
- private bool PropertyTypeRegistered(PropertyType pt)
- {
- return (SqlHelper.ExecuteScalar("Select count(pk) as tmp from cmsMemberType where NodeId = " + this.Id + " And propertytypeId = " + pt.Id) > 0);
- }
-
#endregion
#region Events