protected void Page_Load(object sender, EventArgs e) { if (CurrentUser == null) { string msg = CompressionHelper.Compress("必须登录系统,才能执行导入店铺的操作!"); string url = "~/Authorizes/UnLogin.aspx?ReturnUrl=" + Server.UrlEncode(Request.Url.AbsoluteUri) + "&Msg=" + Server.UrlEncode(msg); Response.Redirect(url); } if (string.IsNullOrEmpty(CurrentSessionKey) || string.IsNullOrEmpty(CurrentSellerNick)) { string msg = CompressionHelper.Compress("必须先获取淘宝授权,才能执行导入店铺的操作!"); string url = "~/Authorizes/UnAuthorize.aspx?ReturnUrl=" + Server.UrlEncode(Request.Url.AbsoluteUri) + "&Msg=" + Server.UrlEncode(msg); Response.Redirect(url); } if (!IsPostBack) { if (!string.IsNullOrEmpty(Request["GroupId"])) { string groupId = Request["GroupId"]; DisplayImportDetail(groupId); } else if (!string.IsNullOrEmpty(Request["Shop"])) { string json = CompressionHelper.Decompress(Request["Shop"]); JavaScriptSerializer ser = new JavaScriptSerializer(); Shop shop = ser.Deserialize <Shop>(json); string groupId = Guid.NewGuid().ToString(); int version = 0; AddImportGroupToDb(groupId, shop); version++; SyncImportShop importor = new SyncImportShop(ImportShop); AsyncCallback call = new AsyncCallback(ImportCallBack); IAsyncResult result = importor.BeginInvoke(groupId, shop, version, IgnoreList, call, importor); Response.Redirect("ImportShop4.aspx?GroupId=" + groupId); } else { Response.Redirect("ImportShop1.aspx"); } } }
private void ImportCallBack(IAsyncResult result) { SyncImportShop state = (SyncImportShop)result.AsyncState; state.EndInvoke(result); }
protected void Page_Load(object sender, EventArgs e) { if (CurrentUser == null) { string msg = CompressionHelper.Compress("必须登录系统,才能执行导入店铺的操作!"); string url = "~/Authorizes/UnLogin.aspx?ReturnUrl=" + Server.UrlEncode(Request.Url.AbsoluteUri) + "&Msg=" + Server.UrlEncode(msg); Response.Redirect(url); } if (string.IsNullOrEmpty(CurrentSessionKey) || string.IsNullOrEmpty(CurrentSellerNick)) { string msg = CompressionHelper.Compress("必须先获取淘宝授权,才能执行导入店铺的操作!"); string url = "~/Authorizes/UnAuthorize.aspx?ReturnUrl=" + Server.UrlEncode(Request.Url.AbsoluteUri) + "&Msg=" + Server.UrlEncode(msg); Response.Redirect(url); } if (!IsPostBack) { if (!string.IsNullOrEmpty(Request["GroupId"])) { string groupId = Request["GroupId"]; DisplayImportDetail(groupId); } else if (!string.IsNullOrEmpty(Request["Shop"])) { string json = CompressionHelper.Decompress(Request["Shop"]); JavaScriptSerializer ser = new JavaScriptSerializer(); Shop shop = ser.Deserialize<Shop>(json); string groupId = Guid.NewGuid().ToString(); int version = 0; AddImportGroupToDb(groupId, shop); version++; SyncImportShop importor = new SyncImportShop(ImportShop); AsyncCallback call = new AsyncCallback(ImportCallBack); IAsyncResult result = importor.BeginInvoke(groupId, shop, version, IgnoreList, call, importor); Response.Redirect("ImportShop4.aspx?GroupId=" + groupId); } else { Response.Redirect("ImportShop1.aspx"); } } }