コード例 #1
0
        public override CommandResult Execute(CommandResult pipeIn)
        {
            string[] attributes = _arguments.Get <StringArgument>("Property").Value.Split(',');

            foreach (ResultRecord result in pipeIn)
            {
                ResultRecord newResult = new ResultRecord();

                foreach (string attr in attributes)
                {
                    if (result.ContainsKey(attr))
                    {
                        newResult.Add(attr, result[attr]);
                    }
                    else
                    {
                        newResult.Add(attr, null);
                    }
                }

                _results.Add(newResult);
            }

            return(_results);
        }
コード例 #2
0
        public static ResultRecord LoadRecord(Stream inputStream)
        {
            ResultRecord result = null;

            ProcessToken(inputStream, token => result = LoadRecord(token));
            return(result);
        }
コード例 #3
0
        void ITestProgressMonitor.EndTest(UnitTest test, UnitTestResult result)
        {
            if (test is UnitTestGroup)
                return;

            testsRun++;
            ResultRecord rec = new ResultRecord ();
            rec.Test = test;
            rec.Result = result;

            resultSummary.Add (result);
            results.Add (rec);

            ShowTestResult (test, result);

            UpdateCounters ();

            double frac;
            if (testsToRun != 0)
                frac = ((double)testsRun / (double)testsToRun);
            else
                frac = 1;

            frac = Math.Min (1, Math.Max (0, frac));

            progressBar.Fraction = frac;
            progressBar.Text = testsRun + " / " + testsToRun;
        }
コード例 #4
0
        private double TryTakeCurrency(string firstCurrency, double preRequiredVolumeFirstCurrency, string secondaryCurrency, double preRequiredSecondaryCurrency, SymbolValue symbolValue, Side sideFirstCurrency)
        {
            double requiredVolumeFirstCurrency = 0.46 * preRequiredVolumeFirstCurrency;
            double requiredSecondaryCurrency   = 0.46 * preRequiredSecondaryCurrency;

            if (requiredVolumeFirstCurrency < 10000 || requiredSecondaryCurrency < 10000)
            {
                return(0);
            }
            Side revertFromFirst = sideFirstCurrency == Side.Buy ? Side.Sell : Side.Buy;

            RemainingVolume rVolume2 = remainingVolume.Single(p => p.Currency == secondaryCurrency && p.Side == revertFromFirst);

            //RemainingVolume rVolume4 = remainingVolume.Single(p => p.Currency == secondaryCurrency && p.Side == sideFirstCurrency);
            //RemainingVolume rVolume3 = remainingVolume.Single(p => p.Currency == firstCurrency && p.Side == revertFromFirst);
            if (rVolume2.Volume < requiredSecondaryCurrency /*|| rVolume4.Volume < requiredSecondaryCurrency || rVolume3.Volume < requiredSecondaryCurrency*/)
            {
                //return Math.Min( Math.Min(rVolume2.Volume, rVolume4.Volume), rVolume3.Volume);
                return(rVolume2.Volume);
            }

            RemainingVolume rVolume = remainingVolume.Single(p => p.Currency == firstCurrency && p.Side == sideFirstCurrency);

            rVolume.Volume  -= requiredVolumeFirstCurrency;
            rVolume2.Volume -= requiredSecondaryCurrency;
            //rVolume3.Volume -= requiredVolumeFirstCurrency;
            //rVolume4.Volume -= requiredSecondaryCurrency;

            ResultRecord rr = new ResultRecord();

            if (symbolValue.Symbol.IsFirstSymbol(firstCurrency))
            {
                rr.Side    = sideFirstCurrency;
                rr.Symbol  = symbolValue.Symbol;
                rr.Volume1 = requiredVolumeFirstCurrency;
                rr.Volume2 = requiredSecondaryCurrency;
            }
            else
            {
                rr.Side    = revertFromFirst;
                rr.Symbol  = symbolValue.Symbol;
                rr.Volume1 = requiredSecondaryCurrency;
                rr.Volume2 = requiredVolumeFirstCurrency;
            }
            rr.ProcentVolumesFromInit = ForexSuite.QuotesManager.ConvertCurrencyEx(rr.Symbol.Currency1, "USD", CalculationPointDateTime, rr.Volume1) / InitAmount;
            rr.Profit = (rr.ProcentVolumesFromInit / symbolValue.Price);
            ResultRecord preResult = ListResultRecord.SingleOrDefault(p => p.Symbol.Currency1 == rr.Symbol.Currency1 && p.Symbol.Currency2 == rr.Symbol.Currency2 && p.Side == rr.Side);

            if (preResult == null)
            {
                ListResultRecord.Add(rr);
            }
            else
            {
                preResult.Volume1 += rr.Volume1;
                preResult.Volume2 += rr.Volume2;
                preResult.Profit  += rr.Profit;
            }
            return(requiredSecondaryCurrency);
        }
