/// <summary>
            /// Receives tracking events.  Instance terminated events are written to the event log.
            /// </summary>
            protected override void Send(TrackingRecord record)
            {
                WorkflowTrackingRecord instanceTrackingRecord = record as WorkflowTrackingRecord;

                if ((null == instanceTrackingRecord) || (TrackingWorkflowEvent.Terminated != instanceTrackingRecord.TrackingWorkflowEvent))
                {
                    return;
                }

                // Create an EventLog instance and assign its source.
                EventLog log = new EventLog();

                log.Source = sourceValue;

                // Write an informational entry to the event log.
                TrackingWorkflowTerminatedEventArgs terminatedEventArgs = instanceTrackingRecord.EventArgs as TrackingWorkflowTerminatedEventArgs;

                StringBuilder message = new StringBuilder(512);

                message.AppendLine(string.Format(System.Globalization.CultureInfo.InvariantCulture, "Workflow instance {0} has been terminated.", parametersValue.InstanceId.ToString()));
                message.AppendLine();

                if (null != terminatedEventArgs.Exception)
                {
                    message.AppendLine(terminatedEventArgs.Exception.ToString());
                }

                log.WriteEntry(message.ToString(), EventLogEntryType.Warning);
            }
        protected override void Send(TrackingRecord record)
        {
            //Process.GetCurrentProcess().MachineName
            //System.Threading.Thread.CurrentThread.ManagedThreadId

            ActivityTrackingRecord activityTrackingRecord = record as ActivityTrackingRecord;

            if (activityTrackingRecord != null)
            {
                WorkflowEnvironment.WorkBatch.Add(this,
                                                  BuildSerializableActivityTrackRecord(activityTrackingRecord));
                return;
            }
            WorkflowTrackingRecord workflowTrackingRecord = record as WorkflowTrackingRecord;

            if (workflowTrackingRecord != null)
            {
                WorkflowEnvironment.WorkBatch.Add(this,
                                                  BuildSerializableWorkFlowTrackRecord(workflowTrackingRecord));
                return;
            }


            UserTrackingRecord userTrackingRecord = record as UserTrackingRecord;

            //TrackingRecord userTrackingRecord = record as UserTrackingRecord;
            if (record is UserTrackingRecord)
            {
                WorkflowEnvironment.WorkBatch.Add(this, record);

                //Debug.WriteLine(((UserTrackingRecord)record).UserData);
            }
        }
        //On Tracing Record Received call the TrackingRecordReceived with the record received information from the TrackingParticipant.
        //We also do not worry about Expressions' tracking data
        protected void OnTrackingRecordReceived(TrackingRecord record, TimeSpan timeout)
        {
            System.Diagnostics.Debug.WriteLine(
                String.Format("Tracking Record Received: {0} with timeout: {1} seconds.", record, timeout.TotalSeconds)
                );

            if (TrackingRecordReceived != null)
            {
                ActivityStateRecord activityStateRecord = record as ActivityStateRecord;

                if ((activityStateRecord != null) && (!activityStateRecord.Activity.TypeName.Contains("System.Activities.Expressions")))
                {
                    if (ActivityIdToWorkflowElementMap.ContainsKey(activityStateRecord.Activity.Id))
                    {
                        TrackingRecordReceived(this, new TrackingEventArgs(
                                                   record,
                                                   timeout,
                                                   ActivityIdToWorkflowElementMap[activityStateRecord.Activity.Id]
                                                   )

                                               );
                    }
                }
                else
                {
                    TrackingRecordReceived(this, new TrackingEventArgs(record, timeout, null));
                }
            }
        }
 protected override void Track(TrackingRecord record, TimeSpan timeout)
 {
     if (Received != null)
     {
         Received.BeginInvoke(record, BeginInvokeCallback, Received);
     }
 }
Beispiel #5
0
        protected override void Track(TrackingRecord record, TimeSpan timeout)
        {
            Contract.Assert(null != record);
            Contract.Assert(null != timeout);

            if (record is ActivityStateRecord)
            {
                LogActivityRecord((ActivityStateRecord)record);
            }
            else if (record is WorkflowInstanceRecord)
            {
                LogWorkflowRecord((WorkflowInstanceRecord)record);
            }
            else if (record is BookmarkResumptionRecord)
            {
                LogBookmarkRecord((BookmarkResumptionRecord)record);
            }
            else if (record is ActivityScheduledRecord)
            {
                LogActivityScheduledRecord((ActivityScheduledRecord)record);
            }
            else if (record is CancelRequestedRecord)
            {
                LogCancelRequestedRecord((CancelRequestedRecord)record);
            }
            else if (record is FaultPropagationRecord)
            {
                LogFaultPropagationRecord((FaultPropagationRecord)record);
            }
            else
            {
                LogCustomRecord((CustomTrackingRecord)record);
            }
        }
