예제 #1
0
        /// <summary>
        /// eBayItem을 저장한다. (0 : 정상, -1 : eBay아이템 키값 오류)
        /// </summary>
        /// <param name="id">eBayItem ObjectID</param>
        /// <param name="form">forSeller와 연동해서 얻은 Form 값</param>
        /// <returns></returns>
        public int SeteBayItems(string id, eBayItemsDataForSeller data)
        {
            eBayItemsData objeBayItemData = new eBayItemBiz().GetEbayItemData(id);
            if (objeBayItemData == null)
            {
                return -1;
            }

            objeBayItemData.dynamicData = data;
            new eBayItemDac().Save(objeBayItemData);

            return 0;
        }
예제 #2
0
        /// <summary>
        /// eBayItem Revise
        /// 리스팅 중인 상품의 eBay 정보를 수정하고 GEP의 eBay 정보를 update 한다.
        /// </summary>
        /// <param name="id">eBay_items 컬렉션의 _id, Inventory ID로 사용됨</param>
        /// <param name="data">수정할 상품정보</param>
        /// <returns></returns>
        public Boolean ReviseItem(String id, eBayItemsDataForSeller data)
        {
            var asis = GetEbayItemData(id);

            if (!asis.dynamicData.ListingDuration.Equals(data.ListingDuration))
            {
                //리스팅 종료일 재계산 : 오늘 날짜 + data.ListingDuration + 7일
                DateTime new_edt = DateTime.Today.AddDays(data.ListingDuration + 7);

                //clone 상품 팔자주문 변경
                bool res = new ItemOrderBiz().EditCloneItemOrder(asis.cln_itemno, new_edt, asis.gep_info.src_price, asis.gep_info.src_settle_price, asis.gep_info.src_qty, asis.ta, "");

                //실패시 eBay 상품정보 Revise 하지 않음.
                if (res == false) return false;
            }

            //eBay 상품 정보 수정
            //실패시 eBay_Items 수정하지 않음.
            JsonWriterSettings jset = new JsonWriterSettings();
            jset.OutputMode = JsonOutputMode.JavaScript;
            var result = new ItemService(apiUrl).ReviseItem(new ReviseItemRequest
            {
                 EbayItemInfo = Util.EncodeUTF8To64(data.ToJson(jset)),
                 EbayTokenID = new CommonBiz().GeteBayToken(asis.ebay_acnt),
                 InventoryID = id,
                 ItemID = asis.itemno,
                 SiteID = asis.site,
            });
            if (!result.Ack.Equals(AckType.Success))
            {
                return false;
            }

            //eBay_Items 수정
            if (SeteBayItems(id, data) < 0) return false;

            //모두 성공하면 true 리턴
            return true;
        }
예제 #3
0
        public void SeteBayItems(string id)
        {
            //정제
            eBayItemsDataForSeller data = new eBayItemsDataForSeller();

            //동작
            int Result = new eBayItemBiz().SeteBayItems(id, data);

            //검증
            Trace.WriteLine(Result.ToString());
        }
예제 #4
0
        public Boolean ValidateSave(eBayItemsDataForSeller data)
        {
            Dictionary<string, object> dic = (Dictionary<string, object>)data.AsDictionary();
            if (dic.ContainsKey("_id") == false)
            {
                return false;
            }

            string ObjectID = dic["_id"].ToString();

            if (ObjectID == "")
            {
                return false;
            }

            eBayItemsData objeBayItemData = new eBayItemBiz().GetEbayItemData(ObjectID);

            if (objeBayItemData == null)
            {
                return false;
            }

            ebayItemDataForSeller forSellerData = new eBayItemBiz().GetForSellerDataParseJSON(objeBayItemData.site, objeBayItemData.dynamicData.PrimaryCategoryID);

            foreach (var t in forSellerData.details)
            {
                if (t.isrequire == "true")
                {
                    if (dic.ContainsKey(t.fieldName) == false || dic[t.fieldName] == null || dic[t.fieldName].ToString() == "")
                    {
                        return false;
                    }
                }
            }

            return true;
        }
