Example #1
0
 public string Run(IDescriptionModel description)
 {
     return(Newtonsoft.Json.JsonConvert.SerializeObject(description,
                                                        Formatting.Indented,
                                                        new JsonSerializerSettings
     {
         NullValueHandling = NullValueHandling.Ignore
     }));
 }
Example #2
0
        private string RunRegion(IDescriptionModel regionDescription)
        {
            string output = "";

            /** General Title and Description**/

            // check if the element has title, and stores it
            if (!string.IsNullOrEmpty(regionDescription.Title))
            {
                output += regionDescription.Title + "\n";
            }

            // check if the element has description, and stores it
            if (!string.IsNullOrEmpty(regionDescription.Description))
            {
                output += regionDescription.Description + "\n";
            }

            // if the region is price
            if (regionDescription is IDescriptionModelPrice price)
            {
                output += "Total Amount: " + price.TotalAmount + Separation;

                // NOTE. For now, we do not consider more elements (regions inside a region)

                // we print the text descritpions of a region price DescriptionModelRegionPrice
                if (price.Texts?.Any() ?? false)
                {
                    output += RunTexts(price.Texts) + Separation;
                }

                output += PriceElements(price.Prices);
            }
            else
            {
                // we print the text descritpions of a normal DescriptionModelRegion
                if (regionDescription.Texts?.Any() ?? false)
                {
                    output += RunTexts(regionDescription.Texts);
                }
            }

            return(output);
        }
        public void Run()
        {
            // Algoritmo:

            // 4: Generamos de forma automática los textos de cada uno
            // de los elementos de las estructuras que están especificadas en el Template.

            // El componente Automatic Text Generator, creo que tiene más sentido que esté incluido en el Template.
            // De esta manera durante la creación se le puede indicar si se desea traducir una región especifica con un Automatic Text Generator X o Y.


            // 5. Los procesamos en una forma valida para el render. Teniendo en cuenta el orden para ser mostrados.
            IDescriptionModel modelText = Template.GetDescriptions(Model, Settings);


            // 6. Enviamos este último procesamiento al render.
            // JSON - 1 y 2 - TEXTO.
            StoreFile(Render.Run(modelText));
        }
Example #4
0
        /**
         * Execute the render
         *
         * @param description of the model. It contains only the important elements.
         */
        public string Run(IDescriptionModel modelDescription)
        {
            // head : description and shortdescription and full description

            string output = GetOutPutRender();


            /** General Title **/

            // check if the element has title, and stores it
            if (!string.IsNullOrEmpty(modelDescription.Title))
            {
                output += modelDescription.Title + "\n";
            }


            // check if the element (sequence) has other elements
            IList <IDescriptionModel> list = modelDescription.ListRegions;

            // if there are more elements
            if (list?.Any() ?? false)
            {
                int count = list.Count;
                IDescriptionModel current;

                // for each element, we process the region.
                for (int index = 0; index < count - 1; index++)
                {
                    current = list[index];

                    output += RunRegion(current) + Separation;
                }

                // we process the last one apart to avoid the last separation and the conditions inside the for
                current = list[count - 1];
                output += RunRegion(current);

                return(output);
            }

            return(output);
        }
Example #5
0
 public string Run(IDescriptionModel descriptionByRegions)
 {
     throw new System.NotImplementedException();
 }