Exemplo n.º 1
0
        /// <summary>
        /// 由一行数据得到一个实体
        /// </summary>
        /// <param name="dr">SqlDataReader对象</param>
        /// <returns>实体对象</returns>
        private Sys_Dict GetModel(SqlDataReader dr)
        {
            Sys_Dict model = new Sys_Dict();

            model.ID    = dbHelper.GetInt(dr["ID"]);
            model.Type  = dbHelper.GetString(dr["Type"]);
            model.Title = dbHelper.GetString(dr["Title"]);
            model.Url   = dbHelper.GetString(dr["Url"]);
            model.Email = dbHelper.GetString(dr["Email"]);
            model.Click = dbHelper.GetInt(dr["Click"]);
            return(model);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        /// <param name="ID">编号ID</param>
        /// <returns>返回影响行数</returns>
        public int Add(Sys_Dict model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("INSERT INTO " + tablePrefix + "Sys_Dict(");
            strSql.Append("Type,Title,Url,Email,Click)");
            strSql.Append(" VALUES (");
            strSql.Append("@Type,@Title,@Url,@Email,@Click)");
            SqlParameter[] cmdParms =
            {
                AddInParameter("@Type",  SqlDbType.VarChar,   50, model.Type),
                AddInParameter("@Title", SqlDbType.NVarChar,  50, model.Title),
                AddInParameter("@Url",   SqlDbType.VarChar,  255, model.Url),
                AddInParameter("@Email", SqlDbType.VarChar,   50, model.Email),
                AddInParameter("@Click", SqlDbType.Int,        4, model.Click)
            };

            return(dbHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="model">实体对象</param>
        /// <returns>返回影响行数</returns>
        public int Update(Sys_Dict model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("UPDATE " + tablePrefix + "Sys_Dict SET ");
            strSql.Append("Type=@Type,");
            strSql.Append("Title=@Title,");
            strSql.Append("Url=@Url,");
            strSql.Append("Email=@Email,");
            strSql.Append("Click=@Click");
            strSql.Append(" WHERE ID=@ID");
            SqlParameter[] cmdParms =
            {
                AddInParameter("@Type",  SqlDbType.VarChar,   50, model.Type),
                AddInParameter("@Title", SqlDbType.NVarChar,  50, model.Title),
                AddInParameter("@Url",   SqlDbType.VarChar,  255, model.Url),
                AddInParameter("@Email", SqlDbType.VarChar,   50, model.Email),
                AddInParameter("@Click", SqlDbType.Int,        4, model.Click),
                AddInParameter("@ID",    SqlDbType.Int,        4, model.ID)
            };

            return(dbHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms));
        }
Exemplo n.º 4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">实体对象</param>
 /// <returns>返回影响行数</returns>
 public int Update(Sys_Dict model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="model">实体对象</param>
 /// <returns>返回影响行数</returns>
 public int Add(Sys_Dict model)
 {
     return(dal.Add(model));
 }