示例#1
0
        protected static TopicImageInfo Map(DataRow row)
        {
            TopicImageInfo info = new TopicImageInfo();

            info.SysNo           = Convert.ToInt32(row["SysNo"]);
            info.TopicSysNo      = Convert.ToInt32(row["TopicSysNo"]);
            info.ImageLink       = row["ImageLink"].ToString();
            info.ThumbnailLink   = row["ThumbnailLink"].ToString();
            info.HitCount        = Convert.ToInt32(row["HitCount"]);
            info.Status          = (AppEnum.TopicImageStatus)Convert.ToInt32(row["Status"]);
            info.CreateUserSysNo = Convert.ToInt32(row["CreateUserSysNo"]);
            info.CreateDate      = Convert.ToDateTime(row["CreateDate"]);
            return(info);
        }
示例#2
0
        public static TopicImageInfo GetTopicImageBySysNo(int SysNo)
        {
            string         sql = @"SELECT * FROM Topic_Image (NOLOCK) WHERE sysno = " + SysNo;
            DataSet        ds  = SqlHelper.ExecuteDataSet(sql);
            TopicImageInfo i   = new TopicImageInfo();

            if (Util.HasMoreRow(ds) == false)
            {
                return(i);
            }
            if (ds.Tables[0].Rows.Count > 1)
            {
                throw new Exception("错误:同一ID对应一条以上的数据");
            }
            i = Map(ds.Tables[0].Rows[0]);
            return(i);
        }
示例#3
0
        public static int InsertTopicImage(TopicImageInfo info)
        {
            SqlParameter[] parms = new SqlParameter[]
            {
                new SqlParameter("@TopicSysNo", SqlDbType.Int),
                new SqlParameter("@ImageLink", SqlDbType.NVarChar),
                new SqlParameter("@ThumbnailLink", SqlDbType.NVarChar),
                new SqlParameter("@CreateUserSysNo", SqlDbType.Int),
            };

            parms[0].Value = info.TopicSysNo;
            parms[1].Value = info.ImageLink;
            parms[2].Value = info.ThumbnailLink;
            parms[3].Value = info.CreateUserSysNo;

            SqlCommand cmd = new SqlCommand(SQL_INSERT_TOPICIMAGE);

            cmd.Parameters.AddRange(parms);
            cmd.CommandTimeout = 180;
            object obj = SqlHelper.ExecuteScalar(cmd);

            return(Convert.ToInt32(obj));
        }