Ejemplo n.º 1
0
        public string GetStr_SetPrimaryKey(string str_nameSpace, DataTable dt_tables, string tableName)
        {
            string        temp        = tableName;
            string        tablePrefix = CommonCode.GetTablePrefix(tableName); tableName = CommonCode.GetTableName(tableName);
            StringBuilder sb_body     = new StringBuilder();

            sb_body.AppendLine("            QueryConfig.SetPrimaryKey<" + tableName + "Entity>(u => u.SysNo);");

            return(sb_body.ToString());
        }
Ejemplo n.º 2
0
        public string GetStr_SetObjectName(string str_nameSpace, DataTable dt_tables, string tableName)
        {
            string        temp        = tableName;
            string        tablePrefix = CommonCode.GetTablePrefix(tableName); tableName = CommonCode.GetTableName(tableName);
            StringBuilder sb_body     = new StringBuilder();

            sb_body.AppendLine("            QueryConfig.SetObjectName(\"" + temp + "\", typeof(" + tableName + "Entity), typeof(" + tableName + "Query));");

            return(sb_body.ToString());
        }
Ejemplo n.º 3
0
        public void Create(string str_nameSpace, DataTable dt_tables, string tableName)
        {
            string tablePrefix = CommonCode.GetTablePrefix(tableName);

            tableName = CommonCode.GetTableName(tableName);
            string tableDesc = CommonCode.GetTableDesc(tableName);

            bool   isPrimeKey = false;
            string primaryKey = "";

            StringBuilder sb = new StringBuilder();

            #region Model

            sb.AppendLine("        #region Model");
            //遍历每个字段
            foreach (DataRow dr in dt_tables.Rows)
            {
                string columnName      = dr["columnName"].ToString().Trim();           //字段名
                string columnType      = dr["columnType"].ToString().Trim();           //字段类型
                string columnComment   = dr["columnComment"].ToString().Trim();        //字段注释
                string nullable        = dr["nullable"].ToString().Trim();             //是否可空(Y是不为空,N是为空)
                string data_default    = dr["data_default"].ToString().Trim();         //默認值
                string data_maxLength  = dr["char_col_decl_length"].ToString().Trim(); //最大長度
                string bool_primaryKey = dr["primaryKey"].ToString().Trim();           //主键 值为Y或N

                if (bool_primaryKey.ToUpper() == "Y")                                  //存在主键
                {
                    isPrimeKey = true;
                    primaryKey = columnName.ToUpper();
                }
                if (string.IsNullOrEmpty(columnComment))
                {
                    columnComment = columnName;
                }

                CommonCode.GetColumnType(ref columnType, ref data_default);

                nullable = CommonCode.GetNullable(columnType, nullable);

                sb.AppendLine("");

                sb.AppendLine(@"        /// <summary>");
                sb.AppendLine(@"        /// " + columnComment);
                sb.AppendLine(@"        /// </summary>");
                //if (dr["nullable"].ToString().ToUpper().Trim() == "Y")//不為空
                //{
                //    sb.AppendLine(@"        [Required]");
                //}
                //if (!string.IsNullOrEmpty(data_maxLength))//最大長度
                //{
                //    sb.AppendLine(@"        [StringLength(" + data_maxLength + ")]");
                //}
                sb.AppendLine("        public " + columnType + nullable + " " + columnName + " { get; set; }");
            }
            sb.AppendLine("");
            sb.AppendLine("        #endregion Model");

            #endregion Model

            StringBuilder sb_body = new StringBuilder();

            sb_body.AppendLine("using System;");
            sb_body.AppendLine("using System.Collections.Generic;");
            sb_body.AppendLine("using Lee.CQuery;");
            sb_body.AppendLine("");
            sb_body.AppendLine("namespace " + str_nameSpace + ".Query." + tablePrefix + "");
            sb_body.AppendLine("{");
            sb_body.AppendLine("    /// <summary>");
            sb_body.AppendLine("    /// Query:" + tableDesc);
            sb_body.AppendLine("    /// </summary>");
            sb_body.AppendLine("    public class " + tableName + "Query : IQueryModel<" + tableName + "Query>");
            sb_body.AppendLine("    {");

            sb_body.Append(sb.ToString());

            sb_body.AppendLine("    }");
            sb_body.AppendLine("}");


            string file_Model = "C:\\Code\\" + str_nameSpace + ".Query\\" + tablePrefix + "";
            if (!Directory.Exists(file_Model))
            {
                Directory.CreateDirectory(file_Model);
            }
            CommonCode.Save(file_Model + "/" + tableName + "Query" + ".cs", sb_body.ToString());
        }
