Example #1
0
        public string CreatBLLGetVaule()
        {
            StringPlus strclass = new StringPlus();

            strclass.AppendLine("");
            strclass.AppendSpaceLine(2, "/// <summary>");
            strclass.AppendSpaceLine(2, "/// 返回单个字符串");
            strclass.AppendSpaceLine(2, "/// </summary>");
            strclass.AppendSpaceLine(2, "public static string GetValue(string col,string where)");
            strclass.AppendSpaceLine(2, "{");
            strclass.AppendSpaceLine(3, "return " + DALName + ".Instance.GetValue(col,where);");
            strclass.AppendSpaceLine(2, "}");
            return(strclass.Value);
        }
Example #2
0
        public string CreatBLLGetCounts()
        {
            StringPlus strclass = new StringPlus();

            strclass.AppendLine("");
            strclass.AppendSpaceLine(2, "/// <summary>");
            strclass.AppendSpaceLine(2, "/// 返回记录条数");
            strclass.AppendSpaceLine(2, "/// </summary>");
            strclass.AppendSpaceLine(2, "public static int Counts(string where)");
            strclass.AppendSpaceLine(2, "{");
            strclass.AppendSpaceLine(3, "return " + DALName + ".Instance.Counts(where);");
            strclass.AppendSpaceLine(2, "}");
            strclass.AppendSpaceLine(2, "public static int Counts(SQLPara para)");
            strclass.AppendSpaceLine(2, "{");
            strclass.AppendSpaceLine(3, "return " + DALName + ".Instance.Counts(para);");
            strclass.AppendSpaceLine(2, "}");
            return(strclass.Value);
        }
Example #3
0
        public string CreatBLLGetMaxID()
        {
            StringPlus strclass = new StringPlus();

            if (_keys.Count > 0)
            {
                string keyname = "";
                foreach (ColumnInfo obj in _keys)
                {
                    if (CodeCommon.DbTypeToCS(obj.TypeName) == "int")
                    {
                        keyname = obj.ColumnName;
                        if (obj.IsPK)
                        {
                            strclass.AppendLine("");
                            strclass.AppendSpaceLine(2, "/// <summary>");
                            strclass.AppendSpaceLine(2, "/// 得到最大ID");
                            strclass.AppendSpaceLine(2, "/// </summary>");
                            strclass.AppendSpaceLine(2, "public static int GetMaxId()");
                            strclass.AppendSpaceLine(2, "{");
                            strclass.AppendSpaceLine(3, "return " + DALName + ".Instance.GetMaxID(\"\");");
                            strclass.AppendSpaceLine(2, "}");
                            strclass.AppendSpaceLine(2, "public static int GetMaxId(SQLPara para)");
                            strclass.AppendSpaceLine(2, "{");
                            strclass.AppendSpaceLine(3, "return " + DALName + ".Instance.GetMaxID(para);");
                            strclass.AppendSpaceLine(2, "}");
                            strclass.AppendSpaceLine(2, "public static int GetMaxId(string strWhere)");
                            strclass.AppendSpaceLine(2, "{");
                            strclass.AppendSpaceLine(3, "return " + DALName + ".Instance.GetMaxID(strWhere);");
                            strclass.AppendSpaceLine(2, "}");
                            break;
                        }
                    }
                }
            }


            return(strclass.Value);
        }
Example #4
0
        /// <summary>
        /// 生成完整sModel类
        /// </summary>
        public string CreatModelStr(List <ColumnInfo> fieldlist)
        {
            StringPlus strclass = new StringPlus();

            strclass.AppendLine("using System;");
            strclass.AppendLine("namespace " + _namespace);
            strclass.AppendLine("{");
            strclass.AppendSpaceLine(1, "/// <summary>");
            strclass.AppendSpaceLine(1, "/// 实体类" + _modelname + " 。(属性说明自动提取数据库字段的描述信息)");
            strclass.AppendSpaceLine(1, "/// </summary>");
            strclass.AppendSpaceLine(1, "[Serializable]");
            strclass.AppendSpaceLine(1, "public class " + _modelname);
            strclass.AppendSpaceLine(1, "{");
            strclass.AppendSpaceLine(2, "public " + _modelname + "()");
            strclass.AppendSpaceLine(2, "{}");
            strclass.AppendLine(CreatModelMethod(fieldlist));
            strclass.AppendSpaceLine(1, "}");
            strclass.AppendLine("}");
            strclass.AppendLine("");
            return(strclass.Value);
        }
Example #5
0
        /// <summary>
        /// 得到整个类的代码
        /// </summary>
        public string GetBLLCodeStr()
        {
            StringPlus strclass = new StringPlus();

            strclass.AppendLine("using System;");
            strclass.AppendLine("using System.Data;");
            strclass.AppendLine("using System.Collections.Generic;");
            strclass.AppendLine("using System.Text.RegularExpressions;");
            strclass.AppendLine("using " + ModelSpace + ";");
            strclass.AppendLine("using " + DALSpace + ";");

            strclass.AppendLine("namespace " + BLLSpace + "");
            strclass.AppendLine("{");
            strclass.AppendSpaceLine(1, "/// <summary>");
            strclass.AppendSpaceLine(1, "/// 业务逻辑类" + BLLName + " 的摘要说明。");
            strclass.AppendSpaceLine(1, "/// </summary>");
            strclass.AppendSpaceLine(1, "public class " + BLLName);
            strclass.AppendSpaceLine(1, "{");

            strclass.AppendSpaceLine(2, "public " + BLLName + "()");
            strclass.AppendSpaceLine(2, "{}");


            strclass.AppendSpaceLine(2, "#region  成员方法");

            #region  方法代码

            strclass.AppendLine(CreatBLLGetVaule());
            strclass.AppendLine(CreatBLLGetCounts());
            strclass.AppendLine(CreatBLLADD());
            strclass.AppendLine(CreatBLLUpdate());
            strclass.AppendLine(CreatBLLDelete());
            strclass.AppendLine(CreatBLLGetModel());
            strclass.AppendLine(CreatBLLGetMaxID());
            strclass.AppendLine(CreatBLLGetList());
            strclass.AppendLine(CreatBLLBindForm());


            #endregion
            strclass.AppendSpaceLine(2, "#endregion  成员方法");
            strclass.AppendSpaceLine(1, "}");
            strclass.AppendLine("}");
            strclass.AppendLine("");

            return(strclass.Value);
        }