private bool Modify(ref _GoodsFreshStr goodInfo, GoodsFresh objFresh) { goodInfo.strFreshStatus = ""; goodInfo.bModify = true; string strError = ""; Hashtable hWaitTable = new Hashtable(); Hashtable hFailTable = new Hashtable(); //修改失败的价格列表 bool bRet = DataContrl.GetModifyData(goodInfo.strAcc, ref hWaitTable); //得到等待刷新的商品列表 if (!bRet) { goodInfo.strModifyStatus = "无价格刷新列表"; ShowInfo(goodInfo); ShowLogString(strError); return true; } int iTotalCount = hWaitTable.Count; goodInfo.iModifyCount = iTotalCount; goodInfo.strModifyStatus = "登录中..."; ShowInfo(goodInfo); #if __PAOPAO string strDirect = System.AppDomain.CurrentDomain.BaseDirectory + "pic"; if (!Directory.Exists(strDirect)) { Directory.CreateDirectory(strDirect); } string strFile = string.Format("{0}\\{1}.bmp", strDirect, goodInfo.strAcc); bRet = objFresh.GetImage(strFile,out strError); string strCheckCode = ""; if (bRet) { lock (m_hLockTable) { GetCodeHandler _myInvoke = new GetCodeHandler(GetCode); strCheckCode = (string)this.Invoke(_myInvoke, new object[] { strFile }); if (strCheckCode.Length != 4) { goodInfo.strFreshStatus = "验证码错误"; ShowInfo(goodInfo); return false; } } } else { goodInfo.strFreshStatus = strError; ShowInfo(goodInfo); ShowLogString(strError); return false; } bRet = objFresh.PaoPaoLogin(goodInfo.strAcc, goodInfo.strPwd, strCheckCode, out strError); #else bRet = objFresh.Login(goodInfo.strAcc, goodInfo.strPwd, false); #endif if (!bRet) { strError = "登录失败"; goodInfo.strModifyStatus = strError; ShowInfo(goodInfo); ShowLogString(strError); return false; } goodInfo.strModifyStatus = "修改中..."; ShowInfo(goodInfo); int iCurPage = 1; int iRet = -1; int iModifyCount = 0; int iGoodCount = 0; bool bBreak = false; int iNetErrorCount = 0; while (m_bFresh && !bBreak) { #if __PAOPAO //FreshPaoPao iRet = objFresh.FreshPaoPao(out strError, out iModifyCount, out iGoodCount, out bBreak, iCurPage + 1, true, ref hWaitTable, ref hFailTable, ref iNetErrorCount); #else iRet = objFresh.Fresh(out strError, out iModifyCount, out iGoodCount, out bBreak, iCurPage + 1, true, ref hWaitTable, ref hFailTable, ref iNetErrorCount); #endif goodInfo.strModifyStatus = strError; //成功 if (iRet == 0) { goodInfo.iModifyCount = iTotalCount; goodInfo.iModifySucCount += iModifyCount; goodInfo.strModifyStatus = "修改中..."; if (bBreak) { goodInfo.strModifyStatus = "修改完成"; } } else if (iRet == -3)//网络错误 { goodInfo.strModifyStatus = strError; ShowLogString(string.Format("{0} {1}", iCurPage, strError)); } else if (iRet == -1)//数据错误,直接退出 { ShowLogString("发生数据错误,退出"); ShowLogString(string.Format("{0} {1}", iCurPage, strError)); } else { goodInfo.strModifyStatus = strError; ShowLogString(string.Format("{0} {1}", iCurPage, strError)); } ShowInfo(goodInfo); if ( iRet != -3 ) { iCurPage++; } if (bBreak) { bRet = true; break; } if (iRet == -1) { bRet = false; break; } Thread.Sleep(500); } //DataContrl.AddNeedAddList(goodInfo.strAcc, hFailTable); return bRet; }