Пример #1
0
        public ActionResult List(GoodsQuery query)
        {
            var list   = this.GoodsRepository.GetList(query);
            var data   = list.Data.Select(c => GoodsModel.From(c)).ToList();
            var result = new { total = list.RecordCount, rows = data };

            return(Json(result));
        }
Пример #2
0
        public long GetGoodsCount
        (
            string AuthKey,
            string serviceURL,
            string good_name,
            string good_subName,
            string good_NickName,
            string good_maker
        )
        {
            if (!securityManager.CheckSecurityToken(AuthKey))
            {
                throw new Exception("인증된 사용자가 아닙니다");
            }
            string    CountQuery = new GoodsQuery().GetGoodsCount(good_name, good_subName, good_NickName, good_maker);
            DataTable dt         = DBController.getInstance().GetData(serviceURL, CountQuery);
            long      count      = Convert.ToInt64(dt.Rows[0][0]);

            return(count);
        }
Пример #3
0
        //C
        public IList <GoodsListVO> GetGoodsList
        (
            string AuthKey,
            string serviceURL,
            int page,
            int rowCount,
            string good_name,
            string good_subName,
            string good_NickName,
            string good_maker
        )
        {
            if (!securityManager.CheckSecurityToken(AuthKey))
            {
                throw new Exception("인증된 사용자가 아닙니다");
            }
            IList <GoodsListVO> GoodsVOList = new List <GoodsListVO>();
            //쿼리 작성
            string Query = new GoodsQuery().SelectGoodsList(page, rowCount, good_name, good_subName, good_NickName, good_maker);
            //데이터 구하기
            DataTable dt = DBController.getInstance().GetData(serviceURL, Query);

            //구한 데이터 가공하기
            foreach (DataRow dr in dt.Rows)
            {
                GoodsListVO goodsVO = new GoodsListVO();
                foreach (var prop in typeof(GoodsListVO).GetProperties())
                {
                    if (prop.Name == "Item")
                    {
                        continue;
                    }
                    goodsVO[prop.Name] = dr[prop.Name];
                }
                GoodsVOList.Add(goodsVO);
            }
            return(GoodsVOList);
        }
Пример #4
0
        public GoodsDetail GetGoodDetail(string AuthKey, string serviceURL, long good_pk)
        {
            if (!securityManager.CheckSecurityToken(AuthKey))
            {
                throw new Exception("인증된 사용자가 아닙니다");
            }
            //쿼리 작성
            string Query = new GoodsQuery().GoodDetails(good_pk);
            //데이터 구하기
            DataTable dt = DBController.getInstance().GetData(serviceURL, Query);
            //데이터 가공
            GoodsDetail detailMaster = new GoodsDetail();

            detailMaster.unitcostList       = new List <unitcost>();
            detailMaster.good_unit_infoList = new List <good_unit_info>();
            detailMaster.goodpartList       = new List <goodpart>();
            detailMaster.goodsellerList     = new List <goodseller>();

            foreach (DataRow dr in dt.Rows)
            {
                foreach (var prop in typeof(GoodsDetail).GetProperties())
                {
                    if (prop.Name == "Item")
                    {
                        continue;
                    }
                    if (prop.Name.Contains("List"))
                    {
                        continue;
                    }
                    if (dr[prop.Name].GetType() == typeof(DBNull))
                    {
                        continue;
                    }
                    detailMaster[prop.Name] = dr[prop.Name];
                }//End of Foreach
                unitcost       unitcost       = new unitcost();
                good_unit_info good_unit_info = new good_unit_info();
                goodpart       goodpart       = new goodpart();
                goodseller     goodseller     = new goodseller();
                foreach (var prop in typeof(unitcost).GetProperties())
                {
                    if (prop.Name == "Item")
                    {
                        continue;
                    }
                    if (dr[prop.Name].GetType() == typeof(DBNull))
                    {
                        continue;
                    }
                    unitcost[prop.Name] = dr[prop.Name];
                }
                foreach (var prop in typeof(good_unit_info).GetProperties())
                {
                    if (prop.Name == "Item")
                    {
                        continue;
                    }
                    if (dr[prop.Name].GetType() == typeof(DBNull))
                    {
                        continue;
                    }
                    good_unit_info[prop.Name] = dr[prop.Name];
                }
                foreach (var prop in typeof(goodpart).GetProperties())
                {
                    if (prop.Name == "Item")
                    {
                        continue;
                    }
                    if (dr[prop.Name].GetType() == typeof(DBNull))
                    {
                        continue;
                    }
                    goodpart[prop.Name] = dr[prop.Name];
                }
                foreach (var prop in typeof(goodseller).GetProperties())
                {
                    if (prop.Name == "Item")
                    {
                        continue;
                    }
                    if (dr[prop.Name].GetType() == typeof(DBNull))
                    {
                        continue;
                    }
                    goodseller[prop.Name] = dr[prop.Name];
                }
                detailMaster.unitcostList.Add(unitcost);
                detailMaster.good_unit_infoList.Add(good_unit_info);
                detailMaster.goodpartList.Add(goodpart);
                detailMaster.goodsellerList.Add(goodseller);
            }//End of Outer Foreach

            return(detailMaster);
        }