Beispiel #6
0
        protected override void Track(TrackingRecord record, TimeSpan timeout)
        {
            Console.WriteLine();
            IDictionary <string, string> annotations = record.Annotations;

            Console.WriteLine(record.ToString());
        }
        protected override void Send(TrackingRecord record)
        {
            var activityTrackingRecord = record as ActivityTrackingRecord;

            if (activityTrackingRecord == null)
            {
                return;
            }

            var type = GetWorkflowType(_parameters.WorkflowType);

            if (type.StatesToIgnoreInTracking.Count(s => s.Equals(activityTrackingRecord.QualifiedName, StringComparison.InvariantCultureIgnoreCase)) > 0)
            {
                return;
            }

            using (var context = new Budget2DataContext(ConfigurationManager.ConnectionStrings["default"].ConnectionString))
            {
                WorkflowTrackingHistory item = new WorkflowTrackingHistory()
                {
                    Id             = Guid.NewGuid(),
                    TransitionTime = DateTime.Now,
                    StateName      = activityTrackingRecord.QualifiedName,
                    WorkflowId     = _parameters.InstanceId,
                    WorkflowTypeId = type.Id
                };
                context.WorkflowTrackingHistories.InsertOnSubmit(item);

                context.SubmitChanges();
            }
        }
Beispiel #8
0
        protected override void Track(TrackingRecord record, TimeSpan timeout)
        {
            Event e = null;

            if (record is ActivityStateRecord)
            {
                e = ProcessTrackingRecord((ActivityStateRecord)record);
            }
            else if (record is CustomTrackingRecord)
            {
                e = ProcessTrackingRecord((CustomTrackingRecord)record);
            }
            else if (record is FaultPropagationRecord)
            {
                e = ProcessTrackingRecord((FaultPropagationRecord)record);
            }
            else
            {
                Console.WriteLine(record);
            }

            if (e != null)
            {
                Jhu.Graywulf.Logging.Logger.Instance.LogEvent(e);
            }
        }
            protected override void Track(TrackingRecord record, TimeSpan timeout)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;

                if (record is ActivityScheduledRecord)
                {
                    ActivityScheduledRecord actSchedule = record as ActivityScheduledRecord;
                    Console.WriteLine("Name: {0}, Scheduled", actSchedule.Child.Name);
                }
                else if (record is ActivityStateRecord)
                {
                    ActivityStateRecord actState = record as ActivityStateRecord;
                    Console.WriteLine("Name: {0}, {1}", actState.Activity.Name, actState.State);
                }
                else if (record is WorkflowInstanceRecord)
                {
                    WorkflowInstanceRecord wInstanceRecord = record as WorkflowInstanceRecord;
                    Console.WriteLine("WorkFlow, {0}", wInstanceRecord.State);
                }
                else
                {
                    Console.WriteLine(record.ToString());
                }

                Console.ResetColor();
            }
 /// <summary>
 /// Tracks a record.
 /// </summary>
 /// <param name="record"></param>
 /// <param name="timeout"></param>
 protected override void Track(TrackingRecord record, TimeSpan timeout)
 {
     if (ActivityActorEventSource.Current.IsEnabled())
     {
         TrackRecord(record);
     }
 }
        private void PersistRecord(TrackingRecord tr)
        {
            try
            {
                String path = Path.Combine(
                    Environment.CurrentDirectory, "tracking");
                String fileName = String.Format("{0}.{1}",
                                                tr.EventTime.ToString("yyyyMMdd.HHmmss.fffffff"),
                                                tr.RecordNumber);
                String fullPath = Path.Combine(path, fileName + ".xml");

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                using (FileStream stream =
                           new FileStream(fullPath, FileMode.Create))
                {
                    XmlWriterSettings settings = new XmlWriterSettings();
                    settings.Encoding = Encoding.UTF8;
                    using (XmlWriter writer = XmlWriter.Create(stream, settings))
                    {
                        writer.WriteRaw(TrackingRecordSerializer.Serialize(tr));
                    }
                }
            }
            catch (IOException exception)
            {
                Console.WriteLine(
                    "PersistRecord Exception: {0}", exception.Message);
            }
        }
Beispiel #12
0
 /// <summary>
 /// Tracks the given record.
 /// </summary>
 /// <param name="record"></param>
 /// <param name="timeout"></param>
 protected override void Track(TrackingRecord record, TimeSpan timeout)
 {
     if (telemetryClient.IsEnabled())
     {
         TrackRecord(record);
     }
 }
        private void ProcessingThreadProc()
        {
            while (_isThreadRunning)
            {
                if (_recordsToProcess.WaitOne(2000))
                {
                    Int32 count = 0;
                    lock (_records)
                    {
                        count = _records.Count;
                    }

                    while (count > 0)
                    {
                        TrackingRecord record = null;
                        lock (_records)
                        {
                            record = _records.Dequeue();
                            count  = _records.Count;
                        }

                        if (record != null)
                        {
                            PersistRecord(record);
                        }
                    }
                }
            }
        }
        protected override void Track(TrackingRecord record, TimeSpan timeout)
        {
            switch (record.Level)
            {
            case TraceLevel.Error:
            {
                Trace.TraceError(FormatMessage(record));
                break;
            }

            case TraceLevel.Warning:
            {
                Trace.TraceWarning(FormatMessage(record));
                break;
            }

            case TraceLevel.Info:
            {
                {
                    Trace.TraceInformation(FormatMessage(record));
                    break;
                }
            }

            default:
            {
                Trace.WriteLine(FormatMessage(record));
                break;
            }
            }
        }
        protected override void Track(TrackingRecord record, TimeSpan timeout)
        {
            if (record is StateMachineStateRecord)
            {
                var stateMachineRecord = (StateMachineStateRecord)record;
                Log.Debug("State Change {stateMachineRecord.InstanceId}: {stateMachineRecord.StateName}");

                OnWorkflowInstanceStateChange?.Invoke(stateMachineRecord);
            }
            else if (record is ActivityStateRecord)
            {
                var activityStateRecord = (ActivityStateRecord)record;
                if (activityStateRecord.Activity.TypeName == "System.Activities.Statements.InternalState")
                {
                    Log.Debug("Activity State: {stateRecord.InstanceId} - {stateRecord.Activity.Name} ({stateRecord.State})");
                }
                OnWorkflowInstanceActivityChange?.Invoke(activityStateRecord);
            }
            else if (record is WorkflowInstanceRecord)
            {
                var instanceRecord = (WorkflowInstanceRecord)record;
                Log.Debug($"Instance State: {instanceRecord.InstanceId} - {instanceRecord.ActivityDefinitionId} ({instanceRecord.State})");
                OnWorkflowInstanceChange?.Invoke(instanceRecord);
            }
        }
 protected override void Track(TrackingRecord record, TimeSpan timeout)
 {
     if (record is ActivityStateRecord)
     {
         TrackActivityRecord((ActivityStateRecord)record);
     }
     else if (record is WorkflowInstanceRecord)
     {
         TrackWorkflowRecord((WorkflowInstanceRecord)record);
     }
     else if (record is BookmarkResumptionRecord)
     {
         TrackBookmarkRecord((BookmarkResumptionRecord)record);
     }
     else if (record is ActivityScheduledRecord)
     {
         TrackActivityScheduledRecord((ActivityScheduledRecord)record);
     }
     else if (record is CancelRequestedRecord)
     {
         TrackCancelRequestedRecord((CancelRequestedRecord)record);
     }
     else if (record is FaultPropagationRecord)
     {
         TrackFaultPropagationRecord((FaultPropagationRecord)record);
     }
     else if (record is CustomTrackingRecord)
     {
         TrackCustomRecord((CustomTrackingRecord)record);
     }
     else
     {
         throw new PlatformNotSupportedException(Resources.UnrecognizedTrackingRecord(record?.GetType().Name));
     }
 }
Beispiel #17
0
        // The track method is called when a tracking record is emitted by the workflow runtime
        protected override void Track(TrackingRecord record, TimeSpan timeout)
        {
            TrackingCommand trackingCommand = new TrackingCommand(record);

            try
            {
                using (SqlConnection sqlConnection = new SqlConnection(this.connectionString))
                {
                    sqlConnection.Open();
                    SqlCommand sqlCommand = sqlConnection.CreateCommand();
                    foreach (SqlParameter parameter in trackingCommand.Parameters)
                    {
                        sqlCommand.Parameters.Add(parameter);
                    }

                    int sqlTimeout = (int)timeout.TotalSeconds;
                    if (sqlTimeout > 0)
                    {
                        sqlCommand.CommandTimeout = sqlTimeout;
                    }

                    // Wrap the command in a transaction since the command may contain multiple statements.
                    sqlCommand.Transaction = sqlConnection.BeginTransaction();
                    sqlCommand.CommandText = trackingCommand.Procedure;
                    sqlCommand.CommandType = CommandType.StoredProcedure;
                    sqlCommand.ExecuteNonQuery();
                    sqlCommand.Transaction.Commit();
                }
            }
            catch (Exception e)
            {
                Trace.WriteLine(String.Format(CultureInfo.InvariantCulture, "SqlTrackingParticipant: Exception in Track {0}", e.StackTrace));
            }
        }
Beispiel #18
0
        public TrackingCommand(TrackingRecord record)
            : this()
        {
            ActivityScheduledRecord activityScheduledRecord = record as ActivityScheduledRecord;

            if (activityScheduledRecord != null)
            {
                CreateTrackingCommand(activityScheduledRecord);
                return;
            }

            CancelRequestedRecord cancelRequestedRecord = record as CancelRequestedRecord;

            if (cancelRequestedRecord != null)
            {
                CreateTrackingCommand(cancelRequestedRecord);
                return;
            }

            FaultPropagationRecord faultPropagationRecord = record as FaultPropagationRecord;

            if (faultPropagationRecord != null)
            {
                CreateTrackingCommand(faultPropagationRecord);
                return;
            }


            ActivityStateRecord activityStateRecord = record as ActivityStateRecord;

            if (activityStateRecord != null)
            {
                CreateTrackingCommand(activityStateRecord);
                return;
            }

            WorkflowInstanceRecord workflowInstanceRecord = record as WorkflowInstanceRecord;

            if (workflowInstanceRecord != null)
            {
                CreateTrackingCommand(workflowInstanceRecord);
                return;
            }

            BookmarkResumptionRecord bookmarkResumptionRecord = record as BookmarkResumptionRecord;

            if (bookmarkResumptionRecord != null)
            {
                CreateTrackingCommand(bookmarkResumptionRecord);
                return;
            }

            CustomTrackingRecord customTrackingRecord = record as CustomTrackingRecord;

            if (customTrackingRecord != null)
            {
                CreateTrackingCommand(customTrackingRecord);
                return;
            }
        }
Beispiel #19
0
        public async Task <IActionResult> TrackingRecordUpdate(TrackingRecordUpdateDto model)
        {
            if (ModelState.IsValid)
            {
                TrackingRecord trackingRecord = await trackingRecordGenericService.GetByIdAsync(model.Id);

                if (trackingRecord != null)
                {
                    trackingRecord.Transfer(model);
                    trackingRecord.UpdateUserId = appUserSessionService.Get().Id;
                    await trackingRecordGenericService.UpdateAsync(trackingRecord);

                    return(Json(new { IsOk = true, Massage = "Ürün Guncellendi" }));
                }
                else
                {
                    ModelState.AddModelError("", "Lütfen verileri manipüle etmeyiniz");
                    string messages = ModelState.GetErrorsString();
                    return(Json(new { IsOk = false, Massage = messages }));
                }
            }
            else
            {
                ModelState.AddModelError("", "Lütfen gerekli tüm alanları doldurun.");
                string messages = ModelState.GetErrorsString();
                return(Json(new { IsOk = false, Massage = messages }));
            }
        }
