public TableClassGeneratorForm()
 {
     InitializeComponent();
     tableGenerator = new TableClassGenerator();
     settin         = new Setting();
     clsPrint       = new ClassPrinter();
     //clsPrint.ClassNameSpace = "MyNameSpace";
 }
Ejemplo n.º 2
0
        private string BaseDLToString()
        {
            StringBuilder classBuilder = new StringBuilder();

            classBuilder.AppendFormat("namespace {0}.{1}.{2}\n", _classNameSpace, nameSpaceSource, nameSpaceBase);
            classBuilder.AppendLine("{");
            classBuilder.AppendFormat("\tusing {0};\n", using_namespace_MN);
            classBuilder.AppendFormat("\tusing {0};\n\n", using_namespace_QB);
            classBuilder.AppendLine("\t/* Main Data Layer Class */");
            classBuilder.AppendFormat("\tpublic class {0} : {1}\n", _baseDLName, iDLname);
            classBuilder.AppendLine("\t{");
            classBuilder.AppendFormat("\t\tprotected {0} _{1};\n", iBOname, _baseBOName.ToLower());
            classBuilder.AppendFormat("\t\tpublic {0}()\n", _baseDLName);
            classBuilder.AppendLine("\t\t{");
            classBuilder.AppendLine("\t\t}");

            classBuilder.AppendFormat("\t\tpublic {0}({1} {2})\n", _baseDLName, iBOname, _baseBOName.ToLower());
            classBuilder.AppendLine("\t\t{");
            classBuilder.AppendFormat("\t\t\t_{0} = {1};\n", _baseBOName.ToLower(), _baseBOName.ToLower());
            classBuilder.AppendLine("\t\t}");

            classBuilder.AppendLine("\t\tpublic IDbManager Manager");
            classBuilder.AppendLine("\t\t{");
            classBuilder.AppendLine("\t\t\tget");
            classBuilder.AppendLine("\t\t\t{");
            classBuilder.AppendFormat("\t\t\t\treturn new {0}(@\"{1}\");\n\n",
                                      TableClassGenerator.GetDbManager(TableClassGenerator.Index).GetType().Name,
                                      TableClassGenerator.ConnStr);
            classBuilder.AppendLine("\t\t\t}\n\t\t}\n");

            classBuilder.AppendLine("\t\tpublic int Insert()\n\t\t{");
            classBuilder.AppendFormat("\t\t\treturn Manager.Insert(_{0});\n", _baseBOName.ToLower());
            classBuilder.AppendLine("\t\t}\n");

            classBuilder.AppendLine("\t\tpublic int InsertAndGetId()\n\t\t{");
            classBuilder.AppendFormat("\t\t\treturn Manager.InsertAndGetId(_{0});\n", _baseBOName.ToLower());
            classBuilder.AppendLine("\t\t}\n");

            classBuilder.AppendLine("\t\tpublic int Update()\n\t\t{");
            classBuilder.AppendFormat("\t\t\treturn Manager.Update(_{0});\n", _baseBOName.ToLower());
            classBuilder.AppendLine("\t\t}\n");

            classBuilder.AppendLine("\t\tpublic int Delete()\n\t\t{");
            classBuilder.AppendFormat("\t\t\treturn Manager.Delete(_{0});\n", _baseBOName.ToLower());
            classBuilder.AppendLine("\t\t}\n");


            classBuilder.AppendLine("\t}\n}");
            return(classBuilder.ToString());
        }
Ejemplo n.º 3
0
 public TableClassGeneratorForm()
 {
     InitializeComponent();
     tableGenerator = new TableClassGenerator();
     clsPrint       = new ClassPrinter();
 }