private void ImportShop(string groupId, int version)
        {
            ImportFacade facade = new ImportFacade();
            facade.StartImport(groupId, version++, CurrentUser.Id);
            int pageIndex = 0;
            int pageSize = 20;
            int successCount = 0;
            int failCount = 0;
            while (true)
            {
                List<ImportItemInfo> itemList = facade.GetImportItemList(groupId, pageIndex++, pageSize);
                if (itemList == null || itemList.Count == 0) break;
                foreach (ImportItemInfo item in itemList)
                {
                    try
                    {
                        facade.StartImportItem(item.Id, item.CurrentVersion, CurrentUser.Id);

                        Item toItem = ImportItem(item);

                        facade.FinishImportItem(groupId, version++, item.Id, item.CurrentVersion
                            , ImportorEnumerations.ImportItemResult.AddSuccess
                            , toItem.Iid, toItem.Title, toItem.Price, CurrentSellerNick, CurrentShopTitle
                            , ++successCount, failCount, "导入成功!", CurrentUser.Id);
                    }
                    catch (Exception ex)
                    {
                        facade.FinishImportItem(groupId, version++, item.Id, item.CurrentVersion
                            , ImportorEnumerations.ImportItemResult.Fail
                            , "", "", "", CurrentSellerNick, CurrentShopTitle
                            , ++failCount, failCount, ex.Message, CurrentUser.Id);
                    }
                }
                if (itemList.Count < pageSize) break;
            }
            ImportorEnumerations.ImportGroupResult result;
            if (failCount == 0)
            {
                result = ImportorEnumerations.ImportGroupResult.AllSuccess;
            }
            else if (successCount == 0)
            {
                result = ImportorEnumerations.ImportGroupResult.Fail;
            }
            else
            {
                result = ImportorEnumerations.ImportGroupResult.ParttenSuccess;
            }
            facade.FinishImport(groupId, version++, result, CurrentUser.Id);
        }
        private void DisplayImportDetail(string groupId)
        {
            ImportFacade facade = new ImportFacade();
            ImportGroupInfo group = facade.GetImportGroup(groupId);
            if (group != null && group.OperatorUserId == CurrentUser.Id)
            {
                if (!string.IsNullOrEmpty(group.ImportFormShopImageUrl))
                {
                    imgShop.Visible = true;
                    imgShop.ImageUrl = string.Format(ShopLogUrlFormat, group.ImportFormShopImageUrl);
                }
                else
                {
                    imgShop.Visible = false;
                }
                lblNick.Text = group.ImportFormSellerNick;
                lblShopTitle.Text = group.ImportFormShopTitle;
                lblImportCount.Text = group.TotalCount.ToString();
                if (group.ImportState == ImportorEnumerations.ImportState.Waitting)
                {
                    lblState.Text = "系统正在准备要导入的数据...";
                    lblSummary.Text = "导入操作完成以后统计数据,请稍等...";
                    hlnkRefresh.NavigateUrl = "ImportShop4.aspx?GroupId=" + groupId;
                }
                else if (group.ImportState == ImportorEnumerations.ImportState.Importing)
                {
                    lblState.Text = "正在导入数据...";
                    lblSummary.Text = "导入操作完成以后统计数据,请稍等...";
                    hlnkRefresh.NavigateUrl = "ImportShop4.aspx?GroupId=" + groupId;
                }
                else
                {
                    string result;
                    if (group.ImportResult == ImportorEnumerations.ImportGroupResult.Pending)
                    {
                        result = "未统计";
                    }
                    else if (group.ImportResult == ImportorEnumerations.ImportGroupResult.AllSuccess)
                    {
                        result = "全部成功";
                    }
                    else if (group.ImportResult == ImportorEnumerations.ImportGroupResult.ParttenSuccess)
                    {
                        result = "部分成功";
                    }
                    else
                    {
                        result = "失败";
                    }
                    lblState.Text = string.Format("导入操作已结束({0})", result);
                    lblSummary.Text = string.Format("成功:{0}; 失败:{1};", group.SuccessCount, group.FailCount);
                    hlnkRefresh.Visible = false;
                }
            }
            else
            {
                imgShop.Visible = false;

                List<InformationObject> infoList = new List<InformationObject>();
                InformationObject obj1 = new InformationObject();
                obj1.CssName = "Information";
                obj1.Message = "发生错误,有可能是下列原因之一导致的:";
                infoList.Add(obj1);
                InformationObject obj2 = new InformationObject();
                obj2.CssName = "ErrorMsg";
                obj2.Message = "1.你所查看的导入记录不存在";
                infoList.Add(obj2);
                InformationObject obj3 = new InformationObject();
                obj3.CssName = "ErrorMsg";
                obj3.Message = "2.你所查看的导入记录是其他人的";
                infoList.Add(obj3);
                DisplayInformations(infoList, InformationIcoType.Warning);
            }
        }
        private void ImportShop(string groupId, Shop shop, int version, List<string> ignoreList)
        {
            ImportFacade facade = new ImportFacade();
            int pageIndex = 1;
            int pageSize = 20;
            while (true)
            {
                List<Item> topItemList = GetItemList(shop.SellerNick, pageIndex++, pageSize);
                if (topItemList == null || topItemList.Count == 0) break;
                foreach (Item item in topItemList)
                {
                    if (ignoreList.Contains(item.Iid)) continue;

                    string itemId = Guid.NewGuid().ToString();
                    facade.AddImportItem(itemId, groupId, CurrentUser.Id, CurrentUser.UserName, item.Iid, item.Title, item.Price, shop.SellerNick, shop.Title, CurrentUser.Id);
                }
                if (topItemList.Count < pageSize) break;
            }

            ImportShop(groupId, version);
        }
        private int AddImportGroupToDb(string groupId, Shop shop)
        {
            int totalCount = GetTotalImportCount(shop.SellerNick);

            ImportFacade facade = new ImportFacade();
            facade.AddImportGroup(groupId, CurrentUser.Id, CurrentUser.UserName, totalCount - IgnoreList.Count, shop.SellerNick, shop.Title, shop.LogoUrl, CurrentSellerNick, CurrentShopTitle, ImportorEnumerations.ImportType.Shop, CurrentUser.Id);

            return totalCount;
        }