Esempio n. 1
0
        /// <summary>
        /// 实体信息
        /// </summary>
        private MAtlasWeb GetModel(DataRow row)
        {
            MAtlasWeb model = new MAtlasWeb();

            model.ID        = Convert.ToInt32(row["ID"]);
            model.WID       = Convert.ToInt32(row["WID"]);
            model.ArticleID = Convert.ToInt64(row["ArticleID"]);

            model.WName = Convert.ToString(row["WName"]);
            model.Title = Convert.ToString(row["Title"]);
            return(model);
        }
Esempio n. 2
0
        private SqlCommand GetCommand(MAtlasWeb model)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(new SqlParameter(ID, SqlDbType.Int));
            cmd.Parameters.Add(new SqlParameter(WID, SqlDbType.Int));
            cmd.Parameters.Add(new SqlParameter(ArticleID, SqlDbType.BigInt));

            cmd.Parameters[ID].Value        = model.ID;
            cmd.Parameters[WID].Value       = model.WID;
            cmd.Parameters[ArticleID].Value = model.ArticleID;
            return(cmd);
        }
Esempio n. 3
0
        /// <summary>
        /// 修改
        /// </summary>
        public int Update(MAtlasWeb model, string ConnStr)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append(" INSERT Web_AtlasWeb");
            sql.Append(" SET");
            sql.Append("	WID = @WID, ");
            sql.Append("	ArticleID = @ArticleID ");
            sql.Append("WHERE ID = @ID  ");
            SqlCommand cmd = GetCommand(model);

            DbHelperSQL.RunSqlText(sql.ToString(), cmd, 3600, ConnStr);

            return(Convert.ToInt32(cmd.Parameters[ID].Value));
        }
Esempio n. 4
0
        /// <summary>
        /// 增加
        /// </summary>
        public int Insert(MAtlasWeb model, string ConnStr)
        {
            StringBuilder sql = new StringBuilder();

            sql.Append(" INSERT Web_AtlasWeb (");
            sql.Append(" WID,ArticleID )");
            sql.Append(" SELECT");
            sql.Append(" @WID,@ArticleID");
            sql.Append("  SELECT @ID=@@IDENTITY");
            SqlCommand cmd = GetCommand(model);

            DbHelperSQL.RunSqlText(sql.ToString(), cmd, 3600, ConnStr);

            return(Convert.ToInt32(cmd.Parameters[ID].Value));
        }
Esempio n. 5
0
 /// <summary>
 /// 根据 主键编号 更新
 /// </summary>
 public int Update(MAtlasWeb model)
 {
     return(dal.Update(model, ConnStr));
 }
Esempio n. 6
0
 /// <summary>
 /// 增加
 /// </summary>
 public long Insert(MAtlasWeb model)
 {
     return(dal.Insert(model, ConnStr));
 }