Exemplo n.º 1
0
        /// <summary>아이템 타입별 수량 Paging 조회</summary>
        public BmItemQuantityPagingRs GetItemQuantityPagingList(BmItemQuantityPagingRq pDataRq)
        {
            try
            {
                #region SetQuery

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

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

                if (string.IsNullOrEmpty(pDataRq.Item.Type) == false)
                    sbQuery = sbQuery.Replace("--@@Type", " AND Type LIKE '%' + @Type + '%'");

                sbQuery.AppendLine(" AND RowNum BETWEEN (@PageSize * @CurPage) + 1 AND ((@PageSize * @CurPage) + @PageSize)");

                #endregion SetQuery

                BmItemQuantityPagingRs result = new BmItemQuantityPagingRs();
                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;
                if (string.IsNullOrEmpty(pDataRq.Item.Type) == false)
                    cmd.Parameters.Add("@Type", SqlDbType.VarChar, 100).Value = pDataRq.Item.Type;

                #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 = ConvertToBmItemQuantity(ds.Tables[1]);
                    }
                }

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

                return result;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        /// <summary>상품 수량 Paging 조회</summary>
        public BmItemQuantityPagingRs GetItemQuantityPagingList(BmItemQuantityPagingRq pDataRq)
        {
            try
            {
                using (SqlConn = new SqlConnection(ConnectionString))
                {
                    using (TransactionScope scope = new TransactionScope())
                    {
                        try
                        {
                            SqlConn.Open();

                            var result = dac.GetItemQuantityPagingList(pDataRq);

                            scope.Complete();
                            return result;
                        }
                        catch (Exception ex)
                        {

                            throw ex;
                        }
                        finally
                        {
                            SqlConn.Dispose();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                WriteLog("Exception", ex.Message);
                throw;
            }
        }
Exemplo n.º 3
0
 public BmItemPkgRq()
 {
     Item = new BmItem();
     QuantityList = new BmItemQuantityPagingRq();
     ImgList = new BmItemImgPagingRq();
 }