private string ExtractSection(XmlNode sectionNode, int lcid, List <CrmFormSection> crmFormSections, Entity form, string tabName, EntityMetadata entity) { if (sectionNode.Attributes == null || sectionNode.Attributes["id"] == null) { return(string.Empty); } var sectionId = sectionNode.Attributes["id"].Value; var sectionLabelNode = sectionNode.SelectSingleNode("labels/label[@languagecode='" + lcid + "']"); if (sectionLabelNode == null || sectionLabelNode.Attributes == null) { return(string.Empty); } var sectionNameAttr = sectionLabelNode.Attributes["description"]; if (sectionNameAttr == null) { return(string.Empty); } var sectionName = sectionNameAttr.Value; var crmFormSection = crmFormSections.FirstOrDefault( f => f.Id == new Guid(sectionId) && f.FormUniqueId == form.GetAttributeValue <Guid>("formidunique")); if (crmFormSection == null) { crmFormSection = new CrmFormSection { Id = new Guid(sectionId), FormUniqueId = form.GetAttributeValue <Guid>("formidunique"), FormId = form.GetAttributeValue <Guid>("formid"), Form = form.GetAttributeValue <string>("name"), Tab = tabName, Entity = entity.LogicalName, Names = new Dictionary <int, string>() }; crmFormSections.Add(crmFormSection); } if (crmFormSection.Names.ContainsKey(lcid)) { return(sectionName); } crmFormSection.Names.Add(lcid, sectionName); return(sectionName); }
private static int ExportSection(List <int> languages, ExcelWorksheet sectionSheet, int line, CrmFormSection crmFormSection) { var cell = 0; ZeroBasedSheet.Cell(sectionSheet, line, cell++).Value = crmFormSection.Id.ToString("B"); ZeroBasedSheet.Cell(sectionSheet, line, cell++).Value = crmFormSection.Form; ZeroBasedSheet.Cell(sectionSheet, line, cell++).Value = crmFormSection.FormUniqueId.ToString("B"); ZeroBasedSheet.Cell(sectionSheet, line, cell++).Value = crmFormSection.FormId.ToString("B"); ZeroBasedSheet.Cell(sectionSheet, line, cell++).Value = crmFormSection.Tab; foreach (var lcid in languages) { bool exists = crmFormSection.Names.ContainsKey(lcid); ZeroBasedSheet.Cell(sectionSheet, line, cell++).Value = exists ? crmFormSection.Names.First(n => n.Key == lcid).Value : string.Empty; } line++; return(line); }
private string ExtractSection(XmlNode sectionNode, int lcid, List<CrmFormSection> crmFormSections, Entity form, string tabName) { if (sectionNode.Attributes == null || sectionNode.Attributes["id"] == null) return string.Empty; var sectionId = sectionNode.Attributes["id"].Value; var sectionLabelNode = sectionNode.SelectSingleNode("labels/label[@languagecode='" + lcid + "']"); if (sectionLabelNode == null || sectionLabelNode.Attributes == null) return string.Empty; var sectionNameAttr = sectionLabelNode.Attributes["description"]; if (sectionNameAttr == null) return string.Empty; var sectionName = sectionNameAttr.Value; var crmFormSection = crmFormSections.FirstOrDefault( f => f.Id == new Guid(sectionId) && f.FormUniqueId == form.GetAttributeValue<Guid>("formidunique")); if (crmFormSection == null) { crmFormSection = new CrmFormSection { Id = new Guid(sectionId), FormUniqueId = form.GetAttributeValue<Guid>("formidunique"), FormId = form.GetAttributeValue<Guid>("formid"), Form = form.GetAttributeValue<string>("name"), Tab = tabName, Names = new Dictionary<int, string>() }; crmFormSections.Add(crmFormSection); } if (crmFormSection.Names.ContainsKey(lcid)) { return sectionName; } crmFormSection.Names.Add(lcid, sectionName); return sectionName; }
private static int ExportSection(List<int> languages, ExcelWorksheet sectionSheet, int line, CrmFormSection crmFormSection) { var cell = 0; ZeroBasedSheet.Cell(sectionSheet, line, cell++).Value = crmFormSection.Id.ToString("B"); ZeroBasedSheet.Cell(sectionSheet, line, cell++).Value = crmFormSection.Form; ZeroBasedSheet.Cell(sectionSheet, line, cell++).Value = crmFormSection.FormUniqueId.ToString("B"); ZeroBasedSheet.Cell(sectionSheet, line, cell++).Value = crmFormSection.FormId.ToString("B"); ZeroBasedSheet.Cell(sectionSheet, line, cell++).Value = crmFormSection.Tab; foreach (var lcid in languages) { bool exists = crmFormSection.Names.ContainsKey(lcid); ZeroBasedSheet.Cell(sectionSheet, line, cell++).Value = exists ? crmFormSection.Names.First(n => n.Key == lcid).Value : string.Empty; } line++; return line; }