Exemplo n.º 1
0
        public void read_file()
        {
            Textprocessor processor = new Textprocessor();

            Console.WriteLine("documento final");
            String writepath = this.targetPath + "/" + this.fileName;

            processor.read_this(writepath);
        }
Exemplo n.º 2
0
        public void write_file(String data)
        {
            Textprocessor processor = new Textprocessor();
            String        writepath = this.targetPath + "/" + this.fileName;

            Console.WriteLine("destino " + writepath);
            String readpath = this.sourcePath + "/" + this.templateName;
            String flag     = "<!--[/Content]-->";

            processor.write_this(writepath, readpath, data, flag);
        }
Exemplo n.º 3
0
        public void insert_data(Dictionary <String, int> hashMap)
        {
            Textprocessor processor = new Textprocessor();
            String        writepath = this.targetPath + "/" + this.fileName;
            String        readpath  = this.sourcePath + "/" + this.templateName;
            String        flag      = "--Data";
            String        sql       = "";

            foreach (var data in hashMap.ToArray())
            {
            }



            processor.write_this(writepath, readpath, sql, flag);
        }
Exemplo n.º 4
0
        public String generate_table(Dictionary <String, int> hashMap)
        {
            String        html      = " ";
            String        template  = "tabletest.html";
            Textprocessor processor = new Textprocessor();
            String        readpath  = this.sourcePath + "/" + template;

            string[] lines = System.IO.File.ReadAllLines(readpath);
            for (int i = 0; i < lines.Length; i++)
            {
                html += lines[i];
                html += Environment.NewLine;
                if (lines[i].Trim() == "<!--[/tabletitle]-->")
                {
                    html += this.name;
                }
                if (lines[i].Trim() == "<!--[/tableheaders]-->")
                {
                    foreach (var data in hashMap.ToArray())
                    {
                        html += "<th>" + data.Key + "</th>" + Environment.NewLine;
                    }
                    html += "<th>Opciones</th>" + Environment.NewLine;
                }
                if (lines[i].Trim() == "<!--[/tablebody]-->")
                {
                    html += "<tr>" + Environment.NewLine;
                    int Counter = -1;
                    foreach (var data in hashMap.ToArray())
                    {
                        if (data.Value == 8)
                        {
                            Counter++;
                        }
                        html += type_td(this.name, data.Value, Counter) + Environment.NewLine;
                    }
                    html += "<tr>" + Environment.NewLine;
                }
            }
            return(html);
        }
Exemplo n.º 5
0
        public String generate_form(Dictionary <String, int> hashMap)
        {
            String        template  = "modaltest.html";
            Textprocessor processor = new Textprocessor();
            String        readpath  = this.sourcePath + "/" + template;

            String html = " ";

            string[] lines = System.IO.File.ReadAllLines(readpath);

            for (int i = 0; i < lines.Length; i++)
            {
                html += lines[i];
                html += Environment.NewLine;
                if (lines[i].Trim() == "<!--[/modaltitle]-->")
                {
                    html += "Nuevo " + name;
                }
                if (lines[i].Trim() == "<!--[/forminfo]-->")
                {
                    int Counter = -1;
                    foreach (var data in hashMap.ToArray())
                    {
                        html += " <div class='form - group'>" + Environment.NewLine;
                        html += "<label class='form-control'>" + data.Key + "</label>" + Environment.NewLine;
                        if (data.Value == 8)
                        {
                            Counter++;
                        }
                        html += type_html(data.Value, data.Key, Counter) + Environment.NewLine;
                        html += "</div>" + Environment.NewLine;
                    }
                }
            }
            return(html);
        }
Exemplo n.º 6
0
        public String generateJs(Dictionary <String, int> hashMap)
        {
            String        html      = "";
            String        template  = "jcrud.js";
            Textprocessor processor = new Textprocessor();
            String        readpath  = this.sourcePath + "/" + template;

            string[] lines = System.IO.File.ReadAllLines(readpath);
            html += "<script>" + Environment.NewLine;
            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i].Trim() == "/*info_url*/")
                {
                    html += "'info_" + this.name + "/id'";
                }
                if (lines[i].Trim() == "//ParamsJsedit")
                {
                    html += "$('input[name='id']').empty();" + Environment.NewLine;
                    html += "$('input[name='id']').val(id);" + Environment.NewLine;

                    foreach (var data in hashMap.ToArray())
                    {
                        if (data.Value != 7)
                        {
                            html += "$('input[name='" + data.Key + "']').empty();" + Environment.NewLine;
                            html += "$('input[name='" + data.Key + "']').val(res." + data.Key + ");" + Environment.NewLine;
                        }
                        else
                        {
                            html += "$('input[name='" + data.Key + "']').empty();" + Environment.NewLine;
                            html += "$('input[name='" + data.Key + "']').append(res." + data.Key + ");" + Environment.NewLine;
                        }
                    }
                }
                if (lines[i].Trim() == "//ParamsJssave" || lines[i].Trim() == "//ParamsJscreate")
                {
                    html += " var id = $('input[name='id']').val();" + Environment.NewLine;
                    foreach (var data in hashMap.ToArray())
                    {
                        html += " var " + data.Key + " = $('input[name='" + data.Key + "']').val();" + Environment.NewLine;
                    }
                }
                if (lines[i].Trim() == "//Posdata")
                {
                    foreach (var data in hashMap.ToArray())
                    {
                        html += data.Key + ":" + data.Key + Environment.NewLine;
                    }
                }
                if (lines[i].Trim() == "/*updateajax_url*/")
                {
                    html += "'update_" + this.name + "/+id'";
                }
                if (lines[i].Trim() == "/*createajax_url*/")
                {
                    html += "'create_" + this.name + "/+id'";
                }
                if (lines[i].Trim() == "/*deleteajax_url*/")
                {
                    html += "'delete_" + this.name + "/+id'";
                }
                else
                {
                    html += lines[i];
                }

                html += Environment.NewLine;
            }
            html += "</script>";
            return(html);
        }