예제 #5
0
        public void eBayProductChange(string gepId, string siteId, string settingId, string loginId)
        {
            // 환경설정 가져오기
            BsonDocument bsonDocument = new SettingsDac().View(ObjectId.Parse(settingId));

            //site 정보 가져오기
            ExportSecondSite exportSite = new CommonBiz().ExportSecondSiteView(Util.GetSafeInt(siteId));

            string[] arrGepId = gepId.Split(',');
            foreach (var data in arrGepId)
            {
                //gep item 가져오기
                GepItemsData gepItem = new GepItemsDac().View(Util.GetSafeLong(data));

                if (gepItem.stat != "S2") continue;

                //eBay 상품 변환
                eBayItemsData eBayItems = new eBayItemsData();
                eBayItemsDataForSeller dynamicdata = new eBayItemsDataForSeller();
                //Gep item 데이터
                GEPItem itemgep = new GEPItem();
                itemgep.img = gepItem.img;
                itemgep.ta = gepItem.ta;
                itemgep.rdate = gepItem.rdate;
                //Gep의 소스상품 데이터
                itemgep.src_ver_code = gepItem.ver_code;
                itemgep.src_no = gepItem.src_info.no;
                itemgep.src_name = gepItem.src_info.name;
                itemgep.lcategory = new lcategory();
                itemgep.lcategory = gepItem.src_info.lcategory;
                itemgep.mcategory = new mcategory();
                itemgep.mcategory = gepItem.src_info.mcategory;
                itemgep.scategory = new scategory();
                itemgep.scategory = gepItem.src_info.scategory;
                itemgep.src_tot_price = gepItem.src_info.price + gepItem.src_info.sel_price + gepItem.src_info.dlv.dlv_fee;
                itemgep.src_price = gepItem.src_info.price;
                itemgep.src_settle_price = gepItem.src_info.settle_price;
                itemgep.src_qty = gepItem.src_info.qty;
                itemgep.dlv_fee_cond = gepItem.src_info.dlv.dlv_fee_cond;
                itemgep.sel_no = gepItem.src_info.sel_no;
                itemgep.sel_name = gepItem.src_info.sel_name;
                itemgep.sel_price = gepItem.src_info.sel_price;
                itemgep.sel_qty = gepItem.src_info.sel_qty;
                itemgep.src_seller = gepItem.src_info.seller;

                #region Trans 정보가 있으면 정보 넣어줌.
                foreach (var trans in gepItem.trans)
                {
                    string lang = "EN";
                    if (trans.lang == "US" || trans.lang == "UK" || trans.lang == "AU")
                    {
                        lang = "EN";
                    }
                    else
                    {
                        lang = trans.lang;
                    }

                    if (exportSite.lang == lang)
                    {
                        dynamicdata.Description = trans.desc;
                    }
                }
                #endregion

                eBayItems._id = ObjectId.GenerateNewId();
                eBayItems.gep_id = gepItem._id;
                eBayItems.stat = eBayItemStat.Raw;
                eBayItems.gep_info = itemgep;
                eBayItems.img = gepItem.img;
                eBayItems.rdate = DateTime.Now;
                eBayItems.ta = loginId;
                Dictionary<string, object> category = GeteBaySuggestedCategory(
                    Util.GetSafeInt(siteId),
                    gepItem.src_info.lcategory.name,
                    gepItem.src_info.mcategory.name,
                    gepItem.src_info.scategory.name,
                    gepItem.src_info.no,
                    gepItem.src_info.name
                );
                #region 환경설정 데이터
                Dictionary<string, object> dynamicSettings = new Dictionary<string, object>();
                foreach (var settings in bsonDocument)
                {
                    if (settings.Name == "ListingType")
                    {
                        dynamicdata.ListingType = settings.Value.ToString();
                    }
                    else if (settings.Name == "exportSite")
                    {
                        eBayItems.site = Util.GetSafeInt(settings.Value.ToString());
                    }
                    else if (settings.Name == "exportSiteName")
                    {
                        eBayItems.site_name = settings.Value.ToString();
                    }
                    else if (settings.Name == "PriceConfig")
                    {
                        eBayItems.price_config = settings.Value.ToString();
                    }
                    else if (settings.Name == "PriceConfigValue")
                    {
                        eBayItems.Price_config_value = Util.GetSafeInt(settings.Value.ToString());
                    }
                    else if (settings.Name == "ListingType")
                    {
                        dynamicdata.ListingType = settings.Value.ToString();
                    }
                    else if (settings.Name == "Quantity")
                    {
                        dynamicdata.Quantity = Common.Util.Util.GetSafeInt(settings.Value.ToString());
                    }
                    else if (settings.Name == "ListingDuration")
                    {
                        dynamicdata.ListingDuration = Common.Util.Util.GetSafeInt(settings.Value.ToString());
                    }
                    else if (settings.Name == "Country")
                    {
                        dynamicdata.Country = settings.Value.ToString();
                    }
                    else if (settings.Name == "Location")
                    {
                        dynamicdata.Location = settings.Value.ToString();
                    }
                    else if (settings.Name == "ShippingService")
                    {
                        dynamicdata.ShippingService = settings.Value.ToString();
                    }
                    else if (settings.Name == "ShippingCost")
                    {
                        dynamicdata.ShippingCost = Common.Util.Util.GetSafeInt(settings.Value.ToString());
                    }
                    else if (settings.Name == "AdditionalShippingCost")
                    {
                        dynamicdata.AdditionalShippingCost = Common.Util.Util.GetSafeInt(settings.Value.ToString());
                    }
                    else if (settings.Name == "DispatchTimeMax")
                    {
                        dynamicdata.DispatchTimeMax = Common.Util.Util.GetSafeInt(settings.Value.ToString());
                    }
                    else if (settings.Name == "ExcludeShipToLocation")
                    {
                        dynamicdata.ExcludeShipToLocation = settings.Value.ToString();
                    }
                    else if (settings.Name == "ReturnsAccepted")
                    {
                        dynamicdata.ReturnsAccepted = settings.Value.ToString();
                    }
                    else if (settings.Name == "ReturnsWithin")
                    {
                        dynamicdata.ReturnsWithin = settings.Value.ToString();
                    }
                    else if (settings.Name == "ReturnsRefund")
                    {
                        dynamicdata.ReturnsRefund = settings.Value.ToString();
                    }
                    else if (settings.Name == "ReturnsShippingCostPaidBy")
                    {
                        dynamicdata.ReturnsShippingCostPaidBy = settings.Value.ToString();
                    }
                    else if (settings.Name == "ReturnsDescription")
                    {
                        dynamicdata.ReturnsDescription = settings.Value.ToString();
                    }
                    else if (settings.Name == "HitCounter")
                    {
                        dynamicSettings.Add(settings.Name, settings.Value);
                    }
                    else
                    {
                        //dynamicSettings.Add(settings.Name, settings.Value);
                    }

                    #region 이전
                    //if (settings.Name == "ListingType")
                    //{
                    //    ((dynamic)dynamicdata).ListingType = "test";
                    //    dynamicdata.ListingType = settings.Value.ToString();
                    //}
                    //else if (settings.Name == "exportSite")
                    //{
                    //    eBayItems.site = Util.GetSafeInt(settings.Value.ToString());
                    //}
                    //else if (settings.Name == "exportSiteName")
                    //{
                    //    eBayItems.site_name = settings.Value.ToString();
                    //}
                    //else if (settings.Name == "PriceConfig")
                    //{
                    //    eBayItems.price_config = settings.Value.ToString();
                    //}
                    //else if (settings.Name == "PriceConfigValue")
                    //{
                    //    eBayItems.Price_config_value = Util.GetSafeInt(settings.Value.ToString());
                    //}
                    //else if (settings.Name == "Quantity")
                    //{
                    //    dynamicdata.Quantity = Util.GetSafeInt(settings.Value.ToString());
                    //}
                    //else if (settings.Name == "ListingDuraton")
                    //{
                    //    dynamicdata.ListingDuration = Util.GetSafeInt(settings.Value.ToString());
                    //}
                    //else if (settings.Name == "ItemLocationCountry")
                    //{
                    //    dynamicdata.Country = settings.Value.ToString();
                    //}
                    //else if (settings.Name == "ItemLocation")
                    //{
                    //    dynamicdata.Location = settings.Value.ToString();
                    //}
                    //else if (settings.Name == "ShippingService")
                    //{
                    //    dynamicdata.ShippingService = settings.Value.ToString();
                    //}
                    //else if (settings.Name == "ShippingCost")
                    //{
                    //    dynamicdata.ShippingCost = Util.GetSafeInt(settings.Value.ToString());
                    //}
                    //else if (settings.Name == "AdditionalShippingCost")
                    //{
                    //    dynamicdata.AdditionalShippingCost = Util.GetSafeInt(settings.Value.ToString());
                    //}
                    //else if (settings.Name == "DispatchTimeMax")
                    //{
                    //    dynamicdata.DispatchTimeMax = Util.GetSafeInt(settings.Value.ToString());
                    //}
                    //else if (settings.Name == "FreeShipping")
                    //{
                    //    dynamicdata.FreeShipping = settings.Value.ToString();
                    //}
                    //else if (settings.Name == "txtExcludeShippingLocation")
                    //{
                    //    dynamicdata.ExcludeShipToLocation = settings.Value.ToString();
                    //}
                    //else if (settings.Name == "Returns")
                    //{
                    //    dynamicdata.ReturnsAccepted = settings.Value.ToString();
                    //}
                    //else if (settings.Name == "ReturnsWithin")
                    //{
                    //    dynamicdata.ReturnsWithin = settings.Value.ToString();
                    //}
                    //else if (settings.Name == "ReturnsRefund")
                    //{
                    //    dynamicdata.ReturnsRefund = settings.Value.ToString();
                    //}
                    //else if (settings.Name == "ReturnsShippingCostPaidBy")
                    //{
                    //    dynamicdata.ReturnsShippingCostPaidBy = settings.Value.ToString();
                    //}
                    //else if (settings.Name == "ReturnsDescription")
                    //{
                    //    dynamicdata.ReturnsDescription = settings.Value.ToString();
                    //}
                    #endregion
                }
                #endregion
                dynamicdata.PrimaryCategoryID = Util.GetSafeLong(category["category"].ToString());
                dynamicdata.PrimaryCategoryPath = category["categoryPathOriginal"].ToString();

                dynamicdata.Title = category["name"].ToString();

                dynamicSettings.Remove("reg_date");
                dynamicSettings.Remove("ta_id");

                dynamicdata.SetDynamics(dynamicSettings);
                eBayItems.dynamicData = dynamicdata;
                new eBayItemDac().Save(eBayItems);

                //전환 이력 저장
                SaveExportHistory(loginId, bsonDocument, exportSite, gepItem);
                //Gep Collection에 전환 이력 update
                GepCollectionUpdate(gepItem._id, gepItem.total_exp_count, loginId);
            }
        }