/// <summary> /// Performs the package action during package installation /// </summary> /// <param name="packageName"> /// The package name. /// </param> /// <param name="xmlData"> /// The xml data. /// </param> /// <returns> /// The <see cref="bool"/> indicating success of failure. /// </returns> public bool Execute(string packageName, XmlNode xmlData) { var dtd = _services.DataTypeService.GetDataTypeDefinitionById(-88); // Create the MerchelloCustomer MemberType var mt = new MemberType(-1) { Alias = MemberTypeName, Name = MemberTypeName, AllowedAsRoot = true }; var fn = new PropertyType(dtd) { Alias = "firstName", Name = "First name" }; var ln = new PropertyType(dtd) { Alias = "lastName", Name = "Last name" }; mt.AddPropertyType(fn); mt.AddPropertyType(ln); mt.SetMemberCanEditProperty("firstName", true); mt.SetMemberCanEditProperty("lastName", true); mt.SetMemberCanViewProperty("firstName", true); mt.SetMemberCanViewProperty("lastName", true); _services.MemberTypeService.Save(mt); // Add the MemberGroup var mg = new MemberGroup() { Name = MemberGroupName }; _services.MemberGroupService.Save(mg); return true; }
/// <summary> /// Adds the Merchello MemberType. /// </summary> /// <returns> /// The <see cref="IMemberType"/>. /// </returns> private IMemberType AddMemberType() { var dtd = _services.DataTypeService.GetDataTypeDefinitionById(-88); // Create the MerchelloCustomer MemberType var mt = new MemberType(-1) { Alias = "merchelloCustomer", Name = "Merchello Customer", AllowedAsRoot = true }; var fn = new PropertyType(dtd) { Alias = "firstName", Name = "First name" }; var ln = new PropertyType(dtd) { Alias = "lastName", Name = "Last name" }; mt.AddPropertyType(fn); mt.AddPropertyType(ln); mt.SetMemberCanEditProperty("firstName", true); mt.SetMemberCanEditProperty("lastName", true); mt.SetMemberCanViewProperty("firstName", true); mt.SetMemberCanViewProperty("lastName", true); _services.MemberTypeService.Save(mt); // Add the MemberGroup var mg = new MemberGroup() { Name = "Customers" }; _services.MemberGroupService.Save(mg); return mt; }