コード例 #5
0
        public Result LocateByPath()
        {
            PathAnalysis pa  = new PathAnalysis(virname);
            ResultRecord ans = pa.StartAnalysis(ratioAP, ratioP, ratioAPW);

            Hashtable ht = new Hashtable();

            ht["Version"] = this.virname;
            ht["k"]       = this.k;
            DataTable dt = IbatisHelper.ExecuteQueryForDataTable("queryLocResult", ht);

            dt = JWDCompute(dt);
            if (!ans.GetIsLocated())
            {
                return(new Result(false, ans.GetMsg()));
            }
            else
            {
                string msg = string.Format("定位结果坐标:{0}\n干扰源坐标:{1}\n定位精度:{2}米", ans.GetResLocation(), ans.GetReaLocation(), ans.GetPrecise());
                //return new Result(true, msg, ans);
                return(new Result(true, msg, dt));
            }

            //return new Result(true, "ok", dt);
        }
コード例 #6
0
ファイル: Calculus.cs プロジェクト: Lombiq/Orchard-Voting-API
        public override void Execute(IFunction function, ResultRecord result)
        {
            double value;

            function.Update(result.Value, result.Count, PreviousVote, Vote, out value);
            result.Value = value;
        }
コード例 #7
0
ファイル: Calculus.cs プロジェクト: Lombiq/Orchard-Voting-API
        public override void Execute(IFunction function, ResultRecord result)
        {
            double value;

            function.Delete(result.Value, result.Count, Vote, out value);
            result.Value = value;
            result.Count--;
        }
コード例 #8
0
 private void AddRecordToResults(ResultRecord record)
 {
     AddLineToResults(string.Format("AppId: {0}, RecordId: {1}", record.AppId, record.RecordId));
     foreach (var wrapper in record.Values.WithFieldId())
     {
         AddLineToResults(string.Format("\tFieldId: {0}, Type: {1}, Value: {2}", wrapper.FieldId,
             wrapper.Value.Type, GetResultValueString(wrapper.Value)));
     }
 }
コード例 #9
0
ファイル: Calculus.cs プロジェクト: Lombiq/Orchard-Voting-API
        public override void Execute(IFunction function, ResultRecord result)
        {
            double value;
            var    votes = GetVotes().ToList();

            function.Calculate(votes, result.ContentItemRecord.Id, out value);
            result.Value = value;
            result.Count = votes.Count;
        }
コード例 #10
0
        /// <summary>
        /// Saves a record.
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <ApiResponse <SaveRecordResponse> > SaveRecordAsync(ResultRecord request)
        {
            Arg.IsNotNull(request, nameof(request));

            var path        = UrlHelper.GetSaveRecordPath();
            var saveRequest = request.ToSaveRequest();
            var apiResponse = await PutAsync <SaveRecordResponse>(path, saveRequest);

            return(apiResponse);
        }
コード例 #11
0
 public OnspringUser LoadUser(ResultRecord record)
 {
     return(new OnspringUser
     {
         Username = record.Values[UsernameFieldId]?.AsString,
         FirstName = record.Values[FirstNameFieldId]?.AsString,
         LastName = record.Values[LastNameFieldId]?.AsString,
         Email = record.Values[EmailFieldId]?.AsString,
     });
 }
コード例 #12
0
        /// <summary>
        /// 在主线程中运行的流程测试完成事件响应函数
        /// </summary>
        private void FlowCompleteHandler()
        {
            StopFlowTimer();
            FlowControl.Instance.FlowStatus = FlowControl.FLOW_STATUS_COMPLETE;

            if (FlowControl.Instance.FlowResult == FlowControl.FLOW_RESULT_INIT)
            {
                bool pass = true;
                foreach (FlowItem flowItem in FlowControl.Instance.FlowItemList)
                {
                    if (!flowItem.Item.Property.Disable && !flowItem.IsAuxiliaryItem() && !flowItem.IsPass())
                    {
                        pass = false;
                        break;
                    }
                }

                FlowControl.Instance.FlowResult = pass ? FlowControl.FLOW_RESULT_PASS : FlowControl.FLOW_RESULT_FAIL;
            }
            else if (FlowControl.Instance.FlowResult == FlowControl.FLOW_RESULT_EXCEPTION)
            {
                //复位设备
                string resp;
                EquipmentCmd.Instance.SendCommand(CommonString.CMD_RESET, String.Empty, out resp);
            }

            ShowResult();

            if (FlowControl.Instance.FlowResult == FlowControl.FLOW_RESULT_FAIL)
            {
                Statistic.Instance.IncreaseFailNum();
            }
            Statistic.Instance.IncreaseTotalNum();

            UpdateStatisticInfo();
            Statistic.Instance.Save();

            if (FlowControl.Instance.FlowCompleteReason != FlowControl.FLOW_COMPLETE_STOP)
            {
                ResultRecord.Record(AppInfo.PhoneInfo.SN);

                if (0 == NetUtil.GetStationIndex())
                {
                    CompleteHandler(0);
                }
                else
                {
                    LiteDataClient.Instance.SendCompleteFlag(NetUtil.GetStationIndex());
                }
            }

            TimeLog.Save();

            DataReport.Save();
        }
コード例 #13
0
        private static ResultRecord LoadRecord(JToken recordJson)
        {
            var record = new ResultRecord
            {
                AppId    = (int)recordJson["AppId"],
                RecordId = (int)recordJson["RecordId"],
            };
            var fieldArray = (JArray)recordJson["FieldData"];

            LoadFieldValueContainer(record.Values, fieldArray);
            return(record);
        }
コード例 #14
0
        public override CommandResult Execute(CommandResult pipeIn)
        {
            string[] attributes = _arguments.Get <StringArgument>("Property").Value.Split(',');
            int      first      = _arguments.Get <IntegerArgument>("First").Value;

            if (pipeIn == null)
            {
                return(null);
            }

            bool wildcardSelect = attributes[0] == "*";
            bool firstSet       = first > 0;

            int counter = 0;

            foreach (ResultRecord result in pipeIn)
            {
                // Obey -First [int32] parameter and break if number is reached
                if (firstSet && counter == first)
                {
                    break;
                }

                // If all attributes need to be taken
                if (wildcardSelect)
                {
                    _results.Add(result);
                }
                // If specific attributes are selected
                else
                {
                    ResultRecord newResult = new ResultRecord();

                    foreach (string attr in attributes)
                    {
                        if (result.ContainsKey(attr))
                        {
                            newResult.Add(attr, result[attr]);
                        }
                        else
                        {
                            newResult.Add(attr, null);
                        }
                    }

                    _results.Add(newResult);
                }

                counter++;
            }

            return(_results);
        }
コード例 #15
0
        /// <summary>
        /// Кнопка ответа
        /// </summary>
        private void AnsverButtonClick(object sender, EventArgs e)
        {
            int current = Convert.ToInt32(QuestCount_label.Text);

            current--;
            QuestCount_label.Text = current.ToString();
            var    res = new ResultRecord();
            string s   = "";
            int    ida = 0;

            // Если ответ выбран
            if (Ansvers_listBox.SelectedItem != null)
            {
                s = (string)Ansvers_listBox.SelectedItem;
                foreach (var r in _q.Ansvers)
                {
                    if (s == r.Text)
                    {
                        ida = r.ID;
                    }
                }

                // заполнение результата
                res.TestID = _tf.ID;
                res.Ans    = ida;
                res.Trues  = _q.TrueAnsverID;
                res.Quest  = _q.ID;
                res.UserID = DataBase.UserId;
                _results.Add(res);

                // Следующий вопрос
                _q = _tf.GetNextQuestion();

                if (_q.QuestionImage != null && _q.QuestionImage.Length > 0)
                {
                    var ms = new MemoryStream(_q.QuestionImage);
                    ms.Seek(0, SeekOrigin.Begin);
                    pictureBox1.Image = System.Drawing.Image.FromStream(ms);
                }
                else
                {
                    pictureBox1.Image = null;
                }

                textBox1.Text = _q.Name;
                Ansvers_listBox.Items.Clear();
                for (int i = 0; i < _q.Count; i++)
                {
                    Ansvers_listBox.Items.Add(_q[i]);
                }
            }
        }
コード例 #16
0
        public Result LocateByPath()
        {
            PathAnalysis pa  = new PathAnalysis(virname);
            ResultRecord ans = pa.StartAnalysis(ratioAP, ratioP, ratioAPW);

            if (!ans.GetIsLocated())
            {
                return(new Result(false, ans.GetMsg()));
            }
            else
            {
                string msg = string.Format("定位结果坐标:{0}\n干扰源坐标:{1}\n定位精度:{2}米", ans.GetResLocation(), ans.GetReaLocation(), ans.GetPrecise());
                return(new Result(true, msg, ans));
            }
        }
コード例 #17
0
        /// <summary>
        /// 重装流程
        /// </summary>
        private void ReloadFlowTest()
        {
            if (FlowControl.Instance.FlowStatus == FlowControl.FLOW_STATUS_COMPLETE)
            {
                FlowControl.Instance.Reload();
                flowGridView.Rows.Clear();
                LoadFlowItemList();
                ShowSN(string.Empty);
                InitStatusStrip();
                ResultRecord.Clear();

                FlowControl.Instance.FlowStatus         = FlowControl.FLOW_STATUS_INIT;
                FlowControl.Instance.FlowCompleteReason = FlowControl.FLOW_COMPLETE_NORMAL;
                FlowControl.Instance.FlowResult         = FlowControl.FLOW_RESULT_INIT;
            }
        }
コード例 #18
0
        private void DoSearch(object ignore)
        {
            var _Results = new ObservableCollection <ResultRecord>();

            try
            {
                DataTable dtTank = FLS.Business.BusinessHelper.ListTankDetails(_TankId, CurrentTankDetails.FromDate, CurrentTankDetails.ToDate);
                foreach (DataRow _row in dtTank.Rows)
                {
                    ResultRecord _rr = new ResultRecord();
                    _rr.Capacity      = Convert.ToDouble(_row["capacity"]);
                    _rr.Thermo        = Convert.ToDouble(_row["thermo"]);
                    _rr.WaterCapacity = Convert.ToDouble(_row["water"]);
                    _rr.Savedtime     = Convert.ToDateTime(_row["savedtime"]);
                    _rr.bStatus       = Convert.ToByte(_row["status"]);

                    if (_rr.bStatus == 0)
                    {
                        if (lastRecord.bStatus == 0)
                        {
                            _rr.Status  = @"Selling";
                            _rr.Details = String.Format(@"Thời điểm {0}, Nhiên liệu: {1:F1}, Nước: {2:F1}, Nhiệt độ: {3}",
                                                        _rr.Savedtime, _rr.Capacity, _rr.WaterCapacity, _rr.Thermo);
                        }
                        else
                        {
                            _rr.Status  = @"Kết thúc nhập";
                            _rr.Details = String.Format(@"Thời điểm {0}, Nhiên liệu: {1:F1}, Nước: {2:F1}, Nhiệt độ: {3}{6}Tổng lượng nhập: Nhiên liệu: {4:F1}, Nước: {5:F1}",
                                                        _rr.Savedtime, _rr.Capacity, _rr.WaterCapacity, _rr.Thermo, _rr.Capacity - lastRecord.Capacity, _rr.WaterCapacity - lastRecord.WaterCapacity, Environment.NewLine);
                        }
                    }
                    else if (_rr.bStatus == 1)
                    {
                        _rr.Status  = @"Bắt đầu nhập";
                        _rr.Details = String.Format(@"Thời điểm {0}, Nhiên liệu: {1:F1}, Nước: {2:F1}, Nhiệt độ: {3}",
                                                    _rr.Savedtime, _rr.Capacity, _rr.WaterCapacity, _rr.Thermo);
                    }
                    lastRecord = _rr;
                    _Results.Add(_rr);
                }
                Results = _Results;
            }
            catch (Exception ex)
            {
                App.Log.LogException(ex);
            }
        }
コード例 #19
0
        public Stream DownloadResultText(ResultRecord result)
        {
            this.SecurityToken.Validate();             // may throw 'UnauthorizedAccessException'

            using (HttpClient client = new HttpClient())
            {
                client.SetCopyleaksClient(HttpContentTypes.Json, this.SecurityToken);

                HttpResponseMessage msg = client.GetAsync(result.CachedVersion).Result;
                if (!msg.IsSuccessStatusCode)
                {
                    throw new CommandFailedException(msg);
                }

                return(msg.Content.ReadAsStreamAsync().Result);
            }
        }
コード例 #20
0
 private void AddCommonReport(ResultRecord resultRecord)
 {
     ClientUICommon.syncContext.Post(o =>
     {
         PartResultRecord prRecord = new PartResultRecord();
         prRecord.IsPass           = resultRecord.IsPass? "合格" : "不合格";
         prRecord.MeasDateTime     = resultRecord.MeasDateTime;
         prRecord.PartID           = resultRecord.PartID;
         prRecord.PartNumber       = resultRecord.PartNumber.ToString();
         prRecord.ReportFileName   = resultRecord.CmmFileName;
         prRecord.RptFileName      = resultRecord.RptFileName;
         prRecord.ServerID         = resultRecord.ServerID.ToString();
         prRecord.ReportFilePath   = resultRecord.FilePath;
         prRecord.PcProgram        = resultRecord.MeasProgram;
         resultRecordList.Add(prRecord);
         //dataGridView1.InvalidateRow(resultRecordList.Count - 1);
     }, null);
 }
コード例 #21
0
        /// <summary>
        /// Converts the <see cref="ResultRecord"/> to a <see cref="SaveRecordRequest"/>.
        /// </summary>
        /// <returns></returns>
        public static SaveRecordRequest ToSaveRequest(this ResultRecord record)
        {
            if (record == null)
            {
                return(null);
            }

            int?recordId    = record.RecordId == default ? (int?)null : record.RecordId;
            var fields      = record.FieldData.ToDictionary(f => f.FieldId, f => f.GetValue());
            var saveRequest = new SaveRecordRequest
            {
                AppId    = record.AppId,
                RecordId = recordId,
                Fields   = fields,
            };

            return(saveRequest);
        }
コード例 #22
0
        public override CommandResult Execute(CommandResult pipeIn)
        {
            string[] properties = _arguments.Get <StringArgument>("Property").Value.Split(',');

            _results.Output = CommandResult.OutputType.List;

            if (pipeIn == null)
            {
                return(null);
            }

            foreach (ResultRecord result in pipeIn)
            {
                // Show all columns
                if (properties[0] == string.Empty)
                {
                    _results.Add(result);
                }

                // Show only specific columns
                else
                {
                    ResultRecord newResult = new ResultRecord();

                    foreach (string attr in properties)
                    {
                        if (result.ContainsKey(attr))
                        {
                            newResult.Add(attr, result[attr]);
                        }
                        else
                        {
                            newResult.Add(attr, null);
                        }
                    }

                    _results.Add(newResult);
                }
            }

            ResultPrinter.OutputResults(_results);

            return(_results);
        }
コード例 #23
0
        void ITestProgressMonitor.EndTest(UnitTest test, UnitTestResult result)
        {
            if (test is UnitTestGroup)
            {
                return;
            }

            testsRun++;
            ResultRecord rec = new ResultRecord();

            rec.Test   = test;
            rec.Result = result;

            resultSummary.Add(result);
            results.Add(rec);

            ShowTestResult(test, result);

            UpdateCounters();

            double frac;

            if (testsToRun != 0)
            {
                frac = ((double)testsRun / (double)testsToRun);
            }
            else
            {
                frac = 1;
            }

            if (frac < 0)
            {
                frac = 0;
            }
            else if (frac > 1)
            {
                frac = 1;
            }

            progressBar.Fraction = frac;
            progressBar.Text     = testsRun + " / " + testsToRun;
        }
コード例 #24
0
        public ComparisonReport DownloadResultComparison(ResultRecord result)
        {
            this.SecurityToken.Validate();             // may throw 'UnauthorizedAccessException'
            string json;

            using (HttpClient client = new HttpClient())
            {
                client.SetCopyleaksClient(HttpContentTypes.Json, this.SecurityToken);

                HttpResponseMessage msg = client.GetAsync(result.ComparisonReport).Result;
                if (!msg.IsSuccessStatusCode)
                {
                    throw new CommandFailedException(msg);
                }

                json = msg.Content.ReadAsStringAsync().Result;
            }
            return(JsonConvert.DeserializeObject <ComparisonReport>(json));
        }
コード例 #25
0
        private static Match MatchDate(ResultRecord result, string key)
        {
            if (!result.ContainsKey(key))
            {
                return(null);
            }

            Regex           dateRegex  = new Regex("([0-9]{4})([01][0-9])([012][0-9])([0-9]{2})([0-9]{2})([0-9]{2})");
            MatchCollection allMatches = dateRegex.Matches(result[key]);

            if (allMatches.Count > 0)
            {
                return(allMatches[0]);
            }
            else
            {
                return(null);
            }
        }
コード例 #26
0
        public void PullReport()
        {
            //State = ClientState.CS_Busy;
            // 获取当前的cmm和rpt报告文件
            int partCount;

            _resultRecord = null;
            _resultRecord = new ResultRecord();
            lock (syncObj)
            {
                partCount = _partNbSet[CurPartId]; // 获得标识的工件个数
                _resultRecord.PartNumber = ++partCount;
            }
            _resultRecord.PartID       = CurPartId;
            _resultRecord.IsPass       = IsPass;
            _resultRecord.ServerID     = CmmSvrConfig.ServerID;
            _resultRecord.MeasDateTime = DateTime.Now;
            _resultRecord.MeasProgram  = PartConfigManager.Instance.GetPartConfig(CurPartId).ProgFileName;
            bool ok = DownFileFromServer("cmm");

            if (!ok)
            {
                // 更新用户界面
                State = ClientState.CS_Error;
                //ClientUICommon.RefreshCmmViewState(CmmSvrConfig.ServerID, State);
                ClientUICommon.RefreshCmmEventLog("下载结果文件出错");
                return;
            }
            ok = DownFileFromServer("rpt");
            if (!ok)
            {
                // 更新用户界面
                State = ClientState.CS_Error;
                //ClientUICommon.RefreshCmmViewState(CmmSvrConfig.ServerID, State);
                ClientUICommon.RefreshCmmEventLog("下载结果文件出错");
                return;
            }
            // 添加报告记录,并且更改成可继续测量状态
            resultRecords.Add(_resultRecord);
            //ClientUICommon.AddPartResult(_resultRecord);
            State = ClientState.CS_Grip;
        }
コード例 #27
0
        private async void BleDevice_ResultEvent(BleEditor.ValueParserResult data)
        {
            if (data.Result == BleEditor.ValueParserResult.ResultValues.Ok)
            {
                await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
                {
                    var valueList = data.ValueList;

                    var record = new ResultRecord();

                    var Result = valueList.GetValue("Result");
                    if (Result.CurrentType == BCBasic.BCValue.ValueType.IsDouble || Result.CurrentType == BCBasic.BCValue.ValueType.IsString)
                    {
                        record.Result      = (string)Result.AsString;
                        Result_Result.Text = record.Result.ToString(); // "N0"); // either N or F3 based on DEC HEX FIXED. hex needs conversion to int first?
                    }

                    var addResult = ResultRecordData.AddRecord(record);
                });
            }
        }
コード例 #28
0
        private void BuildReviews(ReviewsPart part, ResultRecord currentVotingResult, IUser currentUser)
        {
            IEnumerable <VoteRecord>   voteRecords   = _votingService.Get(p => p.ContentItemRecord.Id == part.ContentItem.Id);
            IEnumerable <ReviewRecord> reviewRecords = _reviewRepository.Fetch(r => r.ContentItemRecordId == part.ContentItem.Id);
            IEnumerable <Review>       reviews       =
                from v in voteRecords
                join r in reviewRecords on v.Id equals r.VoteRecordId
                select new Review {
                Id         = r.Id,
                Comment    = r.Comment,
                CreatedUtc = r.CreatedUtc,
                Rating     = new Rating {
                    CurrentVotingResult = currentVotingResult, UserRating = v.Value
                },
                UserName             = v.Username,
                IsCurrentUsersReview = currentUser != null ? v.Username == currentUser.UserName : false
            };

            part.Reviews.AddRange(reviews.OrderByDescending(r => r.IsCurrentUsersReview).ThenByDescending(r => r.CreatedUtc));
            part.UserHasReviewed = currentUser != null && part.Reviews.Any(r => r.UserName == currentUser.UserName);
        }
コード例 #29
0
        private static void AddTrip(List <ResultRecord> records, int paraBusNo, BusStop paraBoardStop, BusStop paraAlightStop)
        {
            TripRecord tripRecord = new TripRecord()
            {
                boardStop = paraBoardStop, alightStop = paraAlightStop
            };

            if (records.FindIndex(item => item.busNo == paraBusNo) < 0)
            {
                ResultRecord resultRecord = new ResultRecord()
                {
                    busNo = paraBusNo, trips = new HashSet <TripRecord>()
                };
                resultRecord.trips.Add(tripRecord);
                records.Add(resultRecord);
            }
            else
            {
                HashSet <TripRecord> trips = records.Find(item => item.busNo == paraBusNo).trips;
                trips.Add(tripRecord);
            }
        }
コード例 #30
0
 private void RefreshRackView(ResultRecord result, int slotNumber)
 {
     // 刷新块架报告
     ClientUICommon.syncContext.Post(o =>
     {
         if (slotNumber <= 0)
         {
             return;
         }
         int pos = slotNumber - 1;
         RackResultRecordList[pos].PartID         = result.PartID;
         RackResultRecordList[pos].IsPass         = result.IsPass ? "合格" : "不合格";
         RackResultRecordList[pos].ServerID       = result.ServerID.ToString();
         RackResultRecordList[pos].ReportFileName = result.CmmFileName;
         RackResultRecordList[pos].RptFileName    = result.RptFileName;
         RackResultRecordList[pos].ReportFilePath = result.FilePath;
         RackResultRecordList[pos].PartNumber     = result.PartNumber.ToString();
         RackResultRecordList[pos].MeasDateTime   = result.MeasDateTime;
         RackResultRecordList[pos].PcProgram      = result.MeasProgram;
         ResultView.InvalidateRow(pos);
         //resultRecordList.Add(new PartResultRecord(RackResultRecordList[pos]));
         //dataGridView1.InvalidateRow(resultRecordList.Count - 1);
     }, null);
 }