Beispiel #20
0
        protected override void Track(TrackingRecord record, TimeSpan timeout)
        {
            StringBuilder trackingContents = new StringBuilder();

            trackingContents.AppendFormat(CultureInfo.InvariantCulture,
                                          "{0}:  Level: {1}, RecordNumber: {2}",
                                          record.GetType().Name, record.Level, record.RecordNumber);

            if (record is WorkflowInstanceRecord)
            {
                trackingContents.AppendFormat(CultureInfo.InvariantCulture,
                                              " Workflow InstanceID: {0} Workflow instance state: {1}\n",
                                              record.InstanceId, ((WorkflowInstanceRecord)record).State);
            }
            else if (record is ActivityStateRecord)
            {
                ActivityStateRecord activityTrackingRecord = (ActivityStateRecord)record;

                IDictionary <String, object> variables = activityTrackingRecord.Variables;
                StringBuilder vars = new StringBuilder();

                if (variables.Count > 0)
                {
                    vars.AppendLine("\n\tVariables:");
                    foreach (KeyValuePair <string, object> variable in variables)
                    {
                        vars.AppendLine(String.Format(
                                            "\t\tName: {0} Value: {1}", variable.Key, variable.Value));
                    }
                }
                trackingContents.AppendFormat(CultureInfo.InvariantCulture,
                                              " :Activity DisplayName: {0} :ActivityInstanceState: {1} {2}\n",
                                              activityTrackingRecord.Activity.Name, activityTrackingRecord.State,
                                              ((variables.Count > 0) ? vars.ToString() : String.Empty));
            }
            else if (record is ActivityScheduledRecord)
            {
                trackingContents.AppendFormat(CultureInfo.InvariantCulture,
                                              " :ChildActivity DisplayName: {0}\n",
                                              ((ActivityScheduledRecord)record).Child.Name);
            }
            else if (record is CustomTrackingRecord)
            {
                CustomTrackingRecord userTrackingRecord = (CustomTrackingRecord)record;

                if (userTrackingRecord.Data.Count > 0)
                {
                    trackingContents.AppendFormat(CultureInfo.InvariantCulture,
                                                  "\n\tUser Data:\n");
                    foreach (string data in userTrackingRecord.Data.Keys)
                    {
                        trackingContents.AppendFormat(CultureInfo.InvariantCulture,
                                                      " \t\t {0} : {1}\n", data, userTrackingRecord.Data[data]);
                    }
                }
            }

            this.writer.WriteLine(trackingContents);
        }
        protected override void Track(TrackingRecord record, TimeSpan timeout)
        {
            var sb = new StringBuilder(record.ToString());

            //foreach (var annotation in record.Annotations)
            //    sb.AppendLine(annotation.Key + " " + annotation.Value);
            Debug.WriteLine(sb.ToString());
        }
 private static void  WriteTrackingRecord(TrackingRecord record)
 {
     WriteTitle("Tracking Record");
     Console.WriteLine(string.Format("{0}: {1} on {2}: ",
                                     record.Annotations,
                                     record.EventArgs,
                                     record.EventDateTime.ToString()));
 }
 protected override void Track(TrackingRecord record, TimeSpan timeout)
 {
     lock (_records)
     {
         _records.Enqueue(record);
     }
     _recordsToProcess.Set();
 }
Beispiel #24
0
 // Send() is called by Tracking runtime to send various tracking records
 protected override void Send(TrackingRecord record)
 {
     //filter on record type
     if (record is UserTrackingRecord)
     {
         WriteUserTrackingRecord((UserTrackingRecord)record);
     }
 }
 protected override void Track(TrackingRecord record, TimeSpan timeout)
 {
     if (record != null)
     {
         Console.WriteLine("====================================");
         Console.WriteLine(record);
     }
 }
Beispiel #26
0
        protected override void Track(TrackingRecord record, TimeSpan timeout)
        {
            if (record is ActivityStateRecord)
            {
                ActivityStateRecord state = record as ActivityStateRecord;
                if (null == state.Activity)
                {
                    return;
                }
                bool closed = state.State.Equals("Closed"); //NOXLATE

                StringBuilder logLine = new StringBuilder();
                logLine.Append(String.Format(
                                   "{0}{1}{2} {3} {4}",  //NOXLATE
                                   state.Level.ToString(), _indent,
                                   closed ? "<-" : "--", //NOXLATE
                                   state.Activity.Id, GetName(state.Activity)));
                if (record.Level == TraceLevel.Info)
                {
                    if (closed)
                    {
                        if (state.Arguments.ContainsKey("Result")) // NOXLATE
                        {
                            logLine.Append(String.Format(
                                               " == \"{0}\"", state.Arguments["Result"])); //NOXLATE
                        }
                        DecrementIndent();
                    }
                    else
                    {
                        foreach (KeyValuePair <string, object> keyValue in state.Arguments)
                        {
                            Track(keyValue, logLine);
                        }
                    }
                }
                _log.AppendLine(logLine.ToString());
            }
            else if (record is ActivityScheduledRecord)
            {
                ActivityScheduledRecord scheduled = record as ActivityScheduledRecord;
                if (null == scheduled.Activity || null == scheduled.Child)
                {
                    return;
                }
                if (record.Level == TraceLevel.Info)
                {
                    IncrementIndent();
                }

                StringBuilder logLine = new StringBuilder();
                logLine.Append(String.Format(
                                   "{0}{1}-> {2} {3}",                  //NOXLATE
                                   scheduled.Level.ToString(), _indent, //scheduled.Activity.Id, GetName(scheduled.Activity), <- parent activity
                                   scheduled.Child.Id, GetName(scheduled.Child)));
                _log.AppendLine(logLine.ToString());
            }
        }
