/// <summary>
 /// 得到一个对象实体
 /// </summary>
 public SchSystem.Model.SchMenuInfoRouter DataRowToModel(DataRow row)
 {
     SchSystem.Model.SchMenuInfoRouter model = new SchSystem.Model.SchMenuInfoRouter();
     if (row != null)
     {
         if (row["MenuId"] != null && row["MenuId"].ToString() != "")
         {
             model.MenuId = int.Parse(row["MenuId"].ToString());
         }
         if (row["NavUrl"] != null)
         {
             model.NavUrl = row["NavUrl"].ToString();
         }
         if (row["TextName"] != null)
         {
             model.TextName = row["TextName"].ToString();
         }
         if (row["FuncCode"] != null && row["FuncCode"].ToString() != "")
         {
             model.FuncCode = int.Parse(row["FuncCode"].ToString());
         }
         if (row["SchId"] != null && row["SchId"].ToString() != "")
         {
             model.SchId = int.Parse(row["SchId"].ToString());
         }
         if (row["SysType"] != null && row["SysType"].ToString() != "")
         {
             model.SysType = int.Parse(row["SysType"].ToString());
         }
     }
     return(model);
 }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(SchSystem.Model.SchMenuInfoRouter model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SchMenuInfoRouter(");
            strSql.Append("NavUrl,TextName,FuncCode,SchId,SysType)");
            strSql.Append(" values (");
            strSql.Append("@NavUrl,@TextName,@FuncCode,@SchId,@SysType)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@NavUrl",   SqlDbType.VarChar, 200),
                new SqlParameter("@TextName", SqlDbType.VarChar,  30),
                new SqlParameter("@FuncCode", SqlDbType.Int,       4),
                new SqlParameter("@SchId",    SqlDbType.Int,       4),
                new SqlParameter("@SysType",  SqlDbType.TinyInt, 1)
            };
            parameters[0].Value = model.NavUrl;
            parameters[1].Value = model.TextName;
            parameters[2].Value = model.FuncCode;
            parameters[3].Value = model.SchId;
            parameters[4].Value = model.SysType;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SchSystem.Model.SchMenuInfoRouter model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SchMenuInfoRouter set ");
            strSql.Append("NavUrl=@NavUrl,");
            strSql.Append("TextName=@TextName,");
            strSql.Append("FuncCode=@FuncCode,");
            strSql.Append("SchId=@SchId,");
            strSql.Append("SysType=@SysType");
            strSql.Append(" where MenuId=@MenuId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@NavUrl",   SqlDbType.VarChar, 200),
                new SqlParameter("@TextName", SqlDbType.VarChar,  30),
                new SqlParameter("@FuncCode", SqlDbType.Int,       4),
                new SqlParameter("@SchId",    SqlDbType.Int,       4),
                new SqlParameter("@SysType",  SqlDbType.TinyInt,   1),
                new SqlParameter("@MenuId",   SqlDbType.Int, 4)
            };
            parameters[0].Value = model.NavUrl;
            parameters[1].Value = model.TextName;
            parameters[2].Value = model.FuncCode;
            parameters[3].Value = model.SchId;
            parameters[4].Value = model.SysType;
            parameters[5].Value = model.MenuId;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public SchSystem.Model.SchMenuInfoRouter GetModel(int MenuId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 MenuId,NavUrl,TextName,FuncCode,SchId,SysType from SchMenuInfoRouter ");
            strSql.Append(" where MenuId=@MenuId");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MenuId", SqlDbType.Int, 4)
            };
            parameters[0].Value = MenuId;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }