Beispiel #1
0
        private void CreateApiIndexFiles()
        {
            foreach (var solution in StepInput.SDProject.Solutions.Values)
            {
                var sdRepository = solution.Repositories.SingleOrDefault(r => r.TargetFx.Identifier == StepInput.CurrentTargetFx.Identifier);
                if (sdRepository != null)
                {
                    foreach (var sdNamespace in sdRepository.GetAllNamespaces())
                    {
                        ExecuteOnStepMessage(string.Format("{0}: {1}", StepInput.ChmStrings.CreateIndexFilesFor, sdNamespace.Fullname));

                        var namespaceHtmlFile = Path.Combine(StepInput.TmpPath, sdNamespace.Guid + ".html");
                        var template          = new NamespaceTemplate {
                            SDNamespace = sdNamespace
                        };
                        File.WriteAllText(namespaceHtmlFile, template.TransformText());

                        foreach (var sdType in sdNamespace.Types)
                        {
                            var fieldsIndexHtmlFile = Path.Combine(StepInput.TmpPath, sdType.Guid + "-Fields.html");
                            var fieldsTemplate      = new FieldsTemplate {
                                SDType = sdType
                            };
                            File.WriteAllText(fieldsIndexHtmlFile, fieldsTemplate.TransformText());

                            var eveIndexHtmlFile = Path.Combine(StepInput.TmpPath, sdType.Guid + "-Events.html");
                            var eventsTemplate   = new EventsTemplate {
                                SDType = sdType
                            };
                            File.WriteAllText(eveIndexHtmlFile, eventsTemplate.TransformText());

                            var propertiesIndexHtmlFile = Path.Combine(StepInput.TmpPath, sdType.Guid + "-Properties.html");
                            var propertiesTemplate      = new PropertiesTemplate {
                                SDType = sdType
                            };
                            File.WriteAllText(propertiesIndexHtmlFile, propertiesTemplate.TransformText());

                            var constructorsIndexHtmlFile = Path.Combine(StepInput.TmpPath, sdType.Guid + "-Constructors.html");
                            var constructorsTemplate      = new ConstructorsTemplate {
                                SDType = sdType
                            };
                            File.WriteAllText(constructorsIndexHtmlFile, constructorsTemplate.TransformText());

                            var methodsIndexHtmlFile = Path.Combine(StepInput.TmpPath, sdType.Guid + "-Methods.html");
                            var methodsTemplate      = new MethodsTemplate {
                                SDType = sdType
                            };
                            File.WriteAllText(methodsIndexHtmlFile, methodsTemplate.TransformText());
                        }
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        private void MappingTemplate()
        {
            if (cmbTemplate.SelectedIndex == 0)
            {
                string code = string.Empty;
                if (Templates.Count == 1)
                {
                    code = string.Format("IM{0}{1:000}", Entity, 1);
                }
                else
                {
                    code = string.Format("IM{0}{1:000}", Entity, Templates.Count);
                }

                Template = new Template1Dto()
                {
                    Code        = code,
                    Description = string.Format("Template Import Subdepo {0}", Templates.Count),
                    Type        = GlobalVariables.Import,
                    Entity      = Entity
                };
                if (FieldsTemplate != null)
                {
                    FieldsTemplate.Clear();
                }
                else
                {
                    FieldsTemplate = new List <Template2Dto>();
                }
                if (cmbNameField.SelectedIndex != 0)
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 1,
                        Source      = cmbNameField.SelectedValue.ToString(),
                        Destination = "SDSDNM"
                    });
                }
                else
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 1,
                        Source      = string.Empty,
                        Destination = "SDSDNM"
                    });
                }

                if (cmbPhone1Field.SelectedIndex != 0)
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 2,
                        Source      = cmbOldCodeField.SelectedValue.ToString(),
                        Destination = "SDSDON"
                    });
                }
                else
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 2,
                        Source      = string.Empty,
                        Destination = "SDSDON"
                    });
                }

                if (cmbAdd1Field.SelectedIndex != 0)
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 3,
                        Source      = cmbAdd1Field.SelectedValue.ToString(),
                        Destination = "SDADD1"
                    });
                }
                else
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 3,
                        Source      = string.Empty,
                        Destination = "SDADD1"
                    });
                }

                if (cmbAdd2Field.SelectedIndex != 0)
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 4,
                        Source      = cmbAdd2Field.SelectedValue.ToString(),
                        Destination = "SDADD2"
                    });
                }
                else
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 4,
                        Source      = string.Empty,
                        Destination = "SDADD2"
                    });
                }

                if (cmbCityField.SelectedIndex != 0)
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 5,
                        Source      = cmbCityField.SelectedValue.ToString(),
                        Destination = "SDCITY"
                    });
                }
                else
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 5,
                        Source      = string.Empty,
                        Destination = "SDCITY"
                    });
                }

                if (cmbZipCodeField.SelectedIndex != 0)
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 6,
                        Source      = cmbZipCodeField.SelectedValue.ToString(),
                        Destination = "SDZPCD"
                    });
                }
                else
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 6,
                        Source      = string.Empty,
                        Destination = "SDZPCD"
                    });
                }

                if (cmbPhone1Field.SelectedIndex != 0)
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 7,
                        Source      = cmbPhone1Field.SelectedValue.ToString(),
                        Destination = "SDPHN1"
                    });
                }
                else
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 7,
                        Source      = string.Empty,
                        Destination = "SDPHN1"
                    });
                }

                if (cmbFax1Field.SelectedIndex != 0)
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 8,
                        Source      = cmbFax1Field.SelectedValue.ToString(),
                        Destination = "SDFAX1"
                    });
                }
                else
                {
                    FieldsTemplate.Add(new Template2Dto()
                    {
                        Code        = code,
                        Sequence    = 8,
                        Source      = string.Empty,
                        Destination = "SDFAX1"
                    });
                }
            }
        }