public void ListFormGenerate(string tableName, bool blank, DataTable dt, string inputDirectroy, string outputDirectroy)
        {
            clsFindReplace fr = new clsFindReplace();

            string inclassfile     = inputDirectroy + "\\" + templateListclassname + ".cs";
            string outclassfile    = outputDirectroy + "\\" + tableName + "_Lst" + ".cs";
            string indesignerfile  = inputDirectroy + "\\" + templateListclassname + ".Designer.cs";
            string outdesignerfile = outputDirectroy + "\\" + tableName + "_Lst" + ".Designer.cs";
            string inresourcefile  = inputDirectroy + "\\" + templateListclassname + ".resx";
            string outresourcefile = outputDirectroy + "\\" + tableName + "_Lst" + ".resx";
            string genstring       = "";

            fr.findReplace(inclassfile, outclassfile, templateListclassname, tableName + "_Lst");
            fr.findReplace(indesignerfile, outdesignerfile, templateListclassname, tableName + "_Lst");
            fr.findReplace(inresourcefile, outresourcefile, templateListclassname, tableName + "_Lst");
            fr.findReplace(outclassfile, outclassfile, templateEntryclassname, tableName + "_Ent");
            if (!blank)
            {
                clsgridDeclare  grideclare = new clsgridDeclare();
                clsGrid         grid       = new clsGrid();
                clsGridAddRange gridrange  = new clsGridAddRange();
                string          gridCode   = null;

                gridCode  = grid.gencreate(dt) + gridrange.gencreate(dt) + "}" + grideclare.gencreate(dt);
                genstring = (new clsListing()).gencreate(dt);
                fr.findReplace(outclassfile, outclassfile, "//<Listing>", "//<Listing>\n" + genstring);
                fr.findReplace(outdesignerfile, outdesignerfile, "}//<Control>", gridCode);
                //for extra text
                fr.findReplace(outdesignerfile, outdesignerfile, "TextExtraValue", grid.table.text + " List");
            }
        }
        public void entryFormGenerate(string tableName, bool blank, DataTable dt, string inputDirectroy, string outputDirectroy, bool withPanel, bool withLable, string parent)
        {
            clsFindReplace fr      = new clsFindReplace();
            string         infile  = inputDirectroy + "\\" + templateEntryclassname;
            string         outfile = outputDirectroy + "\\" + tableName + "_Ent";

            string genstring = "";

            fr.findReplace(infile + ".cs", outfile + ".cs", templateEntryclassname, tableName + "_Ent");
            fr.findReplace(infile + ".Designer.cs", outfile + ".Designer.cs", templateEntryclassname, tableName + "_Ent");
            fr.findReplace(infile + ".resx", outfile + ".resx", templateEntryclassname, tableName + "_Ent");
            string controls = "";

            if (!blank)
            {
                clsEntry ent = new clsEntry();

                genstring = ent.gencreate(dt);
                controls  = myCg.Controlsw.createControls(withLable, dt, withPanel, parent);
                fr.findReplace(outfile + ".cs", outfile + ".cs", "//<Entry>", "//<Entry>\n" + genstring);
                //for form text
                fr.findReplace(outfile + ".Designer.cs", outfile + ".Designer.cs", "TextExtraValue", ent.table.text);
                fr.findReplace(outfile + ".Designer.cs", outfile + ".Designer.cs", "LableExtraValue", ent.table.text);
                fr.findReplace(outfile + ".Designer.cs", outfile + ".Designer.cs", "}//<Control>", controls);
            }
        }
        public override void Execute()
        {
            bool   entWithPanel    = Properties.Settings.Default.Entry_WithPanel;
            bool   entWtihLable    = Properties.Settings.Default.Entry_WithLable;
            string lableEnding     = Properties.Settings.Default.LabelEnding;
            string strParent       = Properties.Settings.Default.Parent;
            string outputDirectroy = Properties.Settings.Default.OutputDirectory;
            string inputDirectroy  = Properties.Settings.Default.InputDirectory;

            if (outputDirectroy.IndexOf('\\') < 1)
            {
                outputDirectroy = Application.StartupPath + "\\" + outputDirectroy;
            }
            if (inputDirectroy.IndexOf('\\') < 1)
            {
                inputDirectroy = Application.StartupPath + "\\" + inputDirectroy;
            }
            //delete all filse in output directory
            foreach (string file in Directory.GetFiles(outputDirectroy))
            {
                File.Delete(file);
            }
            DataSet ds = ICg.ExcelFunction.getData();

            if (ds == null)
            {
                return;
            }
            string         tablename = null;
            clsFindReplace fr        = new clsFindReplace();

            foreach (DataTable dt in ds.Tables)
            {
                tablename = dt.TableName;
                //entry
                entryFormGenerate(tablename, false, dt, inputDirectroy, outputDirectroy, entWithPanel, entWtihLable, strParent);
                //listing
                // listingFormGenerate(tablename, chkBlank.Checked, dt);
            }
            try
            {
                Clipboard.SetText(outputDirectroy);


                Process.Start(outputDirectroy);
            }
            catch { }
        }
        private void entryFormGenerate(string tableName, bool blank, DataTable dt, string inputDirectroy, string outputDirectroy, string lableEnding)
        {
            clsFindReplace fr      = new clsFindReplace();
            string         infile  = inputDirectroy + "\\" + templateEntryclassname;
            string         outfile = outputDirectroy + "\\" + tableName + "_Ent";

            string genstring = "";

            fr.findReplace(infile + ".cs", outfile + ".cs", templateEntryclassname, tableName + "_Ent");
            fr.findReplace(infile + ".Designer.cs", outfile + ".Designer.cs", templateEntryclassname, tableName + "_Ent");
            fr.findReplace(infile + ".resx", outfile + ".resx", templateEntryclassname, tableName + "_Ent");


            if (!blank)
            {
                clsEntry ent = new clsEntry();
                genstring = ent.gencreate(dt);
                fr.findReplace(outfile + ".cs", outfile + ".cs", "//<Entry>", "//<Entry>\n" + genstring);
                //for form text
                fr.findReplace(outfile + ".Designer.cs", outfile + ".Designer.cs", "TextExtraValue", ent.table.text);
                fr.findReplace(outfile + ".Designer.cs", outfile + ".Designer.cs", "LableExtraValue", ent.table.text);
                fr.findReplace(outfile + ".Designer.cs", outfile + ".Designer.cs", "}//<Control>", myCg.Controlsw.createControls(false, dt, false, "this"));
            }
        }