public static Task <bool> UpdateJob(JobUpdateViewModel input) { var manager = new SQLiteJobQueueManager(new SQLiteJobQueueDataConnectionFactory(TempDevInfo.ConnString), TempDevInfo.TableConfigurations["console"], new NullOnMissingTypeJobTypeResolver()); Dictionary <Expression <Func <SqlCommonDbOddJobMetaData, object> >, object> updateSet = new Dictionary <Expression <Func <SqlCommonDbOddJobMetaData, object> >, object>(); Dictionary <int, Dictionary <Expression <Func <SqlCommonOddJobParamMetaData, object> >, object> > updateParamSet = new Dictionary <int, Dictionary <Expression <Func <SqlCommonOddJobParamMetaData, object> >, object> >(); if (input.UpdateData.UpdateMethodName && !string.IsNullOrWhiteSpace(input.UpdateData.NewQueueName)) { updateSet.Add((a => a.MethodName), input.UpdateData.NewMethodName); } if (input.UpdateData.UpdateQueueName && !string.IsNullOrWhiteSpace(input.UpdateData.NewQueueName)) { updateSet.Add(a => a.QueueName, input.UpdateData.NewQueueName); } if (input.UpdateData.UpdateRetryCount) { updateSet.Add(a => a.MaxRetries, input.UpdateData.NewMaxRetryCount); } if (input.UpdateData.UpdateStatus && !string.IsNullOrWhiteSpace(input.UpdateData.NewStatus)) { updateSet.Add(a => a.Status, input.UpdateData.NewStatus); } string statusIfRequired = input.UpdateData.RequireOldStatus ? input.UpdateData.OldStatus : ""; updateParamSet = input.UpdateData.ParamUpdates.Select(q => BuildParamUpdateSet(q)).ToDictionary(q => q.Key, q => q.Value); var result = manager.UpdateJobMetadataAndParameters(new JobUpdateCommand() { JobGuid = input.UpdateData.JobGuid, OldStatusIfRequired = statusIfRequired, SetJobParameters = updateParamSet, SetJobMetadata = updateSet }); return(Task.FromResult(result)); }
public static async Task <bool> PerformJobUpdate(JobUpdateViewModel juvm) { return(await Remoting.UpdateJob(juvm)); }
private static Elt CreateParamterUpdateElement(Var <JobUpdateViewModel> map, int i, JobUpdateViewModel juvm) { var updateParamTypeLens = map.Lens( uvm => uvm.UpdateData.ParamUpdates[i].UpdateParamType, (a, b) => { a.UpdateData.ParamUpdates[i].UpdateParamType = b; return(a); }); var newParamTypeLens = map.Lens( uvm => uvm.UpdateData.ParamUpdates[i].NewParamType, (a, b) => { a.UpdateData.ParamUpdates[i].NewParamType = b; return(a); }); var updateParamValueLens = map.Lens( uvm => uvm.UpdateData.ParamUpdates[i].UpdateParamValue, (a, b) => { a.UpdateData.ParamUpdates[i].UpdateParamValue = b; return(a); }); var newParamValueLens = map.Lens( uvm => uvm.UpdateData.ParamUpdates[i].NewParamValue, (a, b) => { a.UpdateData.ParamUpdates[i].NewParamValue = b; return(a); }); return(div( div(ElementCreators.CheckableTextInput("Type", updateParamTypeLens, newParamTypeLens, juvm.MetaData.JobArgs[i].Type)), //TODO: Make this a TextArea for larger Parameters div(ElementCreators.CheckableTextInput("Value", updateParamValueLens, newParamValueLens, juvm.MetaData.JobArgs[i].Value)) )); }