Ejemplo n.º 4
0
        public void Create(string str_nameSpace, DataTable dt_tables, string tableName)
        {
            string tablePrefix = CommonCode.GetTablePrefix(tableName);

            tableName = CommonCode.GetTableName(tableName);
            string tableDesc = CommonCode.GetTableDesc(tableName);

            bool   isPrimeKey = false;
            string primaryKey = "";

            StringBuilder sb        = new StringBuilder();
            StringBuilder sb_ext    = new StringBuilder();
            StringBuilder sb_search = new StringBuilder();

            #region Model

            sb.AppendLine("        #region Model");
            //遍历每个字段
            foreach (DataRow dr in dt_tables.Rows)
            {
                string columnName      = dr["columnName"].ToString().Trim();           //字段名
                string columnType      = dr["columnType"].ToString().Trim();           //字段类型
                string columnComment   = dr["columnComment"].ToString().Trim();        //字段注释
                string nullable        = dr["nullable"].ToString().Trim();             //是否可空(Y是不为空,N是为空)
                string data_default    = dr["data_default"].ToString().Trim();         //默認值
                string data_maxLength  = dr["char_col_decl_length"].ToString().Trim(); //最大長度
                string bool_primaryKey = dr["primaryKey"].ToString().Trim();           //主键 值为Y或N

                if (bool_primaryKey.ToUpper() == "Y")                                  //存在主键
                {
                    isPrimeKey = true;
                    primaryKey = columnName.ToUpper();
                }
                if (string.IsNullOrEmpty(columnComment))
                {
                    columnComment = columnName;
                }

                CommonCode.GetColumnType(ref columnType, ref data_default);

                nullable = CommonCode.GetNullable(columnType, nullable);

                nullable = columnType == "string" ? "" : "?";

                sb.AppendLine("");
                sb.AppendLine(@"        /// <summary>");
                sb.AppendLine(@"        /// " + columnComment);
                sb.AppendLine(@"        /// </summary>");
                sb.AppendLine("        public " + columnType + nullable + " " + columnName + " { get; set; }");

                if (columnType == "string")
                {
                    sb_search.AppendLine("");
                    sb_search.AppendLine(@"        /// <summary>");
                    sb_search.AppendLine(@"        /// " + columnComment);
                    sb_search.AppendLine(@"        /// </summary>");
                    sb_search.AppendLine("        public " + columnType + nullable + " " + columnName + "_Search { get; set; }");
                }
            }
            sb.AppendLine("");
            sb.AppendLine("        #endregion Model");


            #endregion Model


            SetData(tableName, sb_ext);

            StringBuilder sb_load   = new StringBuilder();
            var           listModel = CommonCode.GetTableModel(tableName);
            if (listModel != null)
            {
                foreach (var item in listModel)
                {
                    SetLoad(sb_load, item);
                }
            }

            StringBuilder sb_body = new StringBuilder();

            sb_body.AppendLine("using System;");
            sb_body.AppendLine("using System.Collections.Generic;");
            sb_body.AppendLine("using Lee.CQuery.Paging;");
            sb_body.AppendLine("");
            sb_body.AppendLine("namespace " + str_nameSpace + ".DTO." + tablePrefix + ".Query.Filter");
            sb_body.AppendLine("{");
            sb_body.AppendLine("    /// <summary>");
            sb_body.AppendLine("    /// FilterDto:" + tableDesc);
            sb_body.AppendLine("    /// </summary>");
            sb_body.AppendLine("    public class " + tableName + "FilterDto : PagingFilter");
            sb_body.AppendLine("    {");
            sb_body.AppendLine("");

            sb_body.Append(sb.ToString());

            sb_body.AppendLine("");
            sb_body.AppendLine("        #region Search");
            sb_body.Append(sb_search.ToString());
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion Search");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 数据加载");
            sb_body.AppendLine("");
            sb_body.AppendLine(sb_load.ToString());
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 扩展");
            sb_body.AppendLine("");
            sb_body.AppendLine(sb_ext.ToString());
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");


            sb_body.AppendLine("    }");
            sb_body.AppendLine("}");

            string file_Model = "C:\\Code\\" + str_nameSpace + ".DTO\\" + tablePrefix + "\\Query\\Filter";
            if (!Directory.Exists(file_Model))
            {
                Directory.CreateDirectory(file_Model);
            }
            CommonCode.Save(file_Model + "/" + tableName + "FilterDto" + ".cs", sb_body.ToString());
        }