Пример #5
0
        /// <summary>
        /// Test Find using the Query class
        /// </summary>
        private void Step_30_TestFindByQuery_Generated()
        {
            using (TransactionManager tm = CreateTransaction())
            {
                //Insert Mock Instance
                Goods mock   = CreateMockInstance(tm);
                bool  result = DataRepository.GoodsProvider.Insert(tm, mock);

                Assert.IsTrue(result, "Could Not Test FindByQuery, Insert Failed");

                GoodsQuery query = new GoodsQuery();

                query.AppendEquals(GoodsColumn.GoodsId, mock.GoodsId.ToString());
                query.AppendEquals(GoodsColumn.Barcode, mock.Barcode.ToString());
                query.AppendEquals(GoodsColumn.Mbc, mock.Mbc.ToString());
                if (mock.SafeNameRef != null)
                {
                    query.AppendEquals(GoodsColumn.SafeNameRef, mock.SafeNameRef.ToString());
                }
                if (mock.GrpId != null)
                {
                    query.AppendEquals(GoodsColumn.GrpId, mock.GrpId.ToString());
                }
                query.AppendEquals(GoodsColumn.ShortName, mock.ShortName.ToString());
                query.AppendEquals(GoodsColumn.FullName, mock.FullName.ToString());
                query.AppendEquals(GoodsColumn.Packunit, mock.Packunit.ToString());
                query.AppendEquals(GoodsColumn.Piceunit, mock.Piceunit.ToString());
                query.AppendEquals(GoodsColumn.Unitconv, mock.Unitconv.ToString());
                if (mock.SuppId != null)
                {
                    query.AppendEquals(GoodsColumn.SuppId, mock.SuppId.ToString());
                }
                if (mock.OpenDate != null)
                {
                    query.AppendEquals(GoodsColumn.OpenDate, mock.OpenDate.ToString());
                }
                if (mock.TaxCode != null)
                {
                    query.AppendEquals(GoodsColumn.TaxCode, mock.TaxCode.ToString());
                }
                if (mock.MercType != null)
                {
                    query.AppendEquals(GoodsColumn.MercType, mock.MercType.ToString());
                }
                if (mock.AttrType != null)
                {
                    query.AppendEquals(GoodsColumn.AttrType, mock.AttrType.ToString());
                }
                if (mock.Domestic != null)
                {
                    query.AppendEquals(GoodsColumn.Domestic, mock.Domestic.ToString());
                }
                if (mock.Warranty != null)
                {
                    query.AppendEquals(GoodsColumn.Warranty, mock.Warranty.ToString());
                }
                if (mock.Status != null)
                {
                    query.AppendEquals(GoodsColumn.Status, mock.Status.ToString());
                }

                TList <Goods> results = DataRepository.GoodsProvider.Find(tm, query);

                Assert.IsTrue(results.Count == 1, "Find is not working correctly.  Failed to find the mock instance");
            }
        }