Ejemplo n.º 1
0
        public void GenCode(string TemplateFile, Table aTable)
        {
            string content = File.ReadAllText(TemplateFile);

            TemplateReader aTemplateReader = new TemplateReader(content, aTable);
            string ContentFile = aTemplateReader.CutAndSaveLoopTabToFile();

            if (TemplateFile.IndexOf("[@Table@]") >= 0)
            {
                TemplateFile = TemplateFile.Replace("[@Table@]", aTable.TableName);
            }
            else
            {
                string FileName = Path.GetFileName(TemplateFile);
                TemplateFile = Path.GetDirectoryName(TemplateFile) + "\\" + FileName;
                TemplateFile = TemplateFile.Replace("[@Table@]", aTable.TableName);
            }
            File.WriteAllText(TemplateFile,  ContentFile);
        }
Ejemplo n.º 2
0
 //===============================
 //Khởi tạo giá trị cho 2 đối tương Reader (MySQL, Template)
 //private bool SetValueFor2Reader( MySqlConnection Connect, string TemplateFilePath)
 //{
 //    this.aMySQLReader = new MySQLReader(Connect);
 //    if (string.IsNullOrEmpty(TemplateFilePath) == true)
 //    {
 //        MessageBox.Show("Chon file Template");
 //        return false;
 //    }
 //    else
 //    {
 //        this.aTemplateReader = new TemplateReader(TemplateFilePath);
 //        return true;
 //    }
 //}
 //===============================
 //Khởi tạo giá trị cho 2 đối tương Reader (MySQL, Template)
 private bool SetValueFor2Reader(SqlConnection Connect, string TemplateFilePath)
 {
     this.aMSSQLReader = new MSSQLReader(Connect);
     if (string.IsNullOrEmpty(TemplateFilePath) == true)
     {
         MessageBox.Show("Chon file Template");
         return false;
     }
     else
     {
         this.aTemplateReader = new TemplateReader(TemplateFilePath);
         return true;
     }
 }