Ejemplo n.º 5
0
        public void Create(string str_nameSpace, DataTable dt_tables, string tableName)
        {
            string tablePrefix = CommonCode.GetTablePrefix(tableName);

            tableName = CommonCode.GetTableName(tableName);
            string tableDesc = CommonCode.GetTableDesc(tableName);

            bool   isPrimeKey = false;
            string primaryKey = "";

            StringBuilder sb  = new StringBuilder();
            StringBuilder sb2 = new StringBuilder();
            StringBuilder sb3 = new StringBuilder();

            #region Model

            //遍历每个字段
            foreach (DataRow dr in dt_tables.Rows)
            {
                string columnName      = dr["columnName"].ToString().Trim();           //字段名
                string columnType      = dr["columnType"].ToString().Trim();           //字段类型
                string columnComment   = dr["columnComment"].ToString().Trim();        //字段注释
                string nullable        = dr["nullable"].ToString().Trim();             //是否可空(Y是不为空,N是为空)
                string data_default    = dr["data_default"].ToString().Trim();         //默認值
                string data_maxLength  = dr["char_col_decl_length"].ToString().Trim(); //最大長度
                string bool_primaryKey = dr["primaryKey"].ToString().Trim();           //主键 值为Y或N

                if (bool_primaryKey.ToUpper() == "Y")                                  //存在主键
                {
                    isPrimeKey = true;
                    primaryKey = columnName.ToUpper();
                }
                if (string.IsNullOrEmpty(columnComment))
                {
                    columnComment = columnName;
                }

                CommonCode.GetColumnType(ref columnType, ref data_default);

                nullable = CommonCode.GetNullable(columnType, nullable);

                sb.AppendLine("");
                sb.AppendLine(@"        /// <summary>");
                sb.AppendLine(@"        /// " + columnComment);
                sb.AppendLine(@"        /// </summary>");
                sb.AppendLine("        protected " + columnType + nullable + " _" + columnName + ";");

                sb2.AppendLine("        /// <summary>");
                sb2.AppendLine("        /// " + columnComment);
                sb2.AppendLine("        /// </summary>");
                sb2.AppendLine("        public " + columnType + nullable + " " + columnName);
                sb2.AppendLine("        {");
                sb2.AppendLine("            get { return _" + columnName + "; }");
                sb2.AppendLine("            protected set { _" + columnName + " = value; }");
                sb2.AppendLine("        }");
                sb2.AppendLine("");
                SetExcludePropertys(tableName, sb3, columnName);
            }

            StringBuilder sb_instance       = new StringBuilder();
            StringBuilder sb_instanceMethod = new StringBuilder();
            StringBuilder sb_SetLazyMember  = new StringBuilder();
            StringBuilder sb_attribute      = new StringBuilder();

            var listModel = CommonCode.GetTableModel(tableName);
            if (listModel != null)
            {
                foreach (var item in listModel)
                {
                    SetSB(sb, item);
                    SetInstance(tableName, sb_instance, sb_instanceMethod, sb_SetLazyMember, item);
                    SetAttribute(sb_attribute, item);
                }
            }



            #endregion Model

            StringBuilder sb_body = new StringBuilder();

            sb_body.AppendLine("using System;");
            sb_body.AppendLine("using System.Collections.Generic;");
            sb_body.AppendLine("using System.Linq;");
            sb_body.AppendLine("using Lee.CQuery;");
            sb_body.AppendLine("using Lee.Domain.Aggregation;");
            sb_body.AppendLine("using Lee.Utility;");
            sb_body.AppendLine("using Lee.Utility.Extension;");
            sb_body.AppendLine("using Lee.Utility.ValueType;");
            sb_body.AppendLine("using " + str_nameSpace + ".Domain.Model;");
            sb_body.AppendLine("using " + str_nameSpace + ".Domain.Service;");
            sb_body.AppendLine("using " + str_nameSpace + ".Query;");
            sb_body.AppendLine("using " + str_nameSpace + ".Query." + tablePrefix + ";");
            sb_body.AppendLine("using " + str_nameSpace + ".Domain." + tablePrefix + ".Model;");
            sb_body.AppendLine("using " + str_nameSpace + ".Domain." + tablePrefix + ".Repository;");
            sb_body.AppendLine("using " + str_nameSpace + ".Domain." + tablePrefix + ".Service;");
            sb_body.AppendLine("using " + str_nameSpace + ".Domain.Repository;");
            if (tablePrefix != "Data")
            {
                sb_body.AppendLine("using " + str_nameSpace + ".Domain.Data.Model;");
                sb_body.AppendLine("using " + str_nameSpace + ".Domain.Data.Service;");
            }



            sb_body.AppendLine("");
            sb_body.AppendLine("namespace " + str_nameSpace + ".Domain." + tablePrefix + ".Model");
            sb_body.AppendLine("{");
            sb_body.AppendLine("    /// <summary>");
            sb_body.AppendLine("    /// DomainModel:" + tableDesc);
            sb_body.AppendLine("    /// </summary>");
            sb_body.AppendLine("    public class " + tableName + " : AggregationRoot<" + tableName + ">");
            sb_body.AppendLine("    {");
            sb_body.AppendLine("        I" + tableName + "Repository " + tableName + "Repository = null;");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region	字段");
            sb_body.AppendLine("");

            sb_body.AppendLine(sb.ToString());

            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 构造方法");
            sb_body.AppendLine("");
            sb_body.AppendLine("        /// <summary>");
            sb_body.AppendLine("        /// 实例化对象");
            sb_body.AppendLine("        /// </summary>");
            sb_body.AppendLine("        /// <param name=\"SysNo\">编号</param>");
            sb_body.AppendLine("        internal " + tableName + "(Guid? SysNo = null)");
            sb_body.AppendLine("        {");
            sb_body.AppendLine("            _SysNo = SysNo ?? Guid.Empty;");
            sb_body.AppendLine("            " + tableName + "Repository = this.Instance<I" + tableName + "Repository>();");
            sb_body.AppendLine("");
            sb_body.AppendLine(sb_instance.ToString());
            sb_body.AppendLine("        }");
            sb_body.AppendLine("");
            sb_body.AppendLine(sb_instanceMethod.ToString());
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 设置LazyMember");
            sb_body.AppendLine("");
            sb_body.AppendLine(sb_SetLazyMember.ToString());
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");


            sb_body.AppendLine("");
            sb_body.AppendLine("        #region	属性");
            sb_body.AppendLine("");

            sb_body.AppendLine(sb2.ToString());

            sb_body.AppendLine("");
            sb_body.AppendLine(sb_attribute.ToString());
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 方法");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 功能方法");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 保存");
            sb_body.AppendLine("");
            sb_body.AppendLine("        /// <summary>");
            sb_body.AppendLine("        /// 保存");
            sb_body.AppendLine("        /// </summary>");
            sb_body.AppendLine("        public override void Save()");
            sb_body.AppendLine("        {");
            sb_body.AppendLine("            " + tableName + "Repository.Save(this);");
            sb_body.AppendLine("        }");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region	移除");
            sb_body.AppendLine("");
            sb_body.AppendLine("        /// <summary>");
            sb_body.AppendLine("        /// 移除");
            sb_body.AppendLine("        /// </summary>");
            sb_body.AppendLine("        public override void Remove()");
            sb_body.AppendLine("        {");
            sb_body.AppendLine("            " + tableName + "Repository.Remove(this);");
            sb_body.AppendLine("        }");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 初始化标识信息");
            sb_body.AppendLine("");
            sb_body.AppendLine("        /// <summary>");
            sb_body.AppendLine("        /// 初始化标识信息");
            sb_body.AppendLine("        /// </summary>");
            sb_body.AppendLine("        public override void InitPrimaryValue()");
            sb_body.AppendLine("        {");
            sb_body.AppendLine("            base.InitPrimaryValue();");
            sb_body.AppendLine("            _SysNo = Generate" + tableName + "Id();");
            sb_body.AppendLine("        }");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 内部方法");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 判断标识对象值是否为空");
            sb_body.AppendLine("");
            sb_body.AppendLine("        /// <summary>");
            sb_body.AppendLine("        /// 判断标识对象值是否为空");
            sb_body.AppendLine("        /// </summary>");
            sb_body.AppendLine("        /// <returns></returns>");
            sb_body.AppendLine("        protected override bool PrimaryValueIsNone()");
            sb_body.AppendLine("        {");
            sb_body.AppendLine("            return _SysNo == Guid.Empty;");
            sb_body.AppendLine("        }");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 静态方法");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 生成一个编号");
            sb_body.AppendLine("");
            sb_body.AppendLine("        /// <summary>");
            sb_body.AppendLine("        /// 生成一个编号");
            sb_body.AppendLine("        /// </summary>");
            sb_body.AppendLine("        /// <returns></returns>");
            sb_body.AppendLine("        public static Guid Generate" + tableName + "Id()");
            sb_body.AppendLine("        {");
            sb_body.AppendLine("            return Guid.NewGuid();");
            sb_body.AppendLine("        }");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 创建");
            sb_body.AppendLine("");
            sb_body.AppendLine("        /// <summary>");
            sb_body.AppendLine("        /// 创建一个对象");
            sb_body.AppendLine("        /// </summary>");
            sb_body.AppendLine("        /// <param name=\"SysNo\">编号</param>");
            sb_body.AppendLine("        /// <returns></returns>");
            sb_body.AppendLine("        public static " + tableName + " Create" + tableName + "(Guid? SysNo = null)");
            sb_body.AppendLine("        {");
            sb_body.AppendLine("            SysNo = SysNo == Guid.Empty ? Generate" + tableName + "Id() : SysNo;");
            sb_body.AppendLine("            return new " + tableName + "(SysNo);");
            sb_body.AppendLine("        }");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 根据给定的对象更新当前信息");
            sb_body.AppendLine("");
            sb_body.AppendLine("        /// <summary>");
            sb_body.AppendLine("        /// 根据给定的对象更新当前信息");
            sb_body.AppendLine("        /// </summary>");
            sb_body.AppendLine("        /// <param name=\"" + tableName + "\">信息</param>");
            sb_body.AppendLine("        /// <param name=\"excludePropertys\">排除更新的属性</param>");
            sb_body.AppendLine("        public virtual void ModifyFromOther" + tableName + "(" + tableName + " " + tableName + ", IEnumerable<string> excludePropertys = null)");
            sb_body.AppendLine("        {");
            sb_body.AppendLine("            if (" + tableName + " == null)");
            sb_body.AppendLine("            {");
            sb_body.AppendLine("                return;");
            sb_body.AppendLine("            }");
            sb_body.AppendLine("");
            sb_body.AppendLine("            CopyDataFromSimilarObject(" + tableName + ", excludePropertys);");
            sb_body.AppendLine("        }");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        #region 从指定对象复制值");
            sb_body.AppendLine("");
            sb_body.AppendLine("        /// <summary>");
            sb_body.AppendLine("        /// 从指定对象复制值");
            sb_body.AppendLine("        /// </summary>");
            sb_body.AppendLine("        /// <typeparam name=\"DT\">数据类型</typeparam>");
            sb_body.AppendLine("        /// <param name=\"similarObject\">数据对象</param>");
            sb_body.AppendLine("        /// <param name=\"excludePropertys\">排除不复制的属性</param>");
            sb_body.AppendLine("        protected override void CopyDataFromSimilarObject<DT>(DT similarObject, IEnumerable<string> excludePropertys = null)");
            sb_body.AppendLine("        {");
            sb_body.AppendLine("            base.CopyDataFromSimilarObject<DT>(similarObject, excludePropertys);");
            sb_body.AppendLine("            if (similarObject == null)");
            sb_body.AppendLine("            {");
            sb_body.AppendLine("                return;");
            sb_body.AppendLine("            }");
            sb_body.AppendLine("            excludePropertys = excludePropertys ?? new List<string>(0);");
            sb_body.AppendLine("");
            sb_body.AppendLine("            #region 复制值");
            sb_body.AppendLine("");

            sb_body.AppendLine(sb3.ToString());

            sb_body.AppendLine("");
            sb_body.AppendLine("            #endregion");
            sb_body.AppendLine("        }");
            sb_body.AppendLine("        #endregion");
            sb_body.AppendLine("");
            sb_body.AppendLine("        /// <summary>");
            sb_body.AppendLine("        /// 设置默认值");
            sb_body.AppendLine("        /// </summary>");
            sb_body.AppendLine("        public void SetDefaultValue()");
            sb_body.AppendLine("        {");
            sb_body.AppendLine("            CreateDate = DateTime.Now;");
            sb_body.AppendLine("            IsDelete = false;");
            sb_body.AppendLine("        }");
            sb_body.AppendLine("    }");
            sb_body.AppendLine("}");
            sb_body.AppendLine("");



            string file_Model = "C:\\Code\\" + str_nameSpace + ".Domain\\" + tablePrefix + "\\Model";
            if (!Directory.Exists(file_Model))
            {
                Directory.CreateDirectory(file_Model);
            }
            CommonCode.Save(file_Model + "/" + tableName + "" + ".cs", sb_body.ToString());
        }
