Ejemplo n.º 1
0
 public void CreateEbayItem()
 {
     eBayItemsData data = new eBayItemsData();
     data.dynamicData = new eBayItemsDataForSeller();
     data.gep_info = new GEPItem();
     data.listingreq = new ListingRequest()
     {
         is_comp = false
         ,
         message = ""
         ,
         success = true
     };
     new eBayItemDac().Save(data);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// eBay에 리스팅후 결과를 반환한다.
        /// </summary>
        /// <param name="data">eBay 리스팅 대기상품</param>
        /// <returns></returns>
        private ResultSet SetListItem(eBayItemsData data)
        {
            ResultSet result = new ResultSet();
            try
            {
                TaInfo taInfo = new BizDac.TaInfoBiz().FindTaUser(data.ta);
                var queryTainfo = (from t in taInfo.accounts
                                   where ((int)t.site_id) == data.site
                                   select t).ToList();

                //사이트 정보가 없으면 에러
                if (queryTainfo.Count() == 0)
                {
                    result.isResult = false;
                    result.Message = "사이트 정보가 없습니다";
                    return result;
                }

                ListItemRequest req = new ListItemRequest();

                //등록과 재등록을 구분해 준다.
                if (String.IsNullOrEmpty(data.itemno))
                {
                    logger.Info("forSeller listing id : " + data._id);

                    req = new ListItemRequest
                        {
                            EbayItemInfo = CreateJsonData(data)
                            ,
                            EbayTokenID = queryTainfo[0].token
                            ,
                            InventoryID = data._id.ToString()
                            ,
                            SiteID = data.site
                            ,
                            ItemID = ""
                        };
                }
                else
                {
                    logger.Info("forSeller relisting id : " + data._id);

                    req = new ListItemRequest
                    {
                        EbayItemInfo = CreateJsonData(data)
                        ,
                        EbayTokenID = queryTainfo[0].token
                        ,
                        InventoryID = data._id.ToString()
                        ,
                        SiteID = data.site

                        ,ItemID = data.itemno.ToString()
                    };
                }

                var res = new ItemService(apiUrl).ListItem
            (req);

                result.eBayResponse = res.Response;
                if (res.Ack == AckType.Failure)
                {
                    result.isResult = false;
                    result.Message = "eBay 리스팅에 실패했습니다.";
                }
                else
                {
                    result.isResult = true;
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.Message.ToString();
            }

            return result;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 클론 상품 상품 재등록 (주문수정)
        /// </summary>
        /// <param name="data">eBay 리스팅 대기상품</param>
        /// <returns></returns>
        private ClonItemCreateResult EditGMKTCloneProduct(eBayItemsData data)
        {
            //리턴할 클래스 인스턴스화
            ClonItemCreateResult result = new ClonItemCreateResult();

            //string lCategory = data.gep_info.lcategory.cid;
            //string mCategory = data.gep_info.mcategory.cid;
            //string sCategory = data.gep_info.scategory.cid;

            /*테스트 테이트*/
            //data.gep_info = new GEPItem();
            //data.gep_info.src_no = "201599393";
            //data.gep_info.src_price = 20000;
            //data.gep_info.src_settle_price = 18400;
            //data.gep_info.sel_name = "고리 : 펄스타킹-검";
            //data.gep_info.sel_price = 1000;
            //data.gep_info.sel_qty = 60;
            //string lCategory = "100000003";
            //string mCategory = "200000498";
            //string sCategory = "300004668";

            //2.	GEP Clone Item생성(김정덕, 이승현)
            //testok, test4plan id로 상품생성
            GEPCloneItemRegT cloneItemRegT = new GEPCloneItemRegT();

            /* GEP상품에 대한 입력 값 */
            cloneItemRegT.ItemNo = data.cln_itemno; //cloneItemNo;	//클론 상품번호
            cloneItemRegT.OrgItemNo = data.gep_info.src_no; //orgItemNo;	//소스 상품번호

            //최소 재고 수량
            int minQty = ((0 < data.gep_info.src_qty && data.gep_info.src_qty < data.gep_info.sel_qty) ?
                                                                    data.gep_info.src_qty : data.gep_info.sel_qty);

            //주문정보
            cloneItemRegT.OrderInfo = new Gmkt.Common.Item.OrderInfoT();
            cloneItemRegT.OrderInfo.CostPrice = data.gep_info.src_settle_price; //공급원가
            cloneItemRegT.OrderInfo.SellPrice = data.gep_info.src_price;			//판매가
            cloneItemRegT.OrderInfo.StockQty = minQty;				//수량
            cloneItemRegT.OrderInfo.DisplayDate = new PeriodT();
            cloneItemRegT.OrderInfo.DisplayDate.StartDate = DateTime.Now;

            //추가 전시 기간 : 7일
            int default_days = 7;

            cloneItemRegT.OrderInfo.DisplayDate.EndDate = DateTime.Now.AddDays(data.dynamicData.ListingDuration + default_days);

            /* 밑으로는 고정값 */
            cloneItemRegT.IsCopy = false;
            cloneItemRegT.IsCopyItemOpinion = false;
            cloneItemRegT.IsChangeStatOldItem = false;
            cloneItemRegT.ChannelType = ChannelEnum.GEP;

            cloneItemRegT.Admin = new AdminT();
            cloneItemRegT.Admin.AdminID = "System";
            cloneItemRegT.LogUserInfo = new LogUserInfoT();
            cloneItemRegT.LogUserInfo.UserIP = "127.0.0.1";
            cloneItemRegT.LogUserInfo.Location = "GEP clone 상품등록";

            try
            {
                //주문 전시일,재고등 수정
                result.GepCloneItemRegResultT = new ItemGEPControl().EditCloneItemOrder(cloneItemRegT);
                result.isException = false;

            }
            catch (InvalidUserInputException ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }
            catch (BusinessRuleException ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }
            catch (GmktException ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }
            catch (Exception ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }

            return result;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// forSeller와 통신하기 위해 클래스를 Json형식으로 변환후 Base64로 인코딩한다.
 /// </summary>
 /// <param name="data">포셀러에 전송하기 위한 다이나믹 클래스</param>
 /// <returns></returns>
 private string CreateJsonData(eBayItemsData data)
 {
     JsonWriterSettings jset = new JsonWriterSettings();
     jset.OutputMode = JsonOutputMode.JavaScript;
     return Util.EncodeTo64(data.dynamicData.ToJson<eBayItemsDataForSeller>(jset)); // base64(json)로 데이터 생성
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 클론 상품 상품마감 (주문삭제)
        /// </summary>
        /// <param name="data">eBay 리스팅 대기상품</param>
        /// <returns></returns>
        private ClonItemCreateResult CloseGMKTCloneProduct(eBayItemsData data)
        {
            //리턴할 클래스 인스턴스화
            ClonItemCreateResult result = new ClonItemCreateResult();
            //clone 상품
            GEPCloneItemRegT cloneItemRegT = new GEPCloneItemRegT();

            cloneItemRegT.ItemNo = data.cln_itemno;//cloneItemNo; //클론 상품번호
            cloneItemRegT.OrgItemNo = data.gep_info.src_no;

            /* 밑으로는 고정값 */
            cloneItemRegT.IsCopy = false;
            cloneItemRegT.IsCopyItemOpinion = false;
            cloneItemRegT.IsChangeStatOldItem = false;
            cloneItemRegT.ChannelType = ChannelEnum.GEP;

            cloneItemRegT.Admin = new AdminT();
            cloneItemRegT.Admin.AdminID = "System";
            cloneItemRegT.LogUserInfo = new LogUserInfoT();
            cloneItemRegT.LogUserInfo.UserIP = "127.0.0.1";
            cloneItemRegT.LogUserInfo.Location = "GEP clone 상품등록";

            try
            {
                //상품번호와 AdminID 필요 상품 삭제처리
                result.GepCloneItemRegResultT = new ItemGEPControl().RemoveCloneItemOrder(cloneItemRegT);
                result.isException = false;

            }
            catch (InvalidUserInputException ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }
            catch (BusinessRuleException ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }
            catch (GmktException ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }
            catch (Exception ex)
            {
                result.isException = true;
                result.exceptionMessage = ex.Message.ToString();
            }

            return result;
        }
Ejemplo n.º 6
0
 /// <summary>
 /// ebayItems 컬렉션의 갱신
 /// </summary>
 /// <param name="data">eBayItem 데이터</param>
 public void SaveItem(eBayItemsData data)
 {
     new eBayItemDac().Save(data);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// eBay 상품정보 저장
 /// </summary>
 public void Save(eBayItemsData item)
 {
     GEPMongoDacHelper MongoHelper = new GEPMongoDacHelper(dataBase, collection);
     MongoHelper.Save<eBayItemsData>(item);
 }
Ejemplo n.º 8
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);
            }
        }