/// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(XCWeiXin.Model.wx_module_templates model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into wx_module_templates(");
            strSql.Append("tName,author,moduleName,moduleCode,createDate,version,forWxVersion,typeName,typeId,aboutPic,tFileName,degreeName,degreId,remark)");
            strSql.Append(" values (");
            strSql.Append("@tName,@author,@moduleName,@moduleCode,@createDate,@version,@forWxVersion,@typeName,@typeId,@aboutPic,@tFileName,@degreeName,@degreId,@remark)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@tName",        SqlDbType.VarChar,   100),
                new SqlParameter("@author",       SqlDbType.VarChar,    50),
                new SqlParameter("@moduleName",   SqlDbType.VarChar,   100),
                new SqlParameter("@moduleCode",   SqlDbType.VarChar,    20),
                new SqlParameter("@createDate",   SqlDbType.DateTime),
                new SqlParameter("@version",      SqlDbType.VarChar,    50),
                new SqlParameter("@forWxVersion", SqlDbType.VarChar,    50),
                new SqlParameter("@typeName",     SqlDbType.VarChar,   100),
                new SqlParameter("@typeId",       SqlDbType.Int,         4),
                new SqlParameter("@aboutPic",     SqlDbType.VarChar,   800),
                new SqlParameter("@tFileName",    SqlDbType.VarChar,    50),
                new SqlParameter("@degreeName",   SqlDbType.VarChar,   100),
                new SqlParameter("@degreId",      SqlDbType.Int,         4),
                new SqlParameter("@remark",       SqlDbType.VarChar, 1000)
            };
            parameters[0].Value  = model.tName;
            parameters[1].Value  = model.author;
            parameters[2].Value  = model.moduleName;
            parameters[3].Value  = model.moduleCode;
            parameters[4].Value  = model.createDate;
            parameters[5].Value  = model.version;
            parameters[6].Value  = model.forWxVersion;
            parameters[7].Value  = model.typeName;
            parameters[8].Value  = model.typeId;
            parameters[9].Value  = model.aboutPic;
            parameters[10].Value = model.tFileName;
            parameters[11].Value = model.degreeName;
            parameters[12].Value = model.degreId;
            parameters[13].Value = model.remark;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public XCWeiXin.Model.wx_module_templates GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,tName,author,moduleName,moduleCode,createDate,version,forWxVersion,typeName,typeId,aboutPic,tFileName,degreeName,degreId,remark from wx_module_templates ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            XCWeiXin.Model.wx_module_templates model = new XCWeiXin.Model.wx_module_templates();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public XCWeiXin.Model.wx_module_templates DataRowToModel(DataRow row)
 {
     XCWeiXin.Model.wx_module_templates model = new XCWeiXin.Model.wx_module_templates();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["tName"] != null)
         {
             model.tName = row["tName"].ToString();
         }
         if (row["author"] != null)
         {
             model.author = row["author"].ToString();
         }
         if (row["moduleName"] != null)
         {
             model.moduleName = row["moduleName"].ToString();
         }
         if (row["moduleCode"] != null)
         {
             model.moduleCode = row["moduleCode"].ToString();
         }
         if (row["createDate"] != null && row["createDate"].ToString() != "")
         {
             model.createDate = DateTime.Parse(row["createDate"].ToString());
         }
         if (row["version"] != null)
         {
             model.version = row["version"].ToString();
         }
         if (row["forWxVersion"] != null)
         {
             model.forWxVersion = row["forWxVersion"].ToString();
         }
         if (row["typeName"] != null)
         {
             model.typeName = row["typeName"].ToString();
         }
         if (row["typeId"] != null && row["typeId"].ToString() != "")
         {
             model.typeId = int.Parse(row["typeId"].ToString());
         }
         if (row["aboutPic"] != null)
         {
             model.aboutPic = row["aboutPic"].ToString();
         }
         if (row["tFileName"] != null)
         {
             model.tFileName = row["tFileName"].ToString();
         }
         if (row["degreeName"] != null)
         {
             model.degreeName = row["degreeName"].ToString();
         }
         if (row["degreId"] != null && row["degreId"].ToString() != "")
         {
             model.degreId = int.Parse(row["degreId"].ToString());
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
     }
     return(model);
 }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(XCWeiXin.Model.wx_module_templates model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update wx_module_templates set ");
            strSql.Append("tName=@tName,");
            strSql.Append("author=@author,");
            strSql.Append("moduleName=@moduleName,");
            strSql.Append("moduleCode=@moduleCode,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("version=@version,");
            strSql.Append("forWxVersion=@forWxVersion,");
            strSql.Append("typeName=@typeName,");
            strSql.Append("typeId=@typeId,");
            strSql.Append("aboutPic=@aboutPic,");
            strSql.Append("tFileName=@tFileName,");
            strSql.Append("degreeName=@degreeName,");
            strSql.Append("degreId=@degreId,");
            strSql.Append("remark=@remark");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@tName",        SqlDbType.VarChar,    100),
                new SqlParameter("@author",       SqlDbType.VarChar,     50),
                new SqlParameter("@moduleName",   SqlDbType.VarChar,    100),
                new SqlParameter("@moduleCode",   SqlDbType.VarChar,     20),
                new SqlParameter("@createDate",   SqlDbType.DateTime),
                new SqlParameter("@version",      SqlDbType.VarChar,     50),
                new SqlParameter("@forWxVersion", SqlDbType.VarChar,     50),
                new SqlParameter("@typeName",     SqlDbType.VarChar,    100),
                new SqlParameter("@typeId",       SqlDbType.Int,          4),
                new SqlParameter("@aboutPic",     SqlDbType.VarChar,    800),
                new SqlParameter("@tFileName",    SqlDbType.VarChar,     50),
                new SqlParameter("@degreeName",   SqlDbType.VarChar,    100),
                new SqlParameter("@degreId",      SqlDbType.Int,          4),
                new SqlParameter("@remark",       SqlDbType.VarChar,   1000),
                new SqlParameter("@id",           SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.tName;
            parameters[1].Value  = model.author;
            parameters[2].Value  = model.moduleName;
            parameters[3].Value  = model.moduleCode;
            parameters[4].Value  = model.createDate;
            parameters[5].Value  = model.version;
            parameters[6].Value  = model.forWxVersion;
            parameters[7].Value  = model.typeName;
            parameters[8].Value  = model.typeId;
            parameters[9].Value  = model.aboutPic;
            parameters[10].Value = model.tFileName;
            parameters[11].Value = model.degreeName;
            parameters[12].Value = model.degreId;
            parameters[13].Value = model.remark;
            parameters[14].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }