public void AddResult(string statement, int rowsAffected) { ResultItem item = new ResultItem(statement, rowsAffected); _results.Add(item); _totalRowsAffected += rowsAffected; ++_successfulStatements; }
public void AddError(string statement, Exception exception) { if (!_results.Exists(x => (x.Statement == statement) && (x.Ex.Message == exception.Message))) { ResultItem item = new ResultItem(statement, exception); _results.Add(item); ++_errors; } }
public static async Task <Result> api_InvokeScript(Hash160 scripthash, string methodname, params string[] subparam) { byte[] data = null; using (ScriptBuilder sb = new ScriptBuilder()) { MyJson.JsonNode_Array array = new MyJson.JsonNode_Array(); if (subparam != null && subparam.Length > 0) { for (var i = 0; i < subparam.Length; i++) { array.AddArrayValue(subparam[i]); } } sb.EmitParamJson(array); sb.EmitPushString(methodname); sb.EmitAppCall(scripthash); data = sb.ToArray(); } string script = ThinNeo.Helper.Bytes2HexString(data); byte[] postdata; var url = Helper.MakeRpcUrlPost(Config.api, "invokescript", out postdata, new MyJson.JsonNode_ValueString(script)); var text = await Helper.HttpPost(url, postdata); MyJson.JsonNode_Object json = MyJson.Parse(text) as MyJson.JsonNode_Object; Result rest = new Result(); rest.textInfo = text; if (json.ContainsKey("result")) { var result = json["result"].AsList()[0].AsDict()["stack"].AsList(); rest.value = ResultItem.FromJson("Array", result); } return(rest);// subPrintLine("得到的结果是:" + result); }
public static Result <IEnumerable <ResultPair>, string> GetTypedResultsInListAndError <TResult>(this IEnumerable <ResultPair> evalResults, Func <TargetItem, bool> filterTargetFunc) where TResult : class, ResultItem { Func <Result <IEnumerable <ResultPair>, string>, ResultPair, Func <TargetItem, bool>, Result <IEnumerable <ResultPair>, string> > agrFunc = (bAgr, a, tFilter) => { if (bAgr.IsFailure) { return(Result.Fail <IEnumerable <ResultPair>, string>(bAgr.Error)); } IEnumerable <ResultPair> bAgrList = bAgr.Value; Result <ResultItem, string> aResult = a.Value; if (aResult.IsFailure) { return(Result.Fail <IEnumerable <ResultPair>, string>(aResult.Error)); } TargetItem aParamKey = a.Key; if (tFilter(aParamKey) == false) { return(Result.Ok <IEnumerable <ResultPair>, string>(bAgrList)); } ResultItem itemResult = aResult.Value; TResult typeResult = itemResult as TResult; if (typeResult == null) { return(Result.Fail <IEnumerable <ResultPair>, string>(itemResult.DecoratedError(ERROR_TEXT_RESULTS_CASTING_FAILED))); } IEnumerable <ResultPair> resultList = bAgrList.Merge(a).OrderBy((x) => (x.Key)); return(Result.Ok <IEnumerable <ResultPair>, string>(resultList)); }; Result <IEnumerable <ResultPair>, string> initResult = Result.Ok <IEnumerable <ResultPair>, string>(new List <ResultPair>()); return(evalResults.Aggregate(initResult, (agr, x) => agrFunc(agr, x, filterTargetFunc))); }
public void Constructor_EnumValueLessThanZero_IsErrorType() { var item = new ResultItem(-1, "message"); item.Type.Should().Be(ResultItemType.Error); }
public PlotSet teamAS(DateTime startDate, int stepBacklogTime, int stepLeadTime) { #region Запрос номеров таск из TFS, удовлетворяющих запросу var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://tfs.tele2.ru/tfs/Main/Tele2/_apis/wit/wiql?api-version=3.0"); httpWebRequest.Method = "POST"; httpWebRequest.Credentials = new NetworkCredential("user", "password"); httpWebRequest.ContentType = "application/json; charset=utf-8; api-version=3.0"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { string jsonTeamAS = "{" + "\"query\":" + "\"" + "SELECT[System.Id], " + "[System.CreatedDate], " + "[Microsoft.VSTS.Common.ActivatedDate], " + "[Microsoft.VSTS.Common.ClosedDate], " + "[System.State], " + "[System.IterationPath], " + "[System.WorkItemType], " + "[System.Title], " + "[System.AssignedTo], " + "[System.AreaPath], " + "[System.Tags] " + "FROM WorkItems WHERE[System.TeamProject] = @project and " + "[System.WorkItemType] = 'Требование' and " + @"[System.AreaPath] under 'Tele2\\CRM' and " + @"([System.AreaPath] = 'Tele2\\CRM\\CRM Team A' or " + @"[System.AreaPath] = 'Tele2\\CRM\\CRM Support') and " + @"not [System.IterationPath] under 'Tele2\\Партнеры\\CRM\\АРМ Troubleshooting' and " + @"[System.IterationPath] <> 'Tele2\\Партнеры\\CRM\\Отклоненные' and " + "not [System.Tags] contains 'Интеграция' and not[System.Tags] contains 'Биллинг' and " + "[System.State] <> 'New' and " + "not [System.Tags] contains 'Техническое' and " + "not [System.Tags] contains 'Без разработки' and " + "not [System.Tags] contains 'Орг вопросы' and " + "not [System.Tags] contains 'HLR' and " + "not [System.Tags] contains 'Trash' and " + "[System.Reason] <> 'Отклонено' and " + "not [System.Reason] contains 'Пропала необходимость' " + "ORDER BY [Microsoft.VSTS.Common.ClosedDate] " + "\"" + "}"; streamWriter.Write(jsonTeamAS); streamWriter.Flush(); streamWriter.Close(); } var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); dynamic resultOfQuery; using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { resultOfQuery = streamReader.ReadToEnd(); } Report result = JsonConvert.DeserializeObject <Report>(resultOfQuery); #endregion FinalResult FINAL = new FinalResult(); FINAL.resultItems = new List <ResultItem>(); ResultItem finalResult = new ResultItem(); ItemInfoHelper itemInfoHelper = new ItemInfoHelper(); FINAL.resultItems = itemInfoHelper.getItemInfo(finalResult, result, FINAL); //Считаем LeadTime и BackLogTime для каждой таски foreach (ResultItem i in FINAL.resultItems) { if (i.value[0].fields.ActivatedDate != null && i.value[0].fields.CreatedDate != null) { i.value[0].fields.CreatedDate = i.value[0].fields.CreatedDate.Substring(0, 10); i.value[0].fields.ActivatedDate = i.value[0].fields.ActivatedDate.Substring(0, 10); i.value[0].backlogTime = (int)(DateTime.Parse(i.value[0].fields.ActivatedDate) - DateTime.Parse(i.value[0].fields.CreatedDate)).TotalDays; } if (i.value[0].fields.ClosedDate != null && i.value[0].fields.ActivatedDate != null) { i.value[0].fields.ActivatedDate = i.value[0].fields.ActivatedDate.Substring(0, 10); i.value[0].fields.ClosedDate = i.value[0].fields.ClosedDate.Substring(0, 10); i.value[0].leadTime = (int)(DateTime.Parse(i.value[0].fields.ClosedDate) - DateTime.Parse(i.value[0].fields.ActivatedDate)).TotalDays; } } TaskReportHelper taskReportHelper = new TaskReportHelper(); BacklogReportHelper backlogReportHelper = new BacklogReportHelper(); LeadReportHelper leadReportHelper = new LeadReportHelper(); PlotSet plotResult = new PlotSet(); plotResult.PlotList = new List <PlotData>(); plotResult.PlotList.Add(taskReportHelper.formTaskReport(FINAL, startDate)); plotResult.PlotList.Add(backlogReportHelper.fromBacklogReport(FINAL, stepBacklogTime, startDate)); plotResult.PlotList.Add(leadReportHelper.formLeadReport(FINAL, stepLeadTime, startDate)); return(plotResult); }
void Start() { scoreValue = score.transform.FindDeepGameObject(valueString).GetSafeComponent<Text>(); timeLeftValue = timeLeft.transform.FindDeepGameObject(valueString).GetSafeComponent<Text>(); clearHPValue = clearHP.transform.FindDeepGameObject(valueString).GetSafeComponent<Text>(); totalScoreValue = totalScore.transform.FindDeepGameObject(valueString).GetSafeComponent<Text>(); evaluationSymbolValue = evaluationSymbol.transform.FindDeepGameObject(valueString).GetSafeComponent<Text>(); score.SetActive(false); timeLeft.SetActive(false); clearHP.SetActive(false); evaluationSymbol.SetActive(false); data = GameManager.instance.GetGameData(); //data.score = 60000; //data.timeLeft = 300; //data.clearHP = 200; scoreItem = new ResultItem(score, scoreValue, data.score, scoreFormat, scoreMagnification); timeLeftItem = new ResultItem(timeLeft, timeLeftValue, (int)data.timeLeft, timeFormat, timeLeftMagnification); clearHPItem = new ResultItem(clearHP, clearHPValue, data.clearHP, hpFormat, clearHPMagnification); StartCoroutine(ShowResult()); }
void IExternalControl.WriteResults(ResultItem Item, List <string> Errors) { _IoMain.WriteResults(Item, Errors); }
ResultItem[] CalculateObjects_ObjectsInSpace() { var scene = ParentScene; if (scene != null) { Component_Scene.GetObjectsInSpaceItem item = null; if (ConvexSweepTarget.ReferenceSpecified && (Shape.Value == ShapeEnum.Box || Shape.Value == ShapeEnum.Sphere)) { //Convex sweep test var target = ConvexSweepTarget.Value; if (target != null) { UpdateConvexSweepHull(); if (hullPlanes != null) { item = new Component_Scene.GetObjectsInSpaceItem(Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All, null, false, hullPlanes); } } } else { switch (Shape.Value) { case ShapeEnum.Box: item = new Component_Scene.GetObjectsInSpaceItem(Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All, null, false, GetBox()); break; case ShapeEnum.Sphere: item = new Component_Scene.GetObjectsInSpaceItem(Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All, null, false, GetSphere()); break; case ShapeEnum.Ray: item = new Component_Scene.GetObjectsInSpaceItem(Component_Scene.GetObjectsInSpaceItem.CastTypeEnum.All, null, false, GetRay()); break; } } if (item != null) { scene.GetObjectsInSpace(item); if (item.Result.Length != 0) { var result = new List <ResultItem>(item.Result.Length); for (int n = 0; n < item.Result.Length; n++) { ref var resultItem2 = ref item.Result[n]; var resultItem = new ResultItem(resultItem2.Object, resultItem2.Position, resultItem2.DistanceScale); bool ignore = false; PerformFilterObject(resultItem, ref ignore); if (ignore) { continue; } result.Add(resultItem); if (Mode.Value == ModeEnum.OneClosestObject) { break; } } return(result.ToArray()); } } }
protected override long InsertDevice(ResultItem result, string code, long groupId, Guid profileId, SQLiteTransaction trans) { var deviceSelectCmd = new SQLiteCommand("SELECT D.DEV_ID FROM DEVICES D WHERE D.CODE = @CODE AND D.GROUP_ID = @GROUP_ID AND D.POS = @POS AND D.PROFILE_ID = @PROF_ID", _connection); deviceSelectCmd.Parameters.Add("@CODE", DbType.String); deviceSelectCmd.Parameters.Add("@GROUP_ID", DbType.Int64); deviceSelectCmd.Parameters.Add("@POS", DbType.Boolean); deviceSelectCmd.Parameters.Add("@PROF_ID", DbType.Guid); deviceSelectCmd.Prepare(); deviceSelectCmd.Parameters["@CODE"].Value = code; deviceSelectCmd.Parameters["@GROUP_ID"].Value = groupId; deviceSelectCmd.Parameters["@POS"].Value = (result.Position == 2); deviceSelectCmd.Parameters["@PROF_ID"].Value = profileId; var devId = deviceSelectCmd.ExecuteScalar(); if (devId != null) { var devParamDeleteCmd = new SQLiteCommand("DELETE FROM DEV_PARAM WHERE DEV_ID = @DEV_ID", _connection); devParamDeleteCmd.Parameters.Add("@DEV_ID", DbType.Int64); devParamDeleteCmd.Prepare(); devParamDeleteCmd.Parameters["@DEV_ID"].Value = devId; devParamDeleteCmd.ExecuteNonQuery(); var devErrDeleteCommand = new SQLiteCommand("DELETE FROM DEV_ERR WHERE DEV_ID = @DEV_ID", _connection); devErrDeleteCommand.Parameters.Add("@DEV_ID", DbType.Int64); devErrDeleteCommand.Prepare(); devErrDeleteCommand.Parameters["@DEV_ID"].Value = devId; devErrDeleteCommand.ExecuteNonQuery(); var deviceDeleteCmd = new SQLiteCommand("DELETE FROM DEVICES WHERE DEV_ID = @DEV_ID", _connection); deviceDeleteCmd.Parameters.Add("@DEV_ID", DbType.Int64); deviceDeleteCmd.Prepare(); deviceDeleteCmd.Parameters["@DEV_ID"].Value = devId; deviceDeleteCmd.ExecuteNonQuery(); } var devInsertCommand = new SQLiteCommand("INSERT INTO DEVICES(DEV_ID, GROUP_ID, PROFILE_ID, CODE, SIL_N_1, SIL_N_2, TS, USR, POS, IsSendedToServer, MmeCode) VALUES(NULL, @GROUP_ID, @PROFILE_ID, @CODE, @SIL_N_1, @SIL_N_2, @TS, @USR, @POS, @IsSendedToServer, @MmeCode)", _connection); devInsertCommand.Parameters.Add("@GROUP_ID", DbType.Int64); devInsertCommand.Parameters.Add("@PROFILE_ID", DbType.Guid); devInsertCommand.Parameters.Add("@CODE", DbType.String); devInsertCommand.Parameters.Add("@SIL_N_1", DbType.String); devInsertCommand.Parameters.Add("@SIL_N_2", DbType.String); devInsertCommand.Parameters.Add("@TS", DbType.String); devInsertCommand.Parameters.Add("@USR", DbType.StringFixedLength); devInsertCommand.Parameters.Add("@POS", DbType.Boolean); devInsertCommand.Parameters.Add("@MmeCode", DbType.String); devInsertCommand.Parameters.Add("@IsSendedToServer", DbType.Boolean); devInsertCommand.Prepare(); devInsertCommand.Parameters["@GROUP_ID"].Value = groupId; devInsertCommand.Parameters["@PROFILE_ID"].Value = profileId; devInsertCommand.Parameters["@CODE"].Value = code; devInsertCommand.Parameters["@SIL_N_1"].Value = DBNull.Value; devInsertCommand.Parameters["@SIL_N_2"].Value = DBNull.Value; devInsertCommand.Parameters["@TS"].Value = DateTime.Now.ToString(@"yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); devInsertCommand.Parameters["@USR"].Value = result.User; devInsertCommand.Parameters["@POS"].Value = (result.Position == 2); devInsertCommand.Parameters["@MmeCode"].Value = result.MmeCode; devInsertCommand.Parameters["@IsSendedToServer"].Value = result.IsSentToServer; devInsertCommand.ExecuteNonQuery(); return(_connection.LastInsertRowId); }
private void OnDestroy() { Instance = null; }
/// <summary> /// Adds a result item that may be an error or a warning. /// </summary> /// <param name="resultItem">The message to add.</param> public void AddMessage(ResultItem resultItem) { ParameterCheck.ParameterRequired(resultItem, "message"); if (!_resultItems.Contains(resultItem)) _resultItems.Add(resultItem); }
public PlotSet errorBercutWithOther(DateTime startDate, int stepBacklogTime, int stepLeadTime) { #region Запрос номеров таск из TFS, удовлетворяющих запросу var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://tfs.tele2.ru/tfs/Main/Tele2/_apis/wit/wiql?api-version=3.0"); httpWebRequest.Method = "POST"; httpWebRequest.Credentials = new NetworkCredential("user", "password"); httpWebRequest.ContentType = "application/json; charset=utf-8; api-version=3.0"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { string ErrorBercutWithOther = "{" + "\"query\":" + "\"" + "select[System.Id], " + "[System.CreatedDate], " + "[Microsoft.VSTS.Common.ActivatedDate], " + "[Microsoft.VSTS.Common.ClosedDate], " + "[System.WorkItemType], " + "[System.Title], " + "[System.State], " + "[System.AreaPath], " + "[System.IterationPath], " + "[System.Tags] from WorkItems where " + "[System.TeamProject] = @project and " + "([System.WorkItemType] = 'Ошибка' and " + "[System.CreatedBy] in " + @"('Гордеев Александр Валериевич <T2RU\\a.gordeev>', " + @"'Муратов Михаил Александрович <T2RU\\mikhail.muratov>', " + @"'Юренков Станислав Сергеевич <T2RU\\supp.Dynamics21>', " + @"'Евланов Сергей Леонидович <T2RU\\sergey.evlanov>', " + @"'Семенов Антон Юрьевич <T2RU\\anton.y.semenov>', " + @"'Кораблёва Екатерина Викторовна <T2RU\\supp.Dynamics11>', " + @"'Иванов Арсений Дмитриевич <T2RU\\Supp.Dynamics02>', " + @"'Анисимов Максим Александрович <T2RU\\supp.Dynamics12>', " + @"'Фокин Андрей Геннадьевич <T2RU\\supp.Dynamics19>', " + @"'Свидэрский Николай Сергеевич <T2RU\\nikolay.svidersky>', " + @"'Панфилова Наталья Геннадьевна <T2RU\\natalya.panfilova>', " + @"'Смирнов Фёдор Леонидович <T2RU\\supp.Dynamics20>', " + @"'Большакова Мария Владимировна <T2RU\\supp.Dynamics17>', " + @"'Чубукина Татьяна Сергеевна <T2RU\\Supp.Dynamics10>', " + @"'Нижников Виталий Сергеевич <T2RU\\vitaly.nizhnikov>', " + @"'Недоступ Александр Николаевич <T2RU\\alexander.nedostup>', " + @"'Курилюк Антон Викторович <T2RU\\anton.kurilyuk>', " + @"'Бондарчук Евгений Маркович <T2RU\\Supp.Dynamics08>', " + @"'Чистяков Максим Сергеевич <T2RU\\supp.Dynamics18>', " + @"'Манукян Ашот Каренович <T2RU\\ashot.manukyan>', " + @"'Моисеева Ольга Алексеевна <T2RU\\supp.DSuite29>', " + @"'Струнников Артем Сергеевич <T2RU\\supp.bercut120>', " + @"'Калашников Дмитрий Юрьевич <T2RU\\dmitry.y.kalashnikov>', " + @"'Полях Виктор Васильевич <T2RU\\victor.polyakh>', " + @"'Глушков Сергей Иванович <T2RU\\Supp.Dynamics05>', " + @"'Остапенко Сергей Сергеевич <T2RU\\sergey.ostapenko>', " + @"'Жиряков Дмитрий Владимирович <T2RU\\supp.Dynamics15>', " + @"'Тришечкин Евгений Владимирович <T2RU\\Supp.Dynamics06>', " + @"'Хромина Ольга Анатольевна <T2RU\\olga.khromina>', " + @"'Арсеньева Юлия Андреевна <T2RU\\supp.Dynamics16>', " + @"'Артюков Иван Алексеевич <T2RU\\Supp.Dynamics03>', " + @"'Сибакова Евгения Александровна <T2RU\\evgenia.sibakova>', " + @"'Хрупин Дмитрий Владимирович <T2RU\\dmitry.khrupin>', " + @"'Сологуб Николай Сергеевич <T2RU\\Supp.Dynamics24>') and " + @"[System.AreaPath] in ('Tele2\\Партнеры\\Беркут\\Product testing') and " + "[System.Reason] <> 'Не является ошибкой' and " + "[System.Reason] <> 'Отклонена' and " + "not [System.Tags] contains 'Техническое' and " + "[System.Tags] contains 'Other' or " + "([System.WorkItemType] = 'Ошибка' and " + @"[System.AreaPath] = 'Tele2\\CRM\\CRM Team Bercut' and " + "[System.Reason] <> 'Отклонена' and " + "[System.Reason] <> 'Не является ошибкой' and " + "[System.Tags] contains 'Other' and " + "not [System.Tags] contains 'Техническое')) " + "order by[Microsoft.VSTS.Common.ClosedDate] " + "\"" + "}"; streamWriter.Write(ErrorBercutWithOther); streamWriter.Flush(); streamWriter.Close(); } var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse(); dynamic resultOfQuery; using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { resultOfQuery = streamReader.ReadToEnd(); } Report result = JsonConvert.DeserializeObject <Report>(resultOfQuery); #endregion FinalResult FINAL = new FinalResult(); FINAL.resultItems = new List <ResultItem>(); ResultItem finalResult = new ResultItem(); ItemInfoHelper itemInfoHelper = new ItemInfoHelper(); FINAL.resultItems = itemInfoHelper.getItemInfo(finalResult, result, FINAL); //Считаем LeadTime и BackLogTime для каждой таски foreach (ResultItem i in FINAL.resultItems) { if (i.value[0].fields.ActivatedDate != null && i.value[0].fields.CreatedDate != null) { i.value[0].backlogTime = (int)(DateTime.Parse(i.value[0].fields.ActivatedDate) - DateTime.Parse(i.value[0].fields.CreatedDate)).TotalDays; } if (i.value[0].fields.ClosedDate != null && i.value[0].fields.ActivatedDate != null) { i.value[0].leadTime = (int)(DateTime.Parse(i.value[0].fields.ClosedDate) - DateTime.Parse(i.value[0].fields.ActivatedDate)).TotalDays; } } TaskReportHelper taskReportHelper = new TaskReportHelper(); BacklogReportHelper backlogReportHelper = new BacklogReportHelper(); LeadReportHelper leadReportHelper = new LeadReportHelper(); PlotSet plotResult = new PlotSet(); plotResult.PlotList = new List <PlotData>(); plotResult.PlotList.Add(taskReportHelper.formTaskReport(FINAL, startDate)); plotResult.PlotList.Add(backlogReportHelper.fromBacklogReport(FINAL, stepBacklogTime, startDate)); plotResult.PlotList.Add(leadReportHelper.formLeadReport(FINAL, stepLeadTime, startDate)); return(plotResult); }
public void Constructor_EnumValueGreaterThanZero_IsWarningType() { var item = new ResultItem(1, "message"); item.Type.Should().Be(ResultItemType.Warning); }
private void InsertBvtParameterValues(ResultItem result, long devId, SqlTransaction trans) { for (int i = 0; i < result.BVTTestParameters.Length; i++) { var order = result.BVTTestParameters[i].Order; switch (result.BVTTestParameters[i].MeasurementMode) { case BVTMeasurementMode.ModeI: switch (result.BVTTestParameters[i].TestType) { case BVTTestType.Both: InsertParameterValue(devId, "IDRM", result.BVT[i].IDRM, result.BVT[i].TestTypeId, trans); InsertParameterValue(devId, "IRRM", result.BVT[i].IRRM, result.BVT[i].TestTypeId, trans); break; case BVTTestType.Direct: InsertParameterValue(devId, "IDRM", result.BVT[i].IDRM, result.BVT[i].TestTypeId, trans); break; case BVTTestType.Reverse: InsertParameterValue(devId, "IRRM", result.BVT[i].IRRM, result.BVT[i].TestTypeId, trans); break; } break; case BVTMeasurementMode.ModeV: switch (result.BVTTestParameters[i].TestType) { case BVTTestType.Both: InsertParameterValue(devId, "VDRM", result.BVT[i].VDRM, result.BVT[i].TestTypeId, trans); InsertParameterValue(devId, "VRRM", result.BVT[i].VRRM, result.BVT[i].TestTypeId, trans); break; case BVTTestType.Direct: InsertParameterValue(devId, "VDRM", result.BVT[i].VDRM, result.BVT[i].TestTypeId, trans); break; case BVTTestType.Reverse: InsertParameterValue(devId, "VRRM", result.BVT[i].VRRM, result.BVT[i].TestTypeId, trans); break; } break; } if (result.BVTTestParameters[i].UseUdsmUrsm) { switch (result.BVTTestParameters[i].TestType) { case BVTTestType.Both: InsertParameterValue(devId, "VDSM", result.BVT[i].VDSM, result.BVT[i].TestTypeId, trans); InsertParameterValue(devId, "IDSM", result.BVT[i].IDSM, result.BVT[i].TestTypeId, trans); InsertParameterValue(devId, "VRSM", result.BVT[i].VRSM, result.BVT[i].TestTypeId, trans); InsertParameterValue(devId, "IRSM", result.BVT[i].IRSM, result.BVT[i].TestTypeId, trans); break; case BVTTestType.Direct: InsertParameterValue(devId, "VDSM", result.BVT[i].VDSM, result.BVT[i].TestTypeId, trans); InsertParameterValue(devId, "IDSM", result.BVT[i].IDSM, result.BVT[i].TestTypeId, trans); break; case BVTTestType.Reverse: InsertParameterValue(devId, "VRSM", result.BVT[i].VRSM, result.BVT[i].TestTypeId, trans); InsertParameterValue(devId, "IRSM", result.BVT[i].IRSM, result.BVT[i].TestTypeId, trans); break; } } } }
protected virtual long InsertDevice(string code, long groupId, Guid profileId, ResultItem result, SqlTransaction trans) { _deviceSelectCmd.Transaction = trans; _deviceSelectCmd.Parameters["@CODE"].Value = code; _deviceSelectCmd.Parameters["@GROUP_ID"].Value = groupId; _deviceSelectCmd.Parameters["@POS"].Value = (result.Position == 2); _deviceSelectCmd.Parameters["@PROF_ID"].Value = profileId; var devId = _deviceSelectCmd.ExecuteScalar(); if (devId != null) { _deviceDeleteCmd.Transaction = trans; _deviceDeleteCmd.Parameters["@DEV_ID"].Value = devId; _deviceDeleteCmd.ExecuteNonQuery(); } _devInsertCommand.Transaction = trans; _devInsertCommand.Parameters["@GROUP_ID"].Value = groupId; _devInsertCommand.Parameters["@PROFILE_ID"].Value = profileId; _devInsertCommand.Parameters["@CODE"].Value = code; _devInsertCommand.Parameters["@SIL_N_1"].Value = DBNull.Value; _devInsertCommand.Parameters["@SIL_N_2"].Value = DBNull.Value; _devInsertCommand.Parameters["@TS"].Value = DateTime.Now; _devInsertCommand.Parameters["@USR"].Value = result.User; _devInsertCommand.Parameters["@POS"].Value = (result.Position == 2); _devInsertCommand.Parameters["@MME_CODE"].Value = result.MmeCode; return((int)_devInsertCommand.ExecuteScalar()); }
public void ReplaceAll(string text, string textToReplace, Document doc, SearchFlags flags, SearchScope scope) { lastSettings = null; scanned = null; var items = new List <ResultItem>(); var sw = new Stopwatch(); sw.Start(); var rootEditor = (ITextEditor)App.GetService <IEditorService>().GetEditor(doc.GetType()).Instance; rootEditor.BeginUndoAction(); var startPos = scope == SearchScope.Selection ? rootEditor.SelectionStart : scope == SearchScope.Current ? rootEditor.CaretPosition : 0; var endPos = scope == SearchScope.Selection ? rootEditor.SelectionEnd : 0; for (;;) { var res = Search(text, lastSettings != null ? lastSettings.LastDocument : doc, flags, scope, (d, r) => { var editor = (ITextEditor)App.GetService <IEditorService>().GetEditor(d.GetType()).Instance; var loc = editor.GetLocationFromPosition(d, r.StartPosition); var txt = editor.GetContent(d, loc.Line).TrimStart(' ', '\t'); var item = new ResultItem(txt, d, loc.Line, loc.Column, r.EndPosition - r.StartPosition); var docSrv = App.GetService <IDocumentService>(); if (docSrv.GetActiveDocument() != d) { rootEditor.EndUndoAction(); docSrv.SetActiveDocument(d); editor.BeginUndoAction(); rootEditor = editor; } var sci = editor.Control as ScintillaControl; if (sci != null) { sci.ReplaceText(r.StartPosition, r.EndPosition, textToReplace); } else { editor.ReplaceText(r.StartPosition, r.EndPosition, textToReplace); } lastSettings.LastStartPosition = r.StartPosition; lastSettings.TextToReplace = textToReplace; lastSettings.LastEndPosition = r.StartPosition + textToReplace.Length; if (items.Contains(item)) { return(false); } else { items.Add(item); return(true); } }, true, lastSettings != null ? lastSettings.LastEndPosition : startPos, lastSettings != null ? lastSettings.MaxPosition : endPos, null); if (!res) { break; } } rootEditor.EndUndoAction(); sw.Stop(); var s = (Single)sw.ElapsedMilliseconds / 1000; var svc = App.GetService <IResultGridService>(); svc.AddItems(items); App.OpenView("ResultGrid"); App.GetService <IStatusBarService>().SetStatusString(StatusType.Information, "{0} entries replaced. Replace took: {1:F2} s.", items.Count, s); }
/// <summary> /// Processes the specified query. /// </summary> /// <param name="query">The query.</param> /// <param name="messageContext">The message context.</param> /// <param name="storeContext">The store context.</param> /// <returns>Query Result</returns> internal TQueryResult Process(BaseMultiIndexIdQuery <TQueryResult> query, MessageContext messageContext, IndexStoreContext storeContext) { TQueryResult result; List <ResultItem> resultItemList = new List <ResultItem>(); Dictionary <byte[], IndexHeader> indexIdIndexHeaderMapping = null; bool isTagPrimarySort = false; string sortFieldName = null; List <SortOrder> sortOrderList = null; int totalCount = 0; int additionalAvailableItemCount = 0; GroupByResult groupByResult = null; StringBuilder exceptionInfo = new StringBuilder(); int indexCap = 0; IndexTypeMapping indexTypeMapping = storeContext.StorageConfiguration.CacheIndexV3StorageConfig.IndexTypeMappingCollection[messageContext.TypeId]; try { if (query.IndexIdList.Count > 0) { #region Validate Query ValidateQuery(indexTypeMapping, query, messageContext); #endregion #region Set sort vars Index targetIndexInfo = indexTypeMapping.IndexCollection[query.TargetIndexName]; indexCap = targetIndexInfo.MaxIndexSize; if (query.TagSort != null) { isTagPrimarySort = query.TagSort.IsTag; sortFieldName = query.TagSort.TagName; sortOrderList = new List <SortOrder>(1) { query.TagSort.SortOrder }; } else { isTagPrimarySort = targetIndexInfo.PrimarySortInfo.IsTag; sortFieldName = targetIndexInfo.PrimarySortInfo.FieldName; sortOrderList = targetIndexInfo.PrimarySortInfo.SortOrderList; } BaseComparer baseComparer = new BaseComparer(isTagPrimarySort, sortFieldName, sortOrderList); groupByResult = new GroupByResult(baseComparer); #endregion #region Prepare ResultList CacheIndexInternal targetIndex; IndexIdParams indexIdParam; int maxExtractCount; byte[] metadata; MetadataPropertyCollection metadataPropertyCollection; Dictionary <KeyValuePair <byte[], string>, CacheIndexInternal> internalIndexDictionary = new Dictionary <KeyValuePair <byte[], string>, CacheIndexInternal>(); int maxMergeCount = query.MaxMergeCount; IndexCondition queryIndexCondition = query.IndexCondition; for (int i = 0; i < query.IndexIdList.Count; i++) { #region Extract index and apply criteria indexIdParam = query.GetParamsForIndexId(query.IndexIdList[i]); maxExtractCount = ComputeMaxExtractCount(indexIdParam.MaxItems, query.GetAdditionalAvailableItemCount, indexIdParam.Filter, query.MaxMergeCount); // Note: This should be changed later and just extracted once if it is also requested in GetIndexHeader metadata = null; metadataPropertyCollection = null; if (indexTypeMapping.MetadataStoredSeperately) { IndexServerUtils.GetMetadataStoredSeperately(indexTypeMapping, messageContext.TypeId, messageContext.PrimaryId, query.IndexIdList[i], storeContext, out metadata, out metadataPropertyCollection); } targetIndex = IndexServerUtils.GetCacheIndexInternal(storeContext, messageContext.TypeId, (query.PrimaryIdList != null && i < query.PrimaryIdList.Count) ? query.PrimaryIdList[i] : IndexCacheUtils.GeneratePrimaryId(query.IndexIdList[i]), query.IndexIdList[i], targetIndexInfo.ExtendedIdSuffix, query.TargetIndexName, maxExtractCount, indexIdParam.Filter, true, queryIndexCondition, false, false, targetIndexInfo.PrimarySortInfo, targetIndexInfo.LocalIdentityTagList, targetIndexInfo.StringHashCodeDictionary, query.CapCondition, targetIndexInfo.IsMetadataPropertyCollection, metadataPropertyCollection, query.DomainSpecificProcessingType, storeContext.DomainSpecificConfig, null, query.GroupBy, false); #endregion if (targetIndex != null) { totalCount += targetIndex.OutDeserializationContext.TotalCount; additionalAvailableItemCount += targetIndex.Count; internalIndexDictionary.Add(new KeyValuePair <byte[], string>(query.IndexIdList[i], query.TargetIndexName), targetIndex); SetItemCounter(messageContext.TypeId, targetIndex.OutDeserializationContext); #region Dynamic tag sort if (query.TagSort != null) { targetIndex.Sort(query.TagSort); } #endregion #region Get items from index and merge if (query.GroupBy == null) { MergeAlgo.MergeItemLists(ref resultItemList, CacheIndexInternalAdapter.GetResultItemList(targetIndex, 1, int.MaxValue), query.MaxMergeCount, baseComparer); } else { MergeAlgo.MergeGroupResult(ref groupByResult, targetIndex.GroupByResult, query.MaxMergeCount, baseComparer); } if ((i != query.IndexIdList.Count - 1) && (resultItemList.Count == maxMergeCount)) { AdjustIndexCondition(GetConditionBoundaryBytes(resultItemList, groupByResult, query.GroupBy, isTagPrimarySort, sortFieldName), ref queryIndexCondition, baseComparer); } #endregion } } #endregion #region Subset Processing ProcessSubsets(query, ref resultItemList, ref groupByResult, baseComparer); #endregion #region Get Extra Tags for IndexIds in the list //Note: Getting extra tags from GroupByResult not supported for now if (query.TagsFromIndexes != null && query.TagsFromIndexes.Count != 0) { KeyValuePair <byte[] /*IndexId */, string /*IndexName*/> kvp; CacheIndexInternal additionalCacheIndexInternal; #region Form IndexId - PrimaryId Mapping Dictionary <byte[] /*IndexId */, int /*PrimaryId*/> indexIdPrimaryIdMapping = new Dictionary <byte[] /*IndexId */, int /*PrimaryId*/>(query.IndexIdList.Count, new ByteArrayEqualityComparer()); if (query.PrimaryIdList != null && query.PrimaryIdList.Count > 0) { //Form dictionary of IndexIdPrimaryIdMapping for (int i = 0; i < query.IndexIdList.Count && i < query.PrimaryIdList.Count; i++) { indexIdPrimaryIdMapping.Add(query.IndexIdList[i], query.PrimaryIdList[i]); } } #endregion int indexPrimaryId; foreach (ResultItem resultItem in resultItemList) { foreach (string indexName in query.TagsFromIndexes) { Index indexInfo = indexTypeMapping.IndexCollection[indexName]; kvp = new KeyValuePair <byte[], string>(resultItem.IndexId, indexName); if (!internalIndexDictionary.ContainsKey(kvp)) { additionalCacheIndexInternal = IndexServerUtils.GetCacheIndexInternal(storeContext, messageContext.TypeId, indexIdPrimaryIdMapping.TryGetValue(resultItem.IndexId, out indexPrimaryId) ? indexPrimaryId : IndexCacheUtils.GeneratePrimaryId(resultItem.IndexId), resultItem.IndexId, indexInfo.ExtendedIdSuffix, indexName, 0, null, true, null, false, false, indexInfo.PrimarySortInfo, indexInfo.LocalIdentityTagList, indexInfo.StringHashCodeDictionary, null, indexInfo.IsMetadataPropertyCollection, null, query.DomainSpecificProcessingType, storeContext.DomainSpecificConfig, null, null, false); if (additionalCacheIndexInternal != null) { SetItemCounter(messageContext.TypeId, additionalCacheIndexInternal.OutDeserializationContext); internalIndexDictionary.Add(kvp, additionalCacheIndexInternal); try { IndexServerUtils.GetTags(additionalCacheIndexInternal, resultItem, resultItem); } catch (Exception ex) { LoggingUtil.Log.Error(ex.ToString()); exceptionInfo.Append(" | " + ex.Message); } } } } } } #endregion #region Get IndexHeader if (query.GetIndexHeaderType == GetIndexHeaderType.AllIndexIds) { //Get IndexHeader for all IndexIds indexIdIndexHeaderMapping = new Dictionary <byte[], IndexHeader>(new ByteArrayEqualityComparer()); for (int i = 0; i < query.IndexIdList.Count; i++) { byte[] indexId = query.IndexIdList[i]; CacheIndexInternal targetIndexCacheIndexInternal; if (!indexIdIndexHeaderMapping.ContainsKey(indexId) && internalIndexDictionary.TryGetValue(new KeyValuePair <byte[], string>(indexId, query.TargetIndexName), out targetIndexCacheIndexInternal)) { indexIdIndexHeaderMapping.Add(indexId, GetIndexHeader(internalIndexDictionary, targetIndexCacheIndexInternal, indexId, query, indexTypeMapping, messageContext.TypeId, storeContext, i)); } } } else if (query.GetIndexHeaderType == GetIndexHeaderType.ResultItemsIndexIds) { //Get IndexHeader just for IndexIds present in the result indexIdIndexHeaderMapping = new Dictionary <byte[], IndexHeader>(new ByteArrayEqualityComparer()); if (query.GroupBy == null) { for (int i = 0; i < resultItemList.Count; i++) { ResultItem resultItem = resultItemList[i]; if (!indexIdIndexHeaderMapping.ContainsKey(resultItem.IndexId)) { CacheIndexInternal targetIndexCacheIndexInternal; internalIndexDictionary.TryGetValue(new KeyValuePair <byte[], string>(resultItem.IndexId, query.TargetIndexName), out targetIndexCacheIndexInternal); indexIdIndexHeaderMapping.Add(resultItem.IndexId, GetIndexHeader(internalIndexDictionary, targetIndexCacheIndexInternal, resultItem.IndexId, query, indexTypeMapping, messageContext.TypeId, storeContext, i)); } } } else { foreach (ResultItemBag resultItemBag in groupByResult) { for (int i = 0; i < resultItemBag.Count; i++) { ResultItem resultItem = resultItemBag[i]; if (!indexIdIndexHeaderMapping.ContainsKey(resultItem.IndexId)) { CacheIndexInternal targetIndexCacheIndexInternal; internalIndexDictionary.TryGetValue(new KeyValuePair <byte[], string>(resultItem.IndexId, query.TargetIndexName), out targetIndexCacheIndexInternal); indexIdIndexHeaderMapping.Add(resultItem.IndexId, GetIndexHeader(internalIndexDictionary, targetIndexCacheIndexInternal, resultItem.IndexId, query, indexTypeMapping, messageContext.TypeId, storeContext, i)); } } } } } #endregion #region Get data if (!query.ExcludeData) { DataTierUtil.GetData(resultItemList, groupByResult, storeContext, messageContext, indexTypeMapping.FullDataIdFieldList, query.FullDataIdInfo); } #endregion } result = new TQueryResult { ResultItemList = resultItemList, IndexIdIndexHeaderMapping = indexIdIndexHeaderMapping, TotalCount = totalCount, AdditionalAvailableItemCount = additionalAvailableItemCount, IsTagPrimarySort = isTagPrimarySort, SortFieldName = sortFieldName, SortOrderList = sortOrderList, IndexCap = indexCap, GroupByResult = groupByResult, ExceptionInfo = exceptionInfo.ToString() }; #region Log Potentially Bad Queries if (indexTypeMapping.QueryOverrideSettings != null && indexTypeMapping.QueryOverrideSettings.MaxResultItemsThresholdLog > 0 && resultItemList != null && resultItemList.Count > indexTypeMapping.QueryOverrideSettings.MaxResultItemsThresholdLog) { LoggingUtil.Log.ErrorFormat("Encountered potentially Bad Paged Query with Large Result Set of {0}. AddressHistory: {1}. Query Info: {2}", resultItemList.Count, IndexServerUtils.FormatAddressHistory(messageContext.AddressHistory), FormatQueryInfo(query)); } LoggingUtil.Log.DebugFormat("QueryInfo: {0}, AddressHistory: {1}", FormatQueryInfo(query), IndexServerUtils.FormatAddressHistory(messageContext.AddressHistory)); #endregion SetIndexIdListCounter(messageContext.TypeId, query); } catch (Exception ex) { exceptionInfo.Append(" | " + ex.Message); result = new TQueryResult { ExceptionInfo = exceptionInfo.ToString() }; LoggingUtil.Log.ErrorFormat("TypeId {0} -- Error processing PagedIndexQuery : {1}", messageContext.TypeId, ex); } return(result); }
public void Equals_CompareInstanceToNull_ReturnsFalse() { var item = new ResultItem(-1, "test message1"); item.Equals(null).Should().BeFalse(); }
/// <summary> /// Adds ResultItem to DataGridTable in main UI. /// </summary> /// <param name="item"></param> private void AddDisplayRowItem(ResultItem item) { DataGridTable.Items.Add(item); }
public void Equals_CompareTwoInstanceDifferingResultCodes_ReturnsFalse() { var item = new ResultItem(1, "test message"); var item2 = new ResultItem(-1, "test message"); item.Equals(item2).Should().BeFalse(); }
protected ResultItem(ResultItem item) { Code = item.Code; Content = item.Content; }
public void Equals_CompareTwoInstanceSameContents_ReturnsTrue() { var item = new ResultItem(-1, "test message"); var item2 = new ResultItem(-1, "test message"); item.Equals(item2).Should().BeTrue(); }
public void Test() { Engine.MultiThread = true; Document doc = new Document(); ProjectROV rov = new ProjectROV(doc); doc.Part.Add(rov); doc.DefaultProject.NMethods.m_UseAntiteticPaths = true; int n_sim = 10000; int n_steps = 512; double a = 0.2; double DR = 0.02; double r0 = 0.015; double a1 = 1.0; double sigma1 = 0.01; double a2 = 0.1; double sigma2 = 0.0165; double correlation = 0.6; double maturityOpt = 5.0; double strike = 0.927; double tau = 2.0; ModelParameter PT = new ModelParameter(maturityOpt, "TT"); PT.VarName = "TT"; rov.Symbols.Add(PT); ModelParameter Ptau = new ModelParameter(tau, "tau"); Ptau.VarName = "tau"; rov.Symbols.Add(Ptau); ModelParameter Pa = new ModelParameter(a, "a"); Pa.VarName = "a"; rov.Symbols.Add(Pa); ModelParameter PDR = new ModelParameter(DR, "PDR"); PDR.VarName = "DR"; rov.Symbols.Add(PDR); ModelParameter Pr0 = new ModelParameter(r0, "r0"); Pr0.VarName = "r0"; rov.Symbols.Add(Pr0); ModelParameter Pstrike = new ModelParameter(strike, "strike"); Pstrike.VarName = "strike"; rov.Symbols.Add(Pstrike); AFunction zerorate = new AFunction(rov); zerorate.VarName = "zr"; zerorate.m_IndependentVariables = 1; zerorate.m_Value = (RightValue)("(1-exp(-a*x1))*DR + r0"); rov.Symbols.Add(zerorate); HW2ProcessType pt = new HW2ProcessType(); // Set the short rate process. pt = HW2ProcessType.ShortRate; StocasticProcessHW2 process1 = new StocasticProcessHW2(rov, pt); process1.zero_rate_curve = "@zr"; process1._a = (ModelParameter)a1; process1._b = (ModelParameter)sigma1; rov.Processes.AddProcess(process1); // Set the mean reversion process. pt = HW2ProcessType.Unobservable; StocasticProcessHW2 process2 = new StocasticProcessHW2(rov, pt); process2._a = (ModelParameter)a2; process2._b = (ModelParameter)sigma2; rov.Processes.AddProcess(process2); // Set the correlation. rov.Processes.r[0, 1] = (RightValue)correlation; // Set the discounting. RiskFreeInfo rfi = rov.GetDiscountingModel() as RiskFreeInfo; rfi.ActualizationType = EActualizationType.Stochastic; rfi.m_deterministicRF = (ModelParameter)"@v1"; OptionTree op = new OptionTree(rov); op.PayoffInfo.PayoffExpression = "max(bond(TT;TT+tau;@v1)-strike;0)"; op.PayoffInfo.Timing.EndingTime.m_Value = (RightValue)maturityOpt; op.PayoffInfo.European = true; rov.Map.Root = op; rov.NMethods.Technology = ETechType.T_SIMULATION; rov.NMethods.PathsNumber = n_sim; rov.NMethods.SimulationSteps = n_steps; ROVSolver solver = new ROVSolver(); solver.BindToProject(rov); solver.DoValuation(-1); if (rov.HasErrors) { Console.WriteLine(rov.m_RuntimeErrorList[0]); } Assert.IsFalse(rov.HasErrors); ResultItem price = rov.m_ResultList[0] as ResultItem; double sampleMean = price.value; double sampleDevSt = price.stdDev / Math.Sqrt((double)n_sim); double theoreticalPrice = HW2BondCall(zerorate, maturityOpt, maturityOpt + tau, strike, a1, sigma1, a2, sigma2, correlation); Console.WriteLine("\nTheoretical Price = " + theoreticalPrice.ToString()); Console.WriteLine("Monte Carlo Price = " + sampleMean.ToString()); Console.WriteLine("Standard Deviation = " + sampleDevSt.ToString()); bool result; double fact = 4.0; result = (Math.Abs(sampleMean - theoreticalPrice) < fact * sampleDevSt); Assert.IsTrue(result); }
public void Equals_CompareTwoRefsToSameInstance_ReturnsTrue() { var item = new ResultItem(-1, "test message"); var item2 = item; item.Equals(item2).Should().BeTrue(); }
private void LoadData() { _dict = new Dictionary <string, ResultItem>(); string areaID = this.TargetAreaID; string shopID = this.TargetShopID; bool isFirst = true; SetDateRanges(); _stdStepList = GetStdStepList(areaID); bool isOnlyMainStep = this.ShowSubStep == false; bool useOrigProdVer = this.UseOrigProdVer; var stepWip = _resultCtx.StepWip; foreach (var item in stepWip) { if (areaID != item.AREA_ID) { continue; } if (item.SHOP_ID != shopID && shopID != Consts.ALL) { continue; } if (item.PLAN_DATE < this.QueryStartTime) { continue; } if (item.PLAN_DATE >= this.QueryEndTime) { continue; } if (this.StepComboBox.Text != Consts.ALL && !item.STD_STEP_ID.Contains(this.StepComboBox.Text.ToString())) { continue; } string stepID = item.STEP_ID; string stdStepID = item.STD_STEP_ID; int stepSeq = item.STD_STEP_SEQ; if (isOnlyMainStep) { var stdStep = FindMainStep(item.SHOP_ID, stdStepID); if (stdStep == null) { continue; } stepID = stdStep.STEP_ID; stdStepID = stdStep.STEP_ID; stepSeq = stdStep.STEP_SEQ; } string productVersion = item.PRODUCT_VERSION; if (useOrigProdVer) { productVersion = item.ORIG_PRODUCT_VERSION; } if (isFirst) { foreach (string date in _dayHourList) { ResultItem padding; string dateString = GetDateString(date); string k = item.SHOP_ID + item.PRODUCT_ID + productVersion + item.OWNER_TYPE + stdStepID + dateString; if (_dict.TryGetValue(k, out padding) == false) { padding = new ResultItem(); padding.LINE_ID = item.SHOP_ID; padding.STD_STEP = item.STD_STEP_ID; padding.STEP_SEQ = item.STD_STEP_SEQ; padding.PROD_ID = item.PRODUCT_ID; padding.PROD_VER = productVersion; padding.OWNER_TYPE = item.OWNER_TYPE; padding.DATE_INFO = dateString; padding.WAIT_QTY = 0; padding.RUN_QTY = 0; _dict.Add(k, padding); } } isFirst = false; } ResultItem ri; DateTime planDate = item.PLAN_DATE; DateTime shift = ShopCalendar.ShiftStartTimeOfDayT(planDate); string dateStr2 = GetDateString(planDate); string key = item.SHOP_ID + item.PRODUCT_ID + productVersion + item.OWNER_TYPE + stdStepID + dateStr2; if (_dict.TryGetValue(key, out ri) == false) { ri = new ResultItem(); ri.LINE_ID = item.SHOP_ID; ri.PROD_ID = item.PRODUCT_ID; ri.PROD_VER = productVersion; ri.OWNER_TYPE = item.OWNER_TYPE; ri.STD_STEP = item.STD_STEP_ID; ri.STEP_SEQ = item.STD_STEP_SEQ; ri.DATE_INFO = dateStr2; _dict.Add(key, ri); } ri.WAIT_QTY += Convert.ToSingle(item.WAIT_QTY); ri.RUN_QTY += Convert.ToSingle(item.RUN_QTY); } }
public void ToString_Instance_ReturnsExpectedText() { var item = new ResultItem(-1, "test message"); item.ToString().Should().Be("-1 - test message"); }
/// <summary> /// 項目を一つ表示 /// </summary> /// <param name="item">項目</param> /// <param name="textField">表示エリア</param> /// <param name="waitSconds">表示直後の待機時間</param> /// <param name="value">値</param> /// <param name="format">値を表示する際のフォーマット文字列(string.Formatに準拠)</param> /// <param name="magnification">倍率</param> /// <returns></returns> private IEnumerator ShowResultItem(ResultItem item) { item.item.SetActive(true); item.textField.text = string.Format(item.format, 0); // 1秒あたりの増加量 float incrementValue = (item.value / showCompleteSeconds); float showValue = 0.0f; float total = (float)totalScoreUpdate; while (showValue < item.value) { item.textField.text = string.Format(item.format, (int)showValue); TotalScoreUpdate(total + showValue * item.magnification); showValue += incrementValue * Time.deltaTime; yield return new WaitForSeconds(Time.deltaTime); } // 暫定結果 totalScoreUpdate += item.value * item.magnification; TotalScoreUpdate(totalScoreUpdate); item.textField.text = string.Format(item.format, item.value); yield return new WaitForSeconds(waitSeconds); }
private Dictionary <string, ResultItem> LoadData() { Dictionary <string, ResultItem> items = new Dictionary <string, ResultItem>(); string targetShopID = this.TargetShopID; bool isFirst = true; string targetStdStep = this.TargetStdStep; string areaID = this.TargetAreaID; _stdStepList = GetStdStepList(areaID); //bool isOnlyMainStep = this.ShowSubStep == false; var stepMove = _resultCtx.StepMove; foreach (StepMove item in stepMove) { if (areaID != item.AREA_ID) { continue; } if (targetShopID != Consts.ALL && item.SHOP_ID != targetShopID) { continue; } if (item.PLAN_DATE < this.QueryStartTime) { continue; } if (item.PLAN_DATE >= this.QueryEndTime) { continue; } if (targetStdStep != Consts.ALL && item.STD_STEP_ID != TargetStdStep) { continue; } string shopID = item.SHOP_ID; string productID = item.PRODUCT_ID; string productVersion = item.PRODUCT_VERSION; string ownerType = item.OWNER_TYPE; string stdStep = item.STD_STEP_ID; int stepSeq = item.STD_STEP_SEQ; string eqpID = item.EQP_ID; string eqpGroupID = item.EQP_GROUP_ID; if (isFirst) { foreach (string dayHour in _dayHourList) { string dateString = GetDateString(dayHour); string k = shopID + productID + productVersion + ownerType + stdStep + eqpID + eqpGroupID + dateString; ResultItem padding; if (items.TryGetValue(k, out padding) == false) { padding = new ResultItem(item.SHOP_ID, item.PRODUCT_ID, item.PRODUCT_VERSION, item.OWNER_TYPE, item.STEP_ID, item.STD_STEP_SEQ, item.EQP_ID, item.EQP_GROUP_ID, dateString, 0, 0); items.Add(k, padding); } } isFirst = false; } DateTime planDate = GetPlanDate(item.PLAN_DATE); string dateStr = GetDateString(planDate); string key = shopID + productID + productVersion + ownerType + stdStep + eqpID + eqpGroupID + dateStr; ResultItem ri = null; if (items.TryGetValue(key, out ri) == false) { items.Add(key, ri = new ResultItem(shopID, productID, productVersion, ownerType, stdStep, stepSeq, eqpID, eqpGroupID, dateStr)); } ri.UpdateQty((int)item.IN_QTY, (int)item.OUT_QTY); } return(items); }
/// <summary> /// Process the files, load the RoadSystem then find the shortest path and put the result into ResultItem /// If there is any error then the ResultItem.HasError will be true and ResultItem.Result will be error message /// </summary> /// <param name="filePath"></param> /// <param name="finder"></param> /// <returns></returns> private ResultItem ProcessFile(string filePath, IShortestPathFinder finder) { ResultItem item = null; string filename = Path.GetFileName(filePath); try { // Load RoadSystem RoadSystem system = RoadSystem.LoadFromXml(filePath); // Find the shortest path var result = finder.FindShortestPath(system); // Create ResultItem from the result if (result.Count() == 0) { item = new ResultItem { Filename = filename, Result = "No path found" }; } else { item = new ResultItem { Filename = filename, Result = String.Join(", ", result.Select(node => node.ID.ToString()).ToArray()) }; } } catch (LoadRoadSystemException ex) { // Create ResultItem from error item = new ResultItem { Filename = filename, HasError = true, Result = ex.Message }; } // Return ResultItem return item; }
private void CalBadmark(ResultItem item) { }
public override void ProcessRawData() { try { Log.Debug("Begin Process Data"); Log.Debug("RawData: {0}{1}{0}", DeviceHelper.CRLF, StringData); string[] arrAllPatient = DeviceHelper.SeperatorRawData(StringData, DeviceHelper.VT, DeviceHelper.FS); Log.Debug("Find {0} Patients", arrAllPatient.Length); foreach (string resultItem in arrAllPatient) { try { string[] strResult = resultItem.Split(SegmentSeparator.ToCharArray()); strResult = DeviceHelper.DeleteAllBlankLine(strResult); string ackTempString = string.Empty; foreach (string tempString in strResult) { string[] tempArr = tempString.Split(FieldSeparator); if (tempString.StartsWith(MessageHeaderStr)) { ackTempString = tempString; string tempTestDate = tempArr[6]; TestResult.TestDate = String.Format("{0}/{1}/{2}", tempTestDate.Substring(6, 2), tempTestDate.Substring(4, 2), tempTestDate.Substring(0, 4)); } else if (tempString.StartsWith(MessageObr)) { TestResult.Barcode = tempArr[3]; } else if (tempString.StartsWith(MessageOBX)) { var item = new ResultItem(tempArr[4].Trim(), tempArr[13].Trim(), tempArr[6]); AddResult(item); } } Log.Debug("Begin Import Result"); Log.Debug(ImportResults() ? "Import Result Success" : "Error while import result"); //Send Confirm cho Devcies ackTempString = ackTempString.Replace("ORU^R01", "ACK^R01"); string sendData = string.Format("{0}{1}{2}MSA|AA|1|Message accepted|||0|{3}{4}{5}", DeviceHelper.VT, ackTempString, DeviceHelper.CR, DeviceHelper.CR, DeviceHelper.FS, DeviceHelper.CR); SendStringData(sendData); } catch (Exception ex) { Log.Error("Error While processing Data:\r\n{0}\r\n{1}", resultItem, ex.ToString()); } } ClearData(); } catch (Exception) { ClearData(); } }
/// <summary> /// 上视觉处理 /// </summary> /// <param name="item"></param> private void CalMark(ResultItem item) { if (item.Result.State == Vision.VisionResultState.NG) { this.RunData[item.PCBIndex].MarkData.MarkSuccess = false; for (int i = 0; i < this.RunData[item.PCBIndex].PcsData.Length; ++i) { this.RunData.SetPasteState(item.PCBIndex, i, 4); } MsgHelper.Instance.AddMessage(MsgLevel.Error, "Mark点识别失败!!"); return; } #region 空跑 if (SystemConfig.Instance.General.RunMode == RunMode.TestRun) { if (this.Program.PasteInfos[item.PCBIndex].MarkPtList.Count == 1) { this.RunData[item.PCBIndex].MarkData.Mark1IsCaled = true; this.RunData[item.PCBIndex].MarkData.MarkSuccess = true; } else { if (item.Mark == Mark.Mark点1) { this.RunData[item.PCBIndex].MarkData.Mark1IsCaled = true; } else { this.RunData[item.PCBIndex].MarkData.Mark2IsCaled = true; this.RunData[item.PCBIndex].MarkData.MarkSuccess = true; } } return; } #endregion PointF[] pasteList = new PointF[this.Program.PasteInfos[item.PCBIndex].PasteList.Count]; for (int i = 0; i < pasteList.Length; ++i) { pasteList[i] = this.Program.PasteInfos[item.PCBIndex].PasteList[i].Pos; } if (this.Program.PasteInfos[item.PCBIndex].MarkPtList.Count == 1) // 1个mark点 { #region 单mark计算 PointF markPt = new PointF(); PointF oldMark = this.Program.PasteInfos[item.PCBIndex].MarkPtList[0].Pos; this.MachineEntiy.WroldPt(item.Camera, item.CaptruePos, item.Result.Point, out markPt); this.RunData[item.PCBIndex].MarkData.Mark1 = markPt; this.RunData[item.PCBIndex].MarkData.Mark1IsCaled = true; pasteList = MathHelper.TransformPointsForm1Mark(pasteList, oldMark, markPt); this.RunData[item.PCBIndex].SetPos(pasteList); this.RunData[item.PCBIndex].MarkData.MarkSuccess = true; #endregion } else if (this.Program.PasteInfos[item.PCBIndex].MarkPtList.Count == 2) // 2个mark点 { #region 双mark计算 PointF markPt = new PointF(); this.MachineEntiy.WroldPt(item.Camera, item.CaptruePos, item.Result.Point, out markPt); if (item.Mark == Mark.Mark点1) { this.RunData[item.PCBIndex].MarkData.Mark1 = markPt; this.RunData[item.PCBIndex].MarkData.Mark1IsCaled = true; } else { this.RunData[item.PCBIndex].MarkData.Mark2 = markPt; this.RunData[item.PCBIndex].MarkData.Mark2IsCaled = true; } if (this.RunData[item.PCBIndex].MarkData.Mark1IsCaled && this.RunData[item.PCBIndex].MarkData.Mark2IsCaled) { PointF oldMark1 = new PointF(); PointF oldMark2 = new PointF(); if (this.Program.PasteInfos[item.PCBIndex].MarkPtList[0].MarkID == Mark.Mark点1) { oldMark1 = this.Program.PasteInfos[item.PCBIndex].MarkPtList[0].Pos; } else { oldMark1 = this.Program.PasteInfos[item.PCBIndex].MarkPtList[0].Pos; } if (this.Program.PasteInfos[item.PCBIndex].MarkPtList[1].MarkID == Mark.Mark点2) { oldMark2 = this.Program.PasteInfos[item.PCBIndex].MarkPtList[1].Pos; } else { oldMark2 = this.Program.PasteInfos[item.PCBIndex].MarkPtList[1].Pos; } pasteList = MathHelper.TransformPointsForm2Mark(pasteList, oldMark1, oldMark2, this.RunData[item.PCBIndex].MarkData.Mark1, this.RunData[item.PCBIndex].MarkData.Mark2, ref this.RunData[item.PCBIndex].MarkData.UpAngle); this.RunData[item.PCBIndex].SetPos(pasteList); this.RunData[item.PCBIndex].MarkData.MarkSuccess = true; } #endregion } }
private void CalPanelCode(ResultItem item) { }
private void CalPCSCode(ResultItem item) { }
public IActionResult Competition(int id) { var compet = _context.Competitions.FirstOrDefault(a => a.CompetitionId == id); var data = new Items(); data.CurrentCompId = id; data.CurrentCompFileId = compet.IdFile; data.CurrentCompTime = compet.StartTime; var requests = from T in _context.Teams join CT in _context.CompetitionTeams on T.TeamId equals CT.TeamId where CT.CompetitionId == id where T.IsDeleted != 1 select CT; data.competitionTeam = requests.Distinct().ToList(); data.obstacle = (from OC in _context.ObstacleCompetitions join O in _context.Obstacles on OC.ObstacleId equals O.ObstacleId where OC.CompetitionId == id where OC.IsDeleted != 1 select O).ToList(); List <int> lstOC = (from OC in _context.ObstacleCompetitions where OC.CompetitionId == id select OC.ObstacleCompetitionId ).ToList(); if (DateTime.Now >= compet.StartTime) { foreach (var it in data.competitionTeam) { if (Dict.ListAdmitions.FirstOrDefault(a => a.ID == it.AdmittedId).Name == "допущено") { it.AdmittedId = Dict.ListAdmitions.FirstOrDefault(a => a.Name.Trim().Equals("брали участь")).ID; } if (Dict.ListAdmitions.FirstOrDefault(a => a.ID == it.AdmittedId).Name == "відхилено" || Dict.ListAdmitions.FirstOrDefault(a => a.ID == it.AdmittedId).Name == "не допущено") { it.AdmittedId = Dict.ListAdmitions.FirstOrDefault(a => a.Name.Trim().Equals("не з'явились")).ID; } _context.SaveChanges(); } } var temptest = Dict.dApp.Role; if (Dict.ListType.FirstOrDefault(a => a.ID == compet.IdType).Name.Contains("собист")) { data.Solo = true; } else { data.Solo = false; } data.TeamsLst = new List <TeamsList>(); var temp = (from CT in _context.CompetitionTeams where CT.CompetitionId == id select CT).ToList(); foreach (var item in temp) { var TL = new TeamsList(); TL.team = item; int clTicks = 0; int Spenalty = 0; TL.resItems = new List <ResultItem>(); var tmp = (from ct in _context.CompetitionTeams join pt in _context.TeamPartisipants on ct.TeamId equals pt.TeamId join p in _context.Partisipants on pt.PartisipantId equals p.ParticipantId where ct.CompetitionId == id where pt.TeamId == item.TeamId select p).ToList(); TL.TeamName = (from ct in _context.CompetitionTeams join pt in _context.TeamPartisipants on ct.TeamId equals pt.TeamId join p in _context.Partisipants on pt.PartisipantId equals p.ParticipantId join t in _context.Teams on pt.TeamId equals t.TeamId where ct.CompetitionId == id where pt.TeamId == item.TeamId select t.Name).FirstOrDefault(); foreach (var part in tmp) { var reI = new ResultItem(); reI.partisipantId = part.ParticipantId; reI.Name = part.Name; reI.results = _context.Results.Where(a => a.PartisipantId == part.ParticipantId && lstOC.Contains(a.ObstacleCompetitionId)).ToList(); TL.resItems.Add(reI); } foreach (var it in TL.resItems) { int pen = 0; int calc = 0; foreach (var res in it.results) { pen += res.Penalty; calc += int.Parse(res.Time.Split(":")[0]) * 3600 + int.Parse(res.Time.Split(":")[1]) * 60 + int.Parse(res.Time.Split(":")[2]); } it.penalty = pen; it.clearTime = CalculateTime(calc); it.clearTickles = calc; it.resTickles = calc + pen * 30; it.resTime = CalculateTime(calc + pen * 30); Spenalty += pen; clTicks += calc; } TL.clearTime = CalculateTime(clTicks); TL.resTime = CalculateTime(clTicks + Spenalty * 30); TL.clearTickles = clTicks; TL.resTickles = clTicks + Spenalty * 30; TL.penalty = Spenalty; data.TeamsLst.Add(TL); } data.TeamsLst = data.TeamsLst.OrderBy(a => a.resTickles).ToList(); data.ResultsSolo = new List <ResultItem>(); int i = 1; foreach (var it in data.TeamsLst) { var yyy = _context.CompetitionTeams.FirstOrDefault(a => a.CompetitionTeamId == it.team.CompetitionTeamId); it.team.Position = i; it.team.Penalty = it.penalty; it.team.ResultTime = it.resTime; it.team.ClearTime = it.clearTime; yyy.Position = i; yyy.Penalty = it.penalty; yyy.ResultTime = it.resTime; yyy.ClearTime = it.clearTime; _context.SaveChanges(); foreach (var itt in it.resItems) { data.ResultsSolo.Add(itt); } i++; } i = 1; data.ResultsSolo = data.ResultsSolo.OrderBy(a => a.resTickles).ToList(); foreach (var it in data.ResultsSolo) { it.position = i; i++; } data.TN = new List <DictItem>(); foreach (var it in data.competitionTeam) { var temp1 = new DictItem(); temp1.ID = it.TeamId; temp1.Name = _context.Teams.FirstOrDefault(a => a.TeamId == it.TeamId).Name; data.TN.Add(temp1); } return(View(data)); }
public int Compare(ResultItem x, ResultItem y) { return(Compare((IItem)x, (IItem)y)); }
public void Test() { Engine.MultiThread = true; Document doc = new Document(); ProjectROV rov = new ProjectROV(doc); doc.Part.Add(rov); doc.DefaultProject.NMethods.m_UseAntiteticPaths = true; int n_sim = 100000; int n_steps = 256; double strike = 90.0; double tau = 2.0; double rate = 0.1; double dy = 0.07; ModelParameter pStrike = new ModelParameter(strike, "strike"); pStrike.VarName = "strike"; rov.Symbols.Add(pStrike); AFunction payoff = new AFunction(rov); payoff.VarName = "payoff"; payoff.m_IndependentVariables = 1; payoff.m_Value = (RightValue)("max(x1 - strike ; 0)"); rov.Symbols.Add(payoff); AFunction zrfunc = new AFunction(rov); zrfunc.VarName = "zr"; zrfunc.m_IndependentVariables = 1; zrfunc.m_Value = (RightValue)rate; rov.Symbols.Add(zrfunc); AFunction dyfunc = new AFunction(rov); dyfunc.VarName = "dy"; dyfunc.m_IndependentVariables = 1; dyfunc.m_Value = (RightValue)dy; rov.Symbols.Add(dyfunc); HestonExtendedProcess process = new HestonExtendedProcess(); process.k = (ModelParameter)2.5; process.theta = (ModelParameter)0.4; process.sigma = (ModelParameter)0.2; process.S0 = (ModelParameter)100.0; process.V0 = (ModelParameter)0.3; process.zrReference = (ModelParameter)"@zr"; process.dyReference = (ModelParameter)"@dy"; double discount = Math.Exp(-rate * tau); StochasticProcessExtendible s = new StochasticProcessExtendible(rov, process); rov.Processes.AddProcess(s); // Set the discounting. RiskFreeInfo rfi = rov.GetDiscountingModel() as RiskFreeInfo; rfi.ActualizationType = EActualizationType.RiskFree; rfi.m_deterministicRF = 0.0; OptionTree op = new OptionTree(rov); op.PayoffInfo.PayoffExpression = "payoff(v1a)"; op.PayoffInfo.Timing.EndingTime.m_Value = (RightValue)tau; op.PayoffInfo.European = true; rov.Map.Root = op; rov.NMethods.Technology = ETechType.T_SIMULATION; rov.NMethods.PathsNumber = n_sim; rov.NMethods.SimulationSteps = n_steps; ROVSolver solver = new ROVSolver(); solver.BindToProject(rov); solver.DoValuation(-1); if (rov.HasErrors) { Console.WriteLine(rov.m_RuntimeErrorList[0]); } Assert.IsFalse(rov.HasErrors); ResultItem price = rov.m_ResultList[0] as ResultItem; double samplePrice = discount * price.value; double sampleDevSt = price.stdDev / Math.Sqrt((double)n_sim); // Calculates the theoretical value of the call. Vector param = new Vector(5); param[0] = process.k.V(); param[1] = process.theta.V(); param[2] = process.sigma.V(); param[3] = 0.0; param[4] = process.V0.V(); HestonCall hestonCall = new HestonCall(); double theoreticalPrice = hestonCall.HestonCallPrice(param, process.S0.V(), tau, strike, rate, dy); Console.WriteLine("Theoretical Price = " + theoreticalPrice.ToString()); Console.WriteLine("Monte Carlo Price = " + samplePrice); Console.WriteLine("Standard Deviation = " + sampleDevSt.ToString()); double tol = 4.0 * sampleDevSt; Assert.Less(Math.Abs(theoreticalPrice - samplePrice), tol); }
// 针对一个 key 字符串进行检索 // parameters: // strMatchStyle auto_expand/exact/left 分别是自动截断探索/精确一致/前方一致 // strStyle expand_all_search 表示需要扩展检索。即截断后面若干位以后检索。如果没有这个值,表示使用精确检索 // exact_match 表示精确一致检索。当 exact_match 结合上 expand_all_search 时,中途都是前方一致的,最后一次才会精确一致 // strOutputKey [out]经过加工后的 key。可能和 strKey 内容不同 // return: // -1 出错 // 0 成功 int SearchOneKey( Relation relation, string strKey, // string strStyle, string strMatchStyle, out string strOutputKey, out List<ResultItem> results, out string strError) { strError = ""; results = new List<ResultItem>(); strOutputKey = strKey; if (string.IsNullOrEmpty(strKey) == true) { strError = "strKey 不能为空"; return -1; } #if NO bool bExpandAllSearch = StringUtil.IsInList("expand_all_search", strStyle); bool bExpandSearch = StringUtil.IsInList("expand_search", strStyle); bool bExactMatch = StringUtil.IsInList("exact_match", strStyle); if (bExpandAllSearch == true && bExpandSearch == true) { strError = "strStyle 参数中 expand_all_search 和 expand_search 只能使用其中一个"; return -1; } // 需要执行检索的 key 的数组 // List<string> keys = new List<string>(); List<SearchItem> keys = new List<SearchItem>(); if (bExpandAllSearch == true) { #if NO // 如要实现扩展检索,则先把全部可能的级次的 key 都准备好 for (int i = 1; i < strKey.Length; i++) { keys.Add(strKey.Substring(0, i)); } #endif for (int i = strKey.Length; i > 0; i--) { if (i == strKey.Length) { SearchItem key = new SearchItem(); key.Key = strKey; key.MatchStyle = "exact"; keys.Add(key); } { SearchItem key = new SearchItem(); key.Key = strKey.Substring(0, i); key.MatchStyle = "left"; keys.Add(key); } } } else if (bExpandSearch == true) { // 先检索较长的 key for (int i = strKey.Length; i > 0; i--) { if (i == strKey.Length) { SearchItem key = new SearchItem(); key.Key = strKey; key.MatchStyle = "exact"; key.Style = "stop"; keys.Add(key); } { SearchItem key = new SearchItem(); key.Key = strKey.Substring(0, i); key.MatchStyle = "left"; if (i < strKey.Length) key.Style = "stop"; // 命中则停止探索 else key.Style = ""; // 如果是最长的 key,则不精确检索即便命中也不停止后面的继续探索 keys.Add(key); } } } else { { SearchItem key = new SearchItem(); key.Key = strKey; key.MatchStyle = "exact"; key.Style = "stop"; keys.Add(key); } } #endif List<SearchItem> keys = new List<SearchItem>(); if (strMatchStyle == "exact" || strMatchStyle == "left") { SearchItem key = new SearchItem(); key.Key = strKey; key.MatchStyle = strMatchStyle; // "exact"; key.Style = "stop"; keys.Add(key); } else if (strMatchStyle == "auto_expand") { // 先检索较长的 key for (int i = strKey.Length; i > 0; i--) { if (i == strKey.Length) { SearchItem key = new SearchItem(); key.Key = strKey; key.MatchStyle = "exact"; key.Style = "stop"; keys.Add(key); } { SearchItem key = new SearchItem(); key.Key = strKey.Substring(0, i); key.MatchStyle = "left"; if (i < strKey.Length) key.Style = "stop"; // 命中则停止探索 else key.Style = ""; // 如果是最长的 key,则不精确检索即便命中也不停止后面的继续探索 keys.Add(key); } } } else { strError = "无法识别的 strMatchStyle ["+strMatchStyle+"]"; return -1; } // 用于去重 Hashtable recpath_table = new Hashtable(); { int i = 0; foreach (SearchItem key in keys) { Application.DoEvents(); if (_stop.State != 0) { this.Stopped = true; strError = "中断"; return -1; } // string strPartKey = strKey.Substring(0, i); List<string> temp_results = new List<string>(); // return: // -1 出错 // 0 没有找到 // >0 命中的条数 int nRet = Search(relation.DbName, key.Key, key.MatchStyle, // "left", MaxHitCount + 1, ref temp_results, out strError); if (nRet == -1) return -1; // 去重并加入最后集合 foreach (string s in temp_results) { string strRecPath = ""; string strXml = ""; StringUtil.ParseTwoPart(s, "|", out strRecPath, out strXml); if (recpath_table.ContainsKey(strRecPath) == true) continue; recpath_table.Add(strRecPath, 1); ResultItem item = new ResultItem(); item.RecPath = strRecPath; item.Xml = strXml; results.Add(item); } if (key.Style == "stop" && nRet > 0) { strOutputKey = key.Key; // 实际命中的 key break; } #if NO // 在扩展检索情形下,如果一次检索命中结果超过极限,说明还需要继续检索下一个 key(这是担心结果集不足以概括更下级的类目)。继续检索下去直到一次检索的结果数量小于极限 if (bExpandAllSearch == true && nRet < MaxHitCount + 1) break; #endif i++; } } return 0; }