public GmarketVerifyData ViewVerifyResult(string gepId) { GepItemsData data = new GepItemsDac().View(Query.EQ("_id", Util.GetSafeLong(gepId))); string errorMessage = string.Empty; string[] arrError = data.ver_code.Split(','); foreach (var err in arrError) { errorMessage += new CommonBiz().ErrorCase(err); } GmarketVerifyData verData = new GmarketVerifyData(); verData.GepItemsDataClass = data; verData.Message = errorMessage; return verData; }
public GepItemsData GepItemView(string code) { QueryComplete query = Query.EQ("_id", Util.GetSafeLong(code)); GepItemsData data = new GepItemsDac().View(query); return data; }
public object GepItemsList(string lcategory = "", string mcategory = "", string scategory = "" , string price1 = "", string price2 = "", string periodType = "", string sdate = "", string edate = "" , string gmarketVerfy = "", string itemVerify = "", string use = "", string searchType = "" , string searchText = "", int page = 1, string sord = "") { List<QueryComplete> param = new List<QueryComplete>(); param.Add(Query.NE("stat", "S1")); // 필수선택 임시저장 상품은 보면 안돼요 ㅎ //카테고리 조건 검색 if (lcategory != "") { param.Add(Query.EQ("src_info.lcategory.cid", lcategory)); } if (mcategory != "") { param.Add(Query.EQ("src_info.mcategory.cid", mcategory)); } if (scategory != "") { param.Add(Query.EQ("src_info.scategory.cid", scategory)); } // 가격 조건 있을시 검색 조건 if (price1 != "" && price2 != "") { param.Add(Query.GTE("src_info.total_price", int.Parse(price1)).LTE(int.Parse(price2))); } // gepcode 생성일 검색 if (periodType == "g" && sdate != "" && edate != "") { param.Add(Query.GTE("rdate", Convert.ToDateTime(sdate)).LTE(Convert.ToDateTime(edate + " 23:59:59"))); } // 1차 가공일 검색 if (periodType == "e" && sdate != "" && edate != "") { param.Add(Query.GTE("udate", Convert.ToDateTime(sdate)).LTE(Convert.ToDateTime(edate + " 23:59:59"))); } //상품최근전환일 검색 if (periodType == "p" && sdate != "" && edate != "") { param.Add(Query.GTE("latest_exp_date", Convert.ToDateTime(sdate)).LTE(Convert.ToDateTime(edate + " 23:59:59"))); } //Gmarket Verfy if (gmarketVerfy != "") { if (gmarketVerfy == "Y") { param.Add(Query.EQ("ver_code", "OK")); } else { param.Add(Query.NotIn("ver_code", "OK")); param.Add(Query.NotIn("ver_code", "")); } } // 상품전환 if (itemVerify != "") { if (itemVerify == "Y") { param.Add(Query.GT("total_exp_count", 0)); } else { param.Add(Query.LT("total_exp_count", 1)); } } //GEP 상품코드 if (searchType == "0" && searchText != "") { param.Add(Query.EQ("_id", Util.GetSafeLong(searchText))); } //G마켓 상품번호 if (searchType == "1" && searchText != "") { param.Add(Query.EQ("src_info.no", searchText)); } //G마켓 상품명 if (searchType == "2" && searchText != "") { param.Add(Query.Matches("src_info.name", new BsonRegularExpression(string.Format("/{0}/", searchText)))); } //판매자명 if (searchType == "3" && searchText != "") { param.Add(Query.EQ("src_info.seller.name", searchText)); } //판매자아이디 if (searchType == "4" && searchText != "") { param.Add(Query.EQ("ta", searchText)); } QueryComplete query = Query.And(param.ToArray()); MongoPagingResult<GepItemsData> mongoResult = new GepItemsDac().List(page, query); List<GepItemsData> list = mongoResult.Result.ToList(); var ascquery = from e in list orderby e.src_info.total_price ascending select e; var desquery = from e in list orderby e.src_info.total_price descending select e; var result = new { totalCount = mongoResult.Count, total = Math.Ceiling(Convert.ToDecimal(Convert.ToDecimal(mongoResult.Count) / 10)), page = page, sord = sord, rows = (from e in sord == "asc" ? ascquery.ToList() : desquery.ToList() select new { ck = "", img = e.img, //_id = string.Format("{0}<br /><a href='/GepItems/ItemEdit?code={0}'>[1차정보가공]</a><input type='hidden' name='hidGepCode' value='{0}' />",e._id), _id = string.Format("{0}<br /><span onclick=\"ItemList.Edit('{0}');\" style=\"cursor:pointer;\">[1차정보가공]</a><input type='hidden' name='hidGepCode' value='{0}' />", e._id), lang = MakeTranString(e.trans), source_site = e.src_site, lcategory_name = e.src_info.lcategory.name, mcategory_name = e.src_info.mcategory.name, scategory_name = e.src_info.scategory.name, src_info_id = string.Format("<a href=\"{0}/detailview/Item.asp?goodscode={1}\" target='_blank' style='text-decoration:underline;'>{1}</a>" , UrlConst.Instance.GOODS_DOMAIN_SERVER_URL ,e.src_info.no), src_info_name = string.Format("<a href=\"{0}/detailview/Item.asp?goodscode={1}\" target='_blank' style='text-decoration:underline;'>{2}</a>" , UrlConst.Instance.GOODS_DOMAIN_SERVER_URL ,e.src_info.no, e.src_info.name), sel_name = e.src_info.sel_name, sel_qty = Common.Util.Util.GetSafeString(e.src_info.sel_qty), sel_price = Common.Util.Util.GetSafeString(e.src_info.sel_price), del_price = Common.Util.Util.GetSafeString(e.src_info.dlv.dlv_fee), price = Common.Util.Util.GetSafeString(e.src_info.total_price), name = e.src_info.seller.name, cell = e.src_info.seller.cell, rdate = e.rdate.ToShortDateString(), ta = e.ta, exp_ta = e.ta, udate = e.udate.ToShortDateString(), total_exp_count = Common.Util.Util.GetSafeString(e.total_exp_count), latest_exp_date = e.latest_exp_date.ToShortDateString(), ver_code = MakeStringForListVerify(e.ver_code, e._id), ver_code_origin = e.ver_code, stat = e.stat } ).ToArray() }; return result; }
public void GepItemUpdate(string code, string imageUrl, string gepName , string usName, string usDesc , string deName, string deDesc , string ruName, string ruDesc) { try { QueryComplete query = Query.EQ("_id", Util.GetSafeLong(code)); GepItemsData data = new GepItemsDac().View(query); data.img = imageUrl; data.src_info.name = gepName; List<trans> listTrans = new List<trans>(); if (usName != "" && usDesc != "") { trans newTransUs = new trans(); newTransUs.lang = "US"; newTransUs.name = usName; newTransUs.desc = usDesc.Replace("\n", ""); listTrans.Add(newTransUs); trans newTransUk = new trans(); newTransUk.lang = "UK"; newTransUs.name = usName; newTransUs.desc = usDesc.Replace("\n", ""); listTrans.Add(newTransUk); trans newTransAu = new trans(); newTransAu.lang = "AU"; newTransAu.name = usName; newTransAu.desc = usDesc.Replace("\n", ""); listTrans.Add(newTransAu); } if (deName != "" && deDesc != "") { trans newTrans = new trans(); newTrans.lang = "DE"; newTrans.name = deName; newTrans.desc = deDesc.Replace("\n", ""); listTrans.Add(newTrans); } if (ruName != "" && ruName != "") { trans newTrans = new trans(); newTrans.lang = "RU"; newTrans.name = ruName; newTrans.desc = ruDesc.Replace("\n", ""); listTrans.Add(newTrans); } data.udate = DateTime.Now; data.trans = listTrans; new GepItemsDac().Save(data); } catch (Exception ex) { throw ex; } }
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); } }