示例#1
0
 public static List<TopicImageInfo> GetAllTopicImageBySearch(TopicImageSearchCondition rsc)
 {
     return GetTopicImageByTopicId(0, rsc);
 }
示例#2
0
 public static List<TopicImageInfo> GetValidTopicImageByTopicId(int topicSysNo)
 {
     TopicImageSearchCondition sc = new TopicImageSearchCondition();
     sc.Status = (int)AppEnum.TopicImageStatus.Normal;
     return GetTopicImageByTopicId(topicSysNo, sc);
 }
示例#3
0
        private static List<TopicImageInfo> GetTopicImageByTopicId(int topicSysNo, TopicImageSearchCondition rsc)
        {
            string sqlStr = SQL_GET_IMAGE_BY_TOPICID;
            DataTable dt = new DataTable();

            if (topicSysNo != 0)
            {
                sqlStr = sqlStr.Replace("@select", "select ");
                sqlStr = sqlStr.Replace("@sqlPar", " Topic_Image.TopicSysNo = @TopicSysNo @STATUS ORDER BY Topic_Image.CreateDate desc");
                if (rsc != null && rsc.Status != null)
                    sqlStr = sqlStr.Replace("@STATUS", "AND Topic_Image.Status = " + rsc.Status);
                else
                    sqlStr = sqlStr.Replace("@STATUS", "");

                SqlParameter[] parms = new SqlParameter[]
                {
                    new SqlParameter("@TopicSysNo", SqlDbType.Int)
                };
                parms[0].Value = topicSysNo;
                dt = SqlHelper.ExecuteDataSet(sqlStr, parms).Tables[0];
            }
            else
            {
                StringBuilder sb = new StringBuilder(" CreateUserType = 0 ");
                if (rsc.DateFrom != null)
                    sb.Append(" and Topic_Image.CreateDate >= '" + rsc.DateFrom + "' ");

                if (rsc.DateTo != null)
                    sb.Append(" and Topic_Image.CreateDate <= '" + rsc.DateTo.Value.AddDays(1).AddSeconds(-1) + "' ");

                if (rsc.Status != null)
                    sb.Append(" and Topic_Image.Status = " + rsc.Status + "");

                if (rsc.CustomerId != string.Empty)
                    sb.Append(" and CreateUserSysNo IN (SELECT SysNo FROM Customer (NOLOCK) WHERE CustomerId LIKE '%" + rsc.CustomerId + "%') ");
                sb.Append(" ORDER BY Topic_Image.CreateDate DESC");

                if (rsc.InEmpty == true)
                    sqlStr = sqlStr.Replace("@select", "select top 50 ");
                else
                    sqlStr = sqlStr.Replace("@select", "select ");

                sqlStr = sqlStr.Replace("@sqlPar", sb.ToString());
                dt = SqlHelper.ExecuteDataSet(sqlStr).Tables[0];
            }

            if (dt == null || dt.Rows.Count == 0)
                return null;
            List<TopicImageInfo> list = new List<TopicImageInfo>();
            foreach (DataRow row in dt.Rows)
                list.Add(Map(row));
            return list;
        }
示例#4
0
 public static List<TopicImageInfo> GetTopicImagesByTopicId(int topicSysNo)
 {
     TopicImageSearchCondition sc = new TopicImageSearchCondition();
     return GetTopicImageByTopicId(topicSysNo, sc);
 }