Example #1
0
        /// <summary>아이템 이미지 Paging 조회</summary>
        public BmItemImgPagingRs GetItemImgPagingList(BmItemImgPagingRq pDataRq)
        {
            try
            {
                #region SetQuery

                StringBuilder sbQuery = new StringBuilder(@"SELECT COUNT(Seq) AS 'TotalRowCnt' FROM tbItemImg
                                                            WHERE 1=1
                                                                --@@ItemSeq
                                                            SELECT
                                                                *
                                                            FROM
                                                                (
                                                                SELECT
                                                                    ROW_NUMBER() OVER(ORDER BY RegDt DESC) AS 'RowNum',
                                                                    *
                                                                FROM
                                                                    tbItemImg
                                                                WHERE 1=1
                                                                    --@@ItemSeq
                                                                ) A
                                                            WHERE 1=1");

                if (pDataRq.Item.ItemSeq > 0)
                    sbQuery = sbQuery.Replace("--@@ItemSeq", " AND ItemSeq = @ItemSeq");

                sbQuery.AppendLine(" AND RowNum BETWEEN (@PageSize * @CurPage) + 1 AND ((@PageSize * @CurPage) + @PageSize)");
                sbQuery.AppendLine(" ORDER BY DisplayOrder, RegDt ASC");

                #endregion SetQuery

                BmItemImgPagingRs result = new BmItemImgPagingRs();
                SqlCommand cmd = new SqlCommand();

                cmd.Connection = SqlConn;
                cmd.CommandType = System.Data.CommandType.Text;
                cmd.CommandText = sbQuery.ToString();

                #region Set Parameters

                cmd.Parameters.Add("@PageSize", SqlDbType.Int, 0).Value = pDataRq.Paging.PageSize;
                cmd.Parameters.Add("@CurPage", SqlDbType.Int, 0).Value = pDataRq.Paging.CurPage;

                if (pDataRq.Item.ItemSeq > 0)
                    cmd.Parameters.Add("@ItemSeq", SqlDbType.Int, 0).Value = pDataRq.Item.ItemSeq;

                #endregion Set Parameters

                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataSet ds = new DataSet();

                da.Fill(ds);

                if (ds.Tables[0].Rows.Count == 1)
                {
                    result.TotalCount = Convert.ToInt32(ds.Tables[0].Rows[0]["TotalRowCnt"].ToString());

                    if (result.TotalCount > 0 && ds.Tables[1].Rows.Count > 0)
                    {
                        result.List = ConvertToBmItemImg(ds.Tables[1]);
                    }
                }

                da.Dispose();
                cmd.Dispose();

                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
 public BmItemPkgRs()
 {
     Item = new BmItem();
     QuantityList = new BmItemQuantityPagingRs();
     ImgList = new BmItemImgPagingRs();
 }