void updateChannelEntityForTemplate(string templateId) { if (!initializeListener()) { return; } SpecificationFieldType specificationFieldType = Context.ExtensionManager.DataService.GetSpecificationFieldType(templateId); updateChannelEntityId(specificationFieldType.EntityId); }
public void Specification() { var specFieldType = new SpecificationFieldType(); specFieldType.Id = Guid.NewGuid().ToString().Replace("-", ""); //Example of auto generated Id specFieldType.EntityId = 3974; //SPECIFICATION ENTITY specFieldType.Index = 1; specFieldType.DataType = DataType.String; //specFieldType.CVLId = "Color"; //specFieldType.Multivalue = true; specFieldType.Name = new LocaleString(RemoteManager.UtilityService.GetAllLanguages()); specFieldType.Name[new CultureInfo("en")] = "Main Colors"; specFieldType.Mandatory = false; specFieldType.CategoryId = "MyNewCategory"; RemoteManager.DataService.AddSpecificationFieldType(specFieldType); var f = new SpecificationField(); f.EntityId = 3932; //ENTITY TO LINK FOR (e.g. Product, Items, etc) f.Data = "My value"; f.SpecificationFieldType = RemoteManager.DataService.GetSpecificationFieldType(specFieldType.Id); //GUID RemoteManager.DataService.AddSpecificationField(f); var category = new Category(); category.Id = "MyNewCategory"; category.Index = 2; var name = new LocaleString(RemoteManager.UtilityService.GetAllLanguages()); name[new CultureInfo("en")] = "My new category"; name[new CultureInfo("sv")] = "Min nya kategori"; category.Name = name; RemoteManager.DataService.AddSpecificationCategory(category); //Enable/disable a current template (if disable it will not visible to specification) RemoteManager.DataService.EnableSpecificationTemplateFieldType(false, 3974, "7710e7b5445b4dd89ca008e6d442720c"); }
public string GetFormattedValueWithCultureInfo(SpecificationFieldType specificationFieldType, int entityId, CultureInfo ci) { throw new NotImplementedException(); }
public string GetFormattedValue(SpecificationFieldType specificationFieldType, int entityId) { throw new NotImplementedException(); }
public SpecificationFieldType UpdateSpecificationFieldType(SpecificationFieldType specificationFieldType) { throw new NotImplementedException(); }
private List <XElement> GetDataElements(object data, SpecificationFieldType specificationFieldType) { List <XElement> elements = new List <XElement>(); if (data == null) { elements.Add(new XElement(this.targetNamespace + "Data")); return(elements); } if (specificationFieldType.DataType == "LocaleString") { XElement localeElement = this.AddLocaleStringData((LocaleString)data); localeElement.Add(new XAttribute(targetNamespace + "type", "LocaleStringType")); elements.Add(localeElement); return(elements); } if (specificationFieldType.Multivalue) { string fieldData = data.ToString(); var multivalues = fieldData.Split(';'); if (string.IsNullOrEmpty(fieldData)) { XElement dataSubElement = new XElement(this.targetNamespace + "Data", string.Empty); elements.Add(dataSubElement); } else { foreach (string value in multivalues) { if (string.IsNullOrEmpty(value)) { continue; } XElement dataSubElement = new XElement(this.targetNamespace + "Data", value); elements.Add(dataSubElement); } } } else { XElement dataElement = new XElement(this.targetNamespace + "Data", new XCData(data.ToString())); elements.Add(dataElement); } if (specificationFieldType.DataType == DataType.CVL) { foreach (XElement element in elements) { if (element.Name.LocalName == "Data") { element.Add(new XAttribute(targetNamespace + "type", "StringType")); element.Add(new XAttribute("cvl", specificationFieldType.CVLId)); } } } return(elements); }