Exemple #1
0
 public JsonResult GetEbaySession(string o)
 {
     try
     {
         return(Json(new { IsSuccess = true, Result = EBayUtil.GetToKen(o) }));
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
 }
Exemple #2
0
 public JsonResult GetEbayLoginUrl()
 {
     try
     {
         string url  = "https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&RuName={0}&SessID={1}";
         string code = EBayUtil.GetSessionID();
         url = string.Format(url, AppSettingHelper.GetGenericApiContext("US").RuName, code);
         return(Json(new { IsSuccess = true, Result = url, Code = code }));
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
 }
 public JsonResult Syn(string id)
 {
     try
     {
         if (id != "ALL")
         {
             IList <AccountType> list = NSession.CreateQuery("from AccountType where Platform='Ebay' and AccountName<>''").List <AccountType>();
             foreach (var item in list)
             {
                 if (item.AccountName == id)
                 {
                     if (!string.IsNullOrEmpty(item.ApiToken))
                     {
                         EBayUtil.GetMyeBaySelling(item, NSession);
                     }
                     else
                     {
                         return(Json(new { ErrorMsg = "该账号无 ApiToke!", IsSuccess = false }));
                     }
                 }
             }
         }
         else
         {
             IList <AccountType> list = NSession.CreateQuery("from AccountType where Platform='Ebay' and AccountName<>'' and ApiToken<>''").List <AccountType>();
             foreach (var item in list)
             {
                 EBayUtil.GetMyeBaySelling(item, NSession);
             }
         }
     }
     catch (Exception ee)
     {
         return(Json(new { ErrorMsg = "出错了", IsSuccess = false }));
     }
     return(Json(new { IsSuccess = true, ErrorMsg = "同步成功!" }, JsonRequestBehavior.AllowGet));
 }