Beispiel #27
0
        protected override void Track(TrackingRecord record, TimeSpan timeout)
        {
            // Log header information
            AddEvent(String.Format("Type: {0}  Level: {1}, RecordNumber: {2}",
                                   record.GetType().Name, record.Level, record.RecordNumber));

            // If this is a instance record
            WorkflowInstanceRecord instance = record as WorkflowInstanceRecord;

            if (instance != null)
            {
                AddEvent(String.Format(" InstanceID: {0} State: {1}",
                                       instance.InstanceId, instance.State));
            }

            // If this is a bookmark record
            BookmarkResumptionRecord bookmark = record as BookmarkResumptionRecord;

            if (bookmark != null)
            {
                AddEvent(String.Format(" Bookmark {0} resumed",
                                       bookmark.BookmarkName));
            }

            // If this is an activity record
            ActivityStateRecord activity = record as ActivityStateRecord;

            if (activity != null)
            {
                IDictionary <String, object> variables = activity.Variables;
                StringBuilder s = new StringBuilder();


                if (variables.Count > 0)
                {
                    s.AppendLine(" Variables:");
                    foreach (KeyValuePair <string, object> v in variables)
                    {
                        s.AppendLine(String.Format("    {0} Value: [{1}]",
                                                   v.Key, v.Value));
                    }
                }
                AddEvent(String.Format(" Activity: {0} State: {1} {2}",
                                       activity.Activity.Name, activity.State, s.ToString()));
            }

            // If this is a user record
            CustomTrackingRecord user = record as CustomTrackingRecord;

            if ((user != null) && (user.Data.Count > 0))
            {
                AddEvent(String.Format(" User Data: {0}", user.Name));
                foreach (string data in user.Data.Keys)
                {
                    AddEvent(String.Format("   {0} : {1}", data, user.Data[data]));
                }
            }
        }
        /// <summary>
        /// Appends the current TrackingRecord data to the Workflow Execution Log
        /// </summary>
        /// <param name="trackRecord">Tracking Record Data</param>
        /// <param name="timeStamp">Timestamp</param>
        protected override void Track(TrackingRecord trackRecord, TimeSpan timeStamp)
        {
            ActivityStateRecord recordEntry = trackRecord as ActivityStateRecord;

            if (recordEntry != null)
            {
                TrackData += String.Format("[{0}] [{1}] [{2}]" + Environment.NewLine, recordEntry.EventTime.ToLocalTime().ToString(), recordEntry.Activity.Name, recordEntry.State);
            }
        }
Beispiel #29
0
        protected override void Track(TrackingRecord record, TimeSpan timeout)
        {
            var r = false;

            if (OnTrackingRecordReceived != null)
            {
                r = OnTrackingRecordReceived(record, timeout);
            }
        }
Beispiel #30
0
        public async Task <IViewComponentResult> InvokeAsync(UpdateModalViewModel model)
        {
            ViewBag.ModalModel = new ModalViewModel(model.Name, model.Submit);
            TrackingRecord trackingRecord = await trackingRecordService.GetByIdAsync(model.Id);

            TrackingRecordUpdateDto vm = trackingRecord != null?mapper.Map <TrackingRecordUpdateDto>(trackingRecord) : new TrackingRecordUpdateDto();

            return(View(vm));
        }
Beispiel #31
0
 /// <summary>
 /// 追踪
 /// </summary>
 /// <param name="TrackingTower">追踪塔</param>
 /// <param name="Steps">步数</param>
 public void Track(Tower TrackingTower, int Steps)
 {
     foreach (TrackingRecord r in FTrackingTowers)
     {
         if (r.TrackingTower == TrackingTower)
         {
             r.RemainSteps += Steps;
             return;
         }
     }
     TrackingRecord tr = new TrackingRecord();
     tr.TrackingTower = TrackingTower;
     tr.RemainSteps = Steps;
     FTrackingTowers.AddLast(tr);
 }