Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(TF.RunSafty.Entry.nav model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Tab_Nav set ");
            strSql.Append("typeName=@typeName,");
            strSql.Append("NavUrl=@NavUrl,");
            strSql.Append("StrSort=@StrSort,");
            strSql.Append("TrNavUrl=@TrNavUrl");
            strSql.Append(" where TypeID=@TypeID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@typeName", SqlDbType.NVarChar,  50),
                new SqlParameter("@NavUrl",   SqlDbType.NVarChar, 100),
                new SqlParameter("@TypeID",   SqlDbType.VarChar,   50),
                new SqlParameter("@StrSort",  SqlDbType.Int,        4),
                new SqlParameter("@TrNavUrl", SqlDbType.NVarChar, 100)
            };
            parameters[0].Value = model.typeName;
            parameters[1].Value = model.NavUrl;
            parameters[2].Value = model.TypeID;
            parameters[3].Value = model.StrSort;
            parameters[4].Value = model.TrNavUrl;
            int rows = SqlHelps.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public TF.RunSafty.Entry.nav DataRowToModel(DataRow row)
 {
     TF.RunSafty.Entry.nav model = new TF.RunSafty.Entry.nav();
     if (row != null)
     {
         if (row["TypeID"] != null)
         {
             model.TypeID = row["TypeID"].ToString();
         }
         if (row["TypeParentID"] != null)
         {
             model.TypeParentID = row["TypeParentID"].ToString();
         }
         if (row["typeName"] != null)
         {
             model.typeName = row["typeName"].ToString();
         }
     }
     return(model);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TF.RunSafty.Entry.nav GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 TypeID,TypeParentID,typeName from Tab_Nav ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

            TF.RunSafty.Entry.nav model = new TF.RunSafty.Entry.nav();
            DataSet ds = SqlHelps.ReturnDataSet(ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(TF.RunSafty.Entry.nav model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Tab_Nav(");
            strSql.Append("TypeID,TypeParentID,typeName,NavUrl,StrSort,TrNavUrl)");
            strSql.Append(" values (");
            strSql.Append("@TypeID,@TypeParentID,@typeName,@NavUrl,@StrSort,@TrNavUrl)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TypeID",       SqlDbType.VarChar,   50),
                new SqlParameter("@TypeParentID", SqlDbType.VarChar,   50),
                new SqlParameter("@typeName",     SqlDbType.NVarChar,  50),
                new SqlParameter("@NavUrl",       SqlDbType.NVarChar, 100),
                new SqlParameter("@StrSort",      SqlDbType.Int,        4),
                new SqlParameter("@TrNavUrl",     SqlDbType.NVarChar, 100)
            };
            parameters[0].Value = model.TypeID;
            parameters[1].Value = model.TypeParentID;
            parameters[2].Value = model.typeName;
            parameters[3].Value = model.NavUrl;
            parameters[4].Value = model.StrSort;
            parameters[5].Value = model.TrNavUrl;


            int rows = SqlHelps.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(TF.RunSafty.Entry.nav model)
 {
     return(DBNav.Update(model));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(TF.RunSafty.Entry.nav model)
 {
     return(DBNav.Add(model));
 }