public PartJsonResult ProcessJsonRequest(System.Collections.Specialized.NameValueCollection form, MerchantTribeApplication app, Catalog.Category containerCategory) { PartJsonResult result = new PartJsonResult(); string action = form["partaction"]; switch (action.ToLowerInvariant()) { case "addpart": string parttype = form["parttype"]; IContentPart part = PartFactory.Instantiate(System.Guid.NewGuid().ToString(), parttype, this); if (part != null) { this.AddPart(part); app.CatalogServices.Categories.Update(containerCategory); result.ResultHtml = part.RenderForEdit(app, containerCategory); } break; case "resort": string sortedIds = form["sortedIds[]"]; string[] ids = sortedIds.Split(','); List <string> idList = new List <string>(); foreach (string s in ids) { idList.Add(s.Trim().Replace("part", "")); } result.Success = this.SortParts(idList); app.CatalogServices.Categories.Update(containerCategory); break; } return(result); }
private void ImportPart(string xml) { XElement x = XElement.Parse(xml, LoadOptions.None); string id = Xml.Parse(x, "id"); string typecode = Xml.Parse(x, "typecode"); IContentPart p = PartFactory.Instantiate(id, typecode, this); p.DeserializeFromXml(xml); this.AddPart(p); }