public async Task Initialize(IJob job, IReadOnlyCollection <ICommandWrapper> wrappedCommands) { var jobRow = new JobRow { PartitionKey = "Job", RowKey = job.Id.ToString(), Timestamp = DateTimeOffset.UtcNow, IsDone = job.IsDone, CommandIdentifiers = _jsonConverter.Serialize(job.CommandInformations.Select(ci => ci.Id)) }; await _jobTable.ExecuteAsync(TableOperation.Insert(jobRow)); var batchOperation = new TableBatchOperation(); var commandRows = wrappedCommands.Select(wc => new CommandRow { Type = wc.Command.GetType().FullName, PartitionKey = "Command", RowKey = wc.Id.ToString(), IsDone = job.IsDone }) .ToArray(); foreach (var commandRow in commandRows) { batchOperation.Add(TableOperation.Insert(commandRow)); } await _commandTable.ExecuteBatchAsync(batchOperation); }
/// <summary> /// Informs the DataLogManager that is should begin a new recording session. /// </summary> public Task <bool> BeginRecording(TimeSpan interval, JobRow job = null) { return(Task.Factory.StartNew(() => { if (currentSession != null) { return false; } var db = ion.database; var id = job != null ? job.JID : 0; var session = new SessionRow() { frn_JID = id, sessionStart = DateTime.Now, sessionEnd = DateTime.Now, }; if (!db.SaveAsync <SessionRow>(session).Result) { return false; } currentSession = new LoggingSession(ion, session, interval); recordingInterval = interval; NotifyEvent(DataLogManagerEvent.EType.RecordingStarted); return true; })); }
private void MarkActiveJob(JobRow job) { ion.preferences.job.activeJob = job._id; activeJobView.Visibility = ViewStates.Visible; emptyJobView.Visibility = ViewStates.Gone; var id = activeJobView.FindViewById <TextView>(Resource.Id.id); var name = activeJobView.FindViewById <TextView>(Resource.Id.name); var customer = activeJobView.FindViewById <TextView>(Resource.Id.customer_no); var dispatch = activeJobView.FindViewById <TextView>(Resource.Id.dispatch_no); var purchase = activeJobView.FindViewById <TextView>(Resource.Id.purchase_no); var favorite = activeJobView.FindViewById <ImageView>(Resource.Id.check); id.Text = job._id + ""; name.Text = job.jobName; customer.Text = job.customerNumber; dispatch.Text = job.dispatchNumber; purchase.Text = job.poNumber; favorite.SetColorFilter(Resource.Color.gold.AsResourceColor(this), PorterDuff.Mode.SrcAtop); favorite.SetOnClickListener(new ViewClickAction((v) => { ToggleActiveJob(job); })); adapter.NotifyDataSetChanged(); }
//<summary>returns true if the datetime has been reached and an execution is pending</summary> public bool ready(JobRow job) { if (job.status == OpenMassSenderCore.OpenMassSenderDBDataSet.JobRow.JobStatus.SHEDULED && DateTime.Now > nextExecution) { return true; } return false; }
public void Build(ConVpxJobInfoList list) { JobRow row = null; DataGridViewSelectedRowCollection selectedRows = this.dataGridViewJobs.SelectedRows; if (selectedRows.Count == 1) { row = selectedRows[0] as JobRow; } this.dataGridViewJobs.SuspendLayout(); try { this.dataGridViewJobs.Rows.Clear(); if (list != null) { foreach (ConVpxJobInfo info in list) { JobRow dataGridViewRow = new JobRow(info); this.dataGridViewJobs.Rows.Add(dataGridViewRow); } } } catch (Exception exception) { LOG.Error(exception.Message); } finally { try { if ((this.dataGridViewJobs.Rows.Count > 0) && (row != null)) { foreach (DataGridViewRow row3 in (IEnumerable)this.dataGridViewJobs.Rows) { JobRow row4 = row3 as JobRow; if (row4.JOB.JobId.Equals(row.JOB.JobId)) { row3.Selected = true; } else { row3.Selected = false; } } if ((this.dataGridViewJobs.SortedColumn != null) && (this.dataGridViewJobs.SortOrder != SortOrder.None)) { this.dataGridViewJobs.Sort(this.dataGridViewJobs.SortedColumn, (this.dataGridViewJobs.SortOrder == SortOrder.Ascending) ? ListSortDirection.Ascending : ListSortDirection.Descending); } } } catch (Exception exception2) { LOG.Error(exception2, exception2); } this.dataGridViewJobs.ResumeLayout(); } }
public void Present(JobRow job) { currentAdapter.jobRow = job; currentAdapter.SetSessions(currentSessions); availableAdapter.jobRow = job; availableAdapter.SetSessions(availableSessions); UpdateButtons(); }
public void Present(JobRow job) { foreach (var presenter in Presenters()) { try { presenter.Present(job); } catch (Exception e) { Log.E(this, "Failed to present display for job manager", e); } } }
/// <summary> /// If the given job is the current active job, we will request to remove it. /// </summary> /// <param name="???"></param> private void ToggleActiveJob(JobRow job) { if (ion.preferences.job.activeJob == job._id) { RemoveActiveJob(); } else { MarkActiveJob(job); } }
public async Task <bool> SaveAsync(JobRow job) { foreach (var presenter in Presenters()) { if (!await presenter.SaveAsync(job)) { return(false); } } return(true); }
public int IndexOfJob(JobRow job) { for (int i = 0; i < this.ItemCount; i++) { var r = records[i] as JobRecord; if (r?.data._id == job?._id) { return(i); } } return(-1); }
public async Task <bool> LoadAsync(JobRow job) { try { this.job = job; currentSessions = await LoadCurrentSessionsAsync(); availableSessions = await LoadAvailableSessionsAsync(); } catch (Exception e) { Log.E(this, "ERROR", e); } return(true); }
public async Task <bool> SaveAsync(JobRow job) { job.jobName = name.Text; job.customerNumber = customer.Text; job.dispatchNumber = dispatch.Text; job.poNumber = purchaseNo.Text; job.notes = notes.Text; job.techName = technician.Text; job.systemType = system.Text; job.jobAddress = addressView.Text; return(await ion.database.SaveAsync <JobRow>(job)); }
public void Present(JobRow job) { this.job = job; name.Text = job.jobName; customer.Text = job.customerNumber; dispatch.Text = job.dispatchNumber; purchaseNo.Text = job.poNumber; notes.Text = job.notes; technician.Text = job.techName; system.Text = job.systemType; addressView.Text = job.jobAddress; coordinates.Text = job.jobLocation; }
private async Task <Job> From(JobRow jobRow) { var job = new Job { Id = Guid.Parse(jobRow.RowKey), IsDone = jobRow.IsDone }; if (string.IsNullOrEmpty(jobRow.CommandIdentifiers)) { return(job); } var commandIds = jobRow.GetCommandIdentifiers(_jsonConverter); if (commandIds.Any()) { job.CommandInformations = (await GetCommandInformation(commandIds)).ToArray(); } return(job); }
/// <summary> /// Attempts to pull the job from the activity's Intent. If a job is not /// present, we will simply create a new one. /// </summary> /// <returns>The job async.</returns> private Task LoadJobAsync() { var progress = new ProgressDialog(this); progress.SetTitle(Resource.String.please_wait); progress.SetMessage(GetString(Resource.String.job_loading)); progress.Indeterminate = true; progress.SetCancelable(false); progress.Show(); return(Task.Factory.StartNew(() => { var delayTask = Task.Delay(TimeSpan.FromSeconds(0.5)); try { if (Intent.HasExtra(EXTRA_JOB_ID)) { var task = ion.database.QueryForAsync <JobRow>(Intent.GetIntExtra(EXTRA_JOB_ID, -1)); if (task.IsCompleted && !(task.IsCanceled || task.IsFaulted)) { job = task.Result; } } } catch (Exception e) { Log.E(this, "Failed to do something", e); } if (job == null) { job = new JobRow(); } var _ = adapter.LoadAsync(job).Result; }).ContinueWith((result) => { progress.Dismiss(); adapter.Present(job); }, TaskScheduler.FromCurrentSynchronizationContext())); }
public FilesRow AddFilesRow(JobRow parentJobRowByJob_Files, string ReportUrl, string LocalPath, string UniqueIdentifier) { FilesRow rowFilesRow = ((FilesRow)(this.NewRow())); rowFilesRow.ItemArray = new object[] { parentJobRowByJob_Files[0], ReportUrl, LocalPath, UniqueIdentifier}; this.Rows.Add(rowFilesRow); return rowFilesRow; }
public Task <bool> SaveAsync(JobRow job) { return(Task.FromResult(true)); }
public JobActionsRow AddJobActionsRow(JobRow parentJobRowByJob_JobActions, int DeviceID, bool TurnOn) { JobActionsRow rowJobActionsRow = ((JobActionsRow)(this.NewRow())); object[] columnValuesArray = new object[] { null, null, DeviceID, TurnOn}; if ((parentJobRowByJob_JobActions != null)) { columnValuesArray[1] = parentJobRowByJob_JobActions[0]; } rowJobActionsRow.ItemArray = columnValuesArray; this.Rows.Add(rowJobActionsRow); return rowJobActionsRow; }
public JobRowChangeEvent(JobRow row, System.Data.DataRowAction action) { this.eventRow = row; this.eventAction = action; }
public void AddJobRow(JobRow row) { this.Rows.Add(row); }
public void RemoveJobRow(JobRow row) { this.Rows.Remove(row); }