コード例 #31
0
		void ITestProgressMonitor.EndTest (UnitTest test, UnitTestResult result)
		{
			if (test is UnitTestGroup)
				return;
			
			testsRun++;
			ResultRecord rec = new ResultRecord ();
			rec.Test = test;
			rec.Result = result;
			
			resultSummary.Add (result);
			results.Add (rec);
			
			ShowTestResult (test, result);
			
			UpdateCounters ();

			double frac;
			if (testsToRun != 0)
				frac = ((double)testsRun / (double)testsToRun);
			else
				frac = 1;

			frac = Math.Min (1, Math.Max (0, frac));

			progressBar.Fraction = frac;
			progressBar.Text = testsRun + " / " + testsToRun;
		}
コード例 #32
0
ファイル: NluMgr.cs プロジェクト: MedStarSiTEL/UnityTrauma
	public void AnalyzeGoldenPath( List<NluMgr.match_record> list )
	{
		GoldenPathResults = new List<ResultRecord>();
		
		foreach( NluMgr.match_record record in list )
		{
			ResultRecord rr = new ResultRecord();
#if RESULT_INCLUDE_RECORD
			rr.Record = record;
#endif
			rr.Input = record.input;
			rr.Command = record.sim_command;
			
			// get sim command and subject
            // no subject, find someone to do the command
            List<ObjectInteraction> objects = ObjectInteractionMgr.GetInstance().GetEligibleObjects(record.sim_command);
			if ( objects.Count > 0 )
			{
				bool found = false;
				foreach( ObjectInteraction obj in objects )
				{
					if ( obj.Name == record.command_subject )
					{
						rr.Result = "command interaction found for subject '" + record.command_subject + "'";
						rr.Feedback = record.feedback;
						rr.Avatar = record.command_subject;
						rr.Ok = true;
						found = true;
					}
				}
				if ( found == false )
				{
					if ( record.command_subject == "" || record.command_subject == null )
						rr.Result = "command interaction found but no command_subject";
					else
						rr.Result = "command interaction found for subject '" + record.command_subject + "' not found";
					rr.Feedback = record.feedback;
					rr.Avatar = record.command_subject;
					rr.Ok = false;
				}
			}
			else
			{
				if ( record.sim_command.Contains("PLAYER") == true )
				{
					rr.Result = "command is for player";
					rr.Feedback = record.feedback;
					rr.Avatar = record.command_subject;
					rr.Ok = true;
				}
				else
				{
					rr.Result = "no avatar to play this command";
					rr.Feedback = record.feedback;
					rr.Avatar = record.command_subject;
					rr.Ok = false;
				}
			}
			
#if RESULT_ONLY_IF_BAD
			if ( rr.Ok == false && rr.Command != "BAD:COMMAND")
				GoldenPathResults.Add(rr);
#endif
		}
		// we're done, save the file
		Serializer<List<ResultRecord>> serializer = new Serializer<List<ResultRecord>>();
		serializer.Save("GoldenPathResults.xml",GoldenPathResults);
	}
コード例 #33
0
        void ITestProgressMonitor.EndTest(UnitTest test, UnitTestResult result)
        {
            if (test is UnitTestGroup)
                return;

            testsRun++;
            ResultRecord rec = new ResultRecord ();
            rec.Test = test;
            rec.Result = result;

            if (result.IsFailure) {
                testsFailed++;
            }
            if (result.IsIgnored) {
                testsIgnored++;
            }
            results.Add (rec);

            ShowTestResult (test, result);

            UpdateCounters ();
            progressBar.Fraction = ((double)testsRun / (double)testsToRun);
            progressBar.Text = testsRun + " / " + testsToRun;
        }