Ejemplo n.º 1
0
        /// <summary>
        /// eBay 리스팅된 결과를 업데이트 한다.
        /// </summary>
        /// <param name="Data">eBay리스팅 결과</param>
        /// <returns></returns>
        public bool SetItemListingResult(ItemListingResult data)
        {
            //비교값이 없으면 에러
            if (string.IsNullOrEmpty(data.InventoryID)) return false;

            eBayItemsData item = new eBayItemDac().FindOne(data.InventoryID);

            if (item == null) return false;

            //초기화
            item.listingreq = new ListingRequest();

            //리스팅 실패시
            if (data.Ack == eBayAckType.Failure)
            {
                item.listingreq.is_comp = true;
                item.listingreq.success = false;
                item.listingreq.message = "eBay 리스팅 실패(콜백 결과)";
            }
            //리스팅 성공시
            else
            {
                item.itemno = data.ItemID;
                item.listingreq.is_comp = true;
                item.listingreq.success = true;
                item.stat = eBayItemStat.Listing;

                item.list_sdate = Util.GetSafeDateTime(data.StartTime, DateTime.Parse("1999-01-01"));
                item.list_edate = Util.GetSafeDateTime(data.EndTime, DateTime.Parse("1999-01-01"));

                //수수료 저장
                var q = (from k in data.Fees
                         where k.Key == "FeaturedFee"
                         select k).ToList();
                if (q.Count() == 1)
                {
                    string fee = q[0].Value;
                    string[] tempFee = fee.Split('.');
                    int d = Util.GetSafeInt(tempFee[0], 0);
                    int c = 0;

                    if (tempFee.Count() == 2)
                    {
                        c = Util.GetSafeInt(tempFee[1], 0);
                    }
                    item.feat_fee = new USD() { d = d, c = c };
                }

                q = (from k in data.Fees
                         where k.Key == "InsertionFee"
                         select k).ToList();
                if (q.Count() == 1)
                {
                    string fee = q[0].Value;
                    string[] tempFee = fee.Split('.');
                    int d = Util.GetSafeInt(tempFee[0], 0);
                    int c = 0;

                    if (tempFee.Count() == 2)
                    {
                        c = Util.GetSafeInt(tempFee[1], 0);
                    }
                    item.ins_fee = new USD() { d = d, c = c };
                }

            }

            item.listingresult = data;
            new eBayItemBiz().SaveItem(item);

            return true;
        }
Ejemplo n.º 2
0
        public void SetItemListingResult()
        {
            //정제
            ItemListingResult Data = new ItemListingResult();

            Data.InventoryID = "4f97556542887f4168377c5f";
            Data.EndTime = "2011-01-01";
            Data.StartTime = "2011-01-02";

            Data.InventoryID = "";

            //동작
            bool Result = new eBayItemBiz().SetItemListingResult(Data);

            //검증
            Trace.WriteLine("Result = " + Result);
        }