Ejemplo n.º 6
0
        public void Create(string file_BLL, string str_nameSpace, string str_table, string str_BLLName, string str_IDALName, string str_ModelName)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("using System;");
            sb.AppendLine("using System.Data;");
            sb.AppendLine("using System.Collections.Generic;");
            sb.AppendLine("using " + str_nameSpace + ".Model;");
            sb.AppendLine("using " + str_nameSpace + ".IDAL;");
            sb.AppendLine("using " + str_nameSpace + ".DALFactory;");
            sb.AppendLine("");
            sb.AppendLine("namespace " + str_nameSpace + ".BLL");
            sb.AppendLine("{");
            sb.AppendLine("    /// <summary>");
            sb.AppendLine("    /// " + str_BLLName);
            sb.AppendLine("    /// </summary>");
            sb.AppendLine("    public partial class " + str_BLLName);
            sb.AppendLine("    {");
            sb.AppendLine("        private readonly " + str_IDALName + " dal = DataAccess.Create" + str_table.ToUpper() + "();");
            sb.AppendLine("        public " + str_BLLName + "() { }");
            sb.AppendLine("");

            #region BasicMethod
            sb.AppendLine("        #region  BasicMethod");
            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// 是否存在该记录");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public bool Exists(string ST_CODE)");
            sb.AppendLine("        {");
            sb.AppendLine("            return dal.Exists(ST_CODE);");
            sb.AppendLine("        }");
            sb.AppendLine("");

            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// 增加一条数据");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public bool Add(" + str_ModelName + " model)");
            sb.AppendLine("        {");
            sb.AppendLine("            return dal.Add(model);");
            sb.AppendLine("        }");
            sb.AppendLine("");

            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// 增加多条数据");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public int AddList(List<" + str_ModelName + "> list_model)");
            sb.AppendLine("        {");
            sb.AppendLine("            return dal.AddList(list_model);");
            sb.AppendLine("        }");
            sb.AppendLine("");

            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// 更新一条数据");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public bool Update(" + str_ModelName + " model)");
            sb.AppendLine("        {");
            sb.AppendLine("            return dal.Update(model);");
            sb.AppendLine("        }");
            sb.AppendLine("");

            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// 更新多条数据");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public int UpdateList(List<" + str_ModelName + "> list_model)");
            sb.AppendLine("        {");
            sb.AppendLine("            return dal.UpdateList(list_model);");
            sb.AppendLine("        }");
            sb.AppendLine("");

            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// 删除一条数据");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public bool Delete(string ST_CODE)");
            sb.AppendLine("        {");
            sb.AppendLine("            return dal.Delete(ST_CODE);");
            sb.AppendLine("        }");

            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// 删除多条数据");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public bool DeleteList(List<string> ST_CODElist)");
            sb.AppendLine("        {");
            sb.AppendLine("            return dal.DeleteList(ST_CODElist);");
            sb.AppendLine("        }");
            sb.AppendLine("");

            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// 得到实体对象");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public " + str_ModelName + " GetModel(string ST_CODE)");
            sb.AppendLine("        {");
            sb.AppendLine("            return dal.GetModel(ST_CODE);");
            sb.AppendLine("        }");
            sb.AppendLine("");

            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// 获得实体列表");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public List<" + str_ModelName + "> GetModelList(string strWhere)");
            sb.AppendLine("        {");
            sb.AppendLine("            return dal.GetModelList(strWhere);");
            sb.AppendLine("        }");
            sb.AppendLine("");

            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// 获得数据列表");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public DataTable GetList(string strWhere)");
            sb.AppendLine("        {");
            sb.AppendLine("            return dal.GetList(strWhere);");
            sb.AppendLine("        }");
            sb.AppendLine("");

            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// 获得数据列表");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public DataTable GetAllList()");
            sb.AppendLine("        {");
            sb.AppendLine("            return GetList(\"\");");
            sb.AppendLine("        }");
            sb.AppendLine("");

            sb.AppendLine("        /// <summary>");
            sb.AppendLine("        /// 获取记录总数");
            sb.AppendLine("        /// </summary>");
            sb.AppendLine("        public int GetRecordCount(string strWhere)");
            sb.AppendLine("        {");
            sb.AppendLine("            return dal.GetRecordCount(strWhere);");
            sb.AppendLine("        }");
            sb.AppendLine("");

            sb.AppendLine("        ///// <summary>");
            sb.AppendLine("        ///// 分页获取数据列表");
            sb.AppendLine("        ///// </summary>");
            sb.AppendLine("        //public int GetRecordCount(string strWhere)");
            sb.AppendLine("        //{");
            sb.AppendLine("        //    return dal.GetRecordCount(strWhere);");
            sb.AppendLine("        //}");
            sb.AppendLine("");

            sb.AppendLine("        ///// <summary>");
            sb.AppendLine("        ///// 分页获取数据列表");
            sb.AppendLine("        ///// </summary>");
            sb.AppendLine("        //public DataTable GetList(int PageSize,int PageIndex,string strWhere)");
            sb.AppendLine("        //{");
            sb.AppendLine("        //return dal.GetList(PageSize,PageIndex,strWhere);");
            sb.AppendLine("        //}");
            sb.AppendLine("");
            sb.AppendLine("        #endregion  BasicMethod");
            #endregion

            sb.AppendLine("");
            sb.AppendLine("");
            sb.AppendLine("    }");
            sb.AppendLine("}");
            CommonCode.Save(file_BLL + "/" + str_BLLName + ".cs", sb.ToString());
        }