public async Task Create(MicrotingDbContext dbContext) { CreatedAt = DateTime.UtcNow; UpdatedAt = DateTime.UtcNow; Version = 1; WorkflowState = Constants.Constants.WorkflowStates.Created; dbContext.answers.Add(this); await dbContext.SaveChangesAsync().ConfigureAwait(false); dbContext.answer_versions.Add(MapVersions(this)); await dbContext.SaveChangesAsync().ConfigureAwait(false); }
public async Task Create(MicrotingDbContext dbContext) { WorkflowState = Constants.Constants.WorkflowStates.Created; Version = 1; CreatedAt = DateTime.UtcNow; UpdatedAt = DateTime.UtcNow; dbContext.check_list_values.Add(this); await dbContext.SaveChangesAsync().ConfigureAwait(false); dbContext.check_list_value_versions.Add(MapCheckListValueVersions(this)); await dbContext.SaveChangesAsync().ConfigureAwait(false); }
public async Task Create(MicrotingDbContext dbContext) { WorkflowState = Constants.Constants.WorkflowStates.Created; Version = 1; CreatedAt = DateTime.UtcNow; UpdatedAt = DateTime.UtcNow; dbContext.entity_items.Add(this); await dbContext.SaveChangesAsync().ConfigureAwait(false); dbContext.entity_item_versions.Add(MapEntityItemVersions(this)); await dbContext.SaveChangesAsync().ConfigureAwait(false); }
public async Task Create(MicrotingDbContext dbContext) { WorkflowState = Constants.Constants.WorkflowStates.Created; Version = 1; CreatedAt = DateTime.UtcNow; UpdatedAt = DateTime.UtcNow; dbContext.LanguageQuestionSets.Add(this); await dbContext.SaveChangesAsync().ConfigureAwait(false); dbContext.LanguageQuestionSetVersions.Add(MapVersions(this)); await dbContext.SaveChangesAsync().ConfigureAwait(false); }
public async Task Update(MicrotingDbContext dbContext) { notifications notification = await dbContext.notifications.SingleOrDefaultAsync(x => x.Id == Id); if (notification == null) { throw new NullReferenceException($"Could not find notification with id {Id}"); } notification.WorkflowState = WorkflowState; notification.MicrotingUid = MicrotingUid; notification.Transmission = Transmission; notification.NotificationUid = NotificationUid; notification.Activity = Activity; notification.Exception = Exception; notification.Stacktrace = Stacktrace; if (dbContext.ChangeTracker.HasChanges()) { notification.UpdatedAt = DateTime.UtcNow; notification.Version += 1; dbContext.notification_versions.Add(MapVersions(notification)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Update(MicrotingDbContext dbContext) { answers answer = await dbContext.answers.FirstOrDefaultAsync(x => x.Id == Id); if (answer == null) { throw new NullReferenceException($"Could not find answer with Id: {Id}"); } answer.SiteId = SiteId; answer.UnitId = UnitId; answer.TimeZone = TimeZone; answer.FinishedAt = FinishedAt; answer.LanguageId = LanguageId; answer.AnswerDuration = AnswerDuration; answer.QuestionSetId = QuestionSetId; answer.SurveyConfigurationId = SurveyConfigurationId; answer.UtcAdjusted = UtcAdjusted; if (dbContext.ChangeTracker.HasChanges()) { answer.UpdatedAt = DateTime.UtcNow; answer.Version += 1; dbContext.answer_versions.Add(MapVersions(answer)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Update(MicrotingDbContext dbContext) { field_values fieldValues = await dbContext.field_values.FirstOrDefaultAsync(x => x.Id == Id); if (fieldValues == null) { throw new NullReferenceException($"Could not find Field Value with Id: {Id}"); } fieldValues.DoneAt = DoneAt; fieldValues.Date = Date; fieldValues.WorkerId = WorkerId; fieldValues.CaseId = CaseId; fieldValues.FieldId = FieldId; fieldValues.CheckListId = CheckListId; fieldValues.CheckListDuplicateId = CheckListDuplicateId; fieldValues.UploadedDataId = UploadedDataId; fieldValues.Value = Value; fieldValues.Latitude = Latitude; fieldValues.Longitude = Longitude; fieldValues.Altitude = Altitude; fieldValues.Heading = Heading; fieldValues.Accuracy = Accuracy; if (dbContext.ChangeTracker.HasChanges()) { fieldValues.UpdatedAt = DateTime.UtcNow; fieldValues.Version += 1; dbContext.field_value_versions.Add(MapFieldValueVersions(fieldValues)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Update(MicrotingDbContext dbContext) { entity_items entityItem = await dbContext.entity_items.FirstOrDefaultAsync(x => x.Id == Id); if (entityItem == null) { throw new NullReferenceException($"Could not find Entity Item with Id: {Id}"); } entityItem.EntityGroupId = EntityGroupId; entityItem.MicrotingUid = MicrotingUid; entityItem.Name = Name; entityItem.Description = Description; entityItem.Synced = Synced; entityItem.DisplayIndex = DisplayIndex; if (dbContext.ChangeTracker.HasChanges()) { entityItem.UpdatedAt = DateTime.UtcNow; entityItem.Version += 1; dbContext.entity_item_versions.Add(MapEntityItemVersions(entityItem)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Update(MicrotingDbContext dbContext) { check_list_values clv = await dbContext.check_list_values.FirstOrDefaultAsync(x => x.Id == Id); if (clv == null) { throw new NullReferenceException($"Could not find Check List Value with Id: {Id}"); } clv.Status = Status; clv.UserId = UserId; clv.CaseId = CaseId; clv.CheckListId = CheckListId; clv.CheckListDuplicateId = CheckListDuplicateId; if (dbContext.ChangeTracker.HasChanges()) { clv.UpdatedAt = DateTime.UtcNow; clv.Version += 1; dbContext.check_list_value_versions.Add(MapCheckListValueVersions(clv)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Update(MicrotingDbContext dbContext) { options option = await dbContext.options.FirstOrDefaultAsync(x => x.Id == Id); if (option == null) { throw new NullReferenceException($"Could not find option with Id: {Id}"); } option.QuestionId = QuestionId; option.Weight = Weight; option.WeightValue = WeightValue; option.NextQuestionId = NextQuestionId; option.ContinuousOptionId = ContinuousOptionId; option.OptionsIndex = OptionsIndex; option.DisplayIndex = DisplayIndex; if (dbContext.ChangeTracker.HasChanges()) { Version += 1; UpdatedAt = DateTime.UtcNow; dbContext.option_versions.Add(MapVersions(option)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Update(MicrotingDbContext dbContext) { questions question = await dbContext.questions.FirstOrDefaultAsync(x => x.Id == Id); if (question == null) { throw new NullReferenceException($"Could no find question with Id: {Id}"); } question.Type = Type; question.Image = Image; question.BackButtonEnabled = BackButtonEnabled; question.Maximum = Maximum; question.Minimum = Minimum; question.Prioritised = Prioritised; question.RefId = RefId; question.FontSize = FontSize; question.MaxDuration = MaxDuration; question.MinDuration = MinDuration; question.ImagePosition = ImagePosition; question.QuestionType = QuestionType; question.ValidDisplay = ValidDisplay; question.QuestionIndex = QuestionIndex; question.QuestionSetId = QuestionSetId; question.ContinuousQuestionId = ContinuousQuestionId; if (dbContext.ChangeTracker.HasChanges()) { Version += 1; UpdatedAt = DateTime.UtcNow; dbContext.question_versions.Add(MapVersions(question)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Create(MicrotingDbContext dbContext) { CreatedAt = DateTime.UtcNow; UpdatedAt = DateTime.UtcNow; Version = 1; if (WorkflowState == null) { WorkflowState = Constants.Constants.WorkflowStates.Created; } dbContext.survey_configurations.Add(this); await dbContext.SaveChangesAsync().ConfigureAwait(false); dbContext.survey_configuration_versions.Add(MapVersions(this)); await dbContext.SaveChangesAsync().ConfigureAwait(false); }
public async Task Update(MicrotingDbContext dbContext) { uploaded_data uploadedData = await dbContext.uploaded_data.FirstOrDefaultAsync(x => x.Id == Id); if (uploadedData == null) { throw new NullReferenceException($"Could not find Uploaded Data with Id: {Id}"); } uploadedData.UploaderId = UploaderId; uploadedData.UploaderType = UploaderType; uploadedData.Checksum = Checksum; uploadedData.Extension = Extension; uploadedData.Local = Local; uploadedData.FileName = FileName; uploadedData.CurrentFile = CurrentFile; uploadedData.FileLocation = FileLocation; uploadedData.ExpirationDate = ExpirationDate; uploadedData.TranscriptionId = TranscriptionId; if (dbContext.ChangeTracker.HasChanges()) { uploadedData.Version += 1; uploadedData.UpdatedAt = DateTime.UtcNow; dbContext.uploaded_data_versions.Add(MapVersions(uploadedData)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Update(MicrotingDbContext dbContext) { question_translations questionTranslation = await dbContext.QuestionTranslations.SingleOrDefaultAsync(x => x.Id == Id).ConfigureAwait(false); if (questionTranslation == null) { throw new NullReferenceException($"Could not find question_translation with id {Id}"); } questionTranslation.LanguageId = LanguageId; questionTranslation.QuestionId = QuestionId; questionTranslation.Name = Name; questionTranslation.WorkflowState = WorkflowState; questionTranslation.MicrotingUid = MicrotingUid; if (dbContext.ChangeTracker.HasChanges()) { questionTranslation.UpdatedAt = DateTime.UtcNow; questionTranslation.Version += 1; dbContext.QuestionTranslationVersions.Add(MapVersions(questionTranslation)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Update(MicrotingDbContext dbContext) { survey_configurations surveyConfigurations = await dbContext.survey_configurations.FirstOrDefaultAsync(x => x.Id == Id); if (surveyConfigurations == null) { throw new NullReferenceException($"Could not find survey configuration with Id: {Id}"); } surveyConfigurations.Name = Name; surveyConfigurations.Stop = Stop; surveyConfigurations.Start = Start; surveyConfigurations.TimeOut = TimeOut; surveyConfigurations.TimeToLive = TimeToLive; if (dbContext.ChangeTracker.HasChanges()) { surveyConfigurations.Version += 1; surveyConfigurations.UpdatedAt = DateTime.UtcNow; dbContext.survey_configuration_versions.Add(MapVersions(surveyConfigurations)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Delete(MicrotingDbContext dbContext) { taggings tagging = await dbContext.taggings.FirstOrDefaultAsync(x => x.Id == Id); if (tagging == null) { throw new NullReferenceException($"Could not find tagging with Id: {Id}"); } tagging.WorkflowState = Constants.Constants.WorkflowStates.Removed; tagging.UpdatedAt = DateTime.UtcNow; tagging.Version += 1; await dbContext.SaveChangesAsync().ConfigureAwait(false); dbContext.tagging_versions.Add(MapTaggingVersions(tagging)); await dbContext.SaveChangesAsync().ConfigureAwait(false); }
public async Task Delete(MicrotingDbContext dbContext) { field_types fieldTypes = await dbContext.field_types.FirstOrDefaultAsync(x => x.Id == Id); if (fieldTypes == null) { throw new NullReferenceException($"Could not find Field Type with Id: {Id}"); } dbContext.Remove(fieldTypes); await dbContext.SaveChangesAsync().ConfigureAwait(false); }
public async Task Update(MicrotingDbContext dbContext) { fields field = await dbContext.fields.FirstOrDefaultAsync(x => x.Id == Id); if (field == null) { throw new NullReferenceException($"Could not find Field with Id: {Id}"); } field.ParentFieldId = ParentFieldId; field.CheckListId = CheckListId; field.FieldTypeId = FieldTypeId; field.Mandatory = Mandatory; field.ReadOnly = ReadOnly; field.Label = Label; field.Description = Description; field.Color = Color; field.DisplayIndex = DisplayIndex; field.Dummy = Dummy; field.DefaultValue = DefaultValue; field.UnitName = UnitName; field.MinValue = MinValue; field.MaxValue = MaxValue; field.MaxLength = MaxLength; field.DecimalCount = DecimalCount; field.Multi = Multi; field.Optional = Optional; field.Selected = Selected; field.SplitScreen = SplitScreen; field.GeolocationForced = GeolocationForced; field.GeolocationHidden = GeolocationHidden; field.GeolocationEnabled = GeolocationEnabled; field.StopOnSave = StopOnSave; field.IsNum = IsNum; field.BarcodeEnabled = BarcodeEnabled; field.BarcodeType = BarcodeType; field.QueryType = QueryType; field.KeyValuePairList = KeyValuePairList; field.Custom = Custom; field.EntityGroupId = EntityGroupId; field.OriginalId = OriginalId; if (dbContext.ChangeTracker.HasChanges()) { field.Version += 1; field.UpdatedAt = DateTime.UtcNow; dbContext.field_versions.Add(MapFieldVersions(field)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Update(MicrotingDbContext dbContext) { check_lists checkList = await dbContext.check_lists.FirstOrDefaultAsync(x => x.Id == Id); if (checkList == null) { throw new NullReferenceException($"Could not find Checklist with Id: {Id}"); } checkList.Label = Label; checkList.Description = Description; checkList.Custom = Custom; checkList.ParentId = ParentId; checkList.Repeated = Repeated; checkList.DisplayIndex = DisplayIndex; checkList.CaseType = CaseType; checkList.FolderName = FolderName; checkList.ReviewEnabled = ReviewEnabled; checkList.ManualSync = ManualSync; checkList.ExtraFieldsEnabled = ExtraFieldsEnabled; checkList.DoneButtonEnabled = DoneButtonEnabled; checkList.ApprovalEnabled = ApprovalEnabled; checkList.MultiApproval = MultiApproval; checkList.FastNavigation = FastNavigation; checkList.DownloadEntities = DownloadEntities; checkList.Field1 = Field1; checkList.Field2 = Field2; checkList.Field3 = Field3; checkList.Field4 = Field4; checkList.Field5 = Field5; checkList.Field6 = Field6; checkList.Field7 = Field7; checkList.Field8 = Field8; checkList.Field9 = Field9; checkList.Field10 = Field10; checkList.Color = Color; checkList.QuickSyncEnabled = QuickSyncEnabled; checkList.OriginalId = OriginalId; checkList.JasperExportEnabled = JasperExportEnabled; checkList.DocxExportEnabled = DocxExportEnabled; if (dbContext.ChangeTracker.HasChanges()) { checkList.UpdatedAt = DateTime.UtcNow; checkList.Version += 1; dbContext.check_list_versions.Add(MapCheckListVersions(checkList)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Update(MicrotingDbContext dbContext) { field_types fieldTypes = await dbContext.field_types.FirstOrDefaultAsync(x => x.Id == Id); if (fieldTypes == null) { throw new NullReferenceException($"Could not find Field Type with Id: {Id}"); } fieldTypes.Description = Description; fieldTypes.FieldType = FieldType; if (dbContext.ChangeTracker.HasChanges()) { await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Update(MicrotingDbContext dbContext) { cases cases = await dbContext.cases.FirstOrDefaultAsync(x => x.Id == Id); if (cases == null) { throw new NullReferenceException($"Could not find case with Id: {Id}"); } cases.Custom = Custom; cases.Status = Status; cases.DoneAt = DoneAt; cases.SiteId = SiteId; cases.UnitId = UnitId; cases.CaseUid = CaseUid; cases.CheckList = CheckList; cases.CheckListId = CheckListId; cases.FieldValue1 = FieldValue1; cases.FieldValue2 = FieldValue2; cases.FieldValue3 = FieldValue3; cases.FieldValue4 = FieldValue4; cases.FieldValue5 = FieldValue5; cases.FieldValue6 = FieldValue6; cases.FieldValue7 = FieldValue7; cases.FieldValue8 = FieldValue8; cases.FieldValue9 = FieldValue9; cases.FieldValue10 = FieldValue10; cases.MicrotingUid = MicrotingUid; cases.WorkerId = WorkerId; cases.MicrotingCheckUid = MicrotingCheckUid; cases.FolderId = FolderId; cases.WorkflowState = WorkflowState; // TODO extend tests to include WorkflowState if (dbContext.ChangeTracker.HasChanges()) { cases.Version += 1; cases.UpdatedAt = DateTime.UtcNow; dbContext.case_versions.Add(MapVersions(cases)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Delete(MicrotingDbContext dbContext) { check_list_sites checkListSites = await dbContext.check_list_sites.FirstOrDefaultAsync(x => x.Id == Id); if (checkListSites == null) { throw new NullReferenceException($"Could not find Check List Site with Id: {Id}"); } checkListSites.WorkflowState = Constants.Constants.WorkflowStates.Removed; if (dbContext.ChangeTracker.HasChanges()) { checkListSites.Version += 1; checkListSites.UpdatedAt = DateTime.UtcNow; dbContext.check_list_site_versions.Add(MapCheckListSiteVersions(checkListSites)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Delete(MicrotingDbContext dbContext) { questions question = await dbContext.questions.FirstOrDefaultAsync(x => x.Id == Id); if (question == null) { throw new NullReferenceException($"Could no find question with Id: {Id}"); } question.WorkflowState = Constants.Constants.WorkflowStates.Removed; if (dbContext.ChangeTracker.HasChanges()) { Version += 1; UpdatedAt = DateTime.UtcNow; dbContext.question_versions.Add(MapVersions(question)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Delete(MicrotingDbContext dbContext) { option_translations option_translation = await dbContext.OptionTranslations.SingleOrDefaultAsync(x => x.Id == Id); if (option_translation == null) { throw new NullReferenceException($"Could not find notification with id {Id}"); } option_translation.WorkflowState = Constants.Constants.WorkflowStates.Removed; if (dbContext.ChangeTracker.HasChanges()) { option_translation.UpdatedAt = DateTime.UtcNow; option_translation.Version += 1; dbContext.OptionTranslationVersions.Add(MapVersions(option_translation)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Delete(MicrotingDbContext dbContext) { folders folder = dbContext.folders.SingleOrDefaultAsync(x => x.Id == Id).Result; if (folder == null) { throw new NullReferenceException($"Could not find area with Id: {Id}"); } folder.WorkflowState = Constants.Constants.WorkflowStates.Removed; if (dbContext.ChangeTracker.HasChanges()) { folder.UpdatedAt = DateTime.UtcNow; folder.Version += 1; dbContext.folder_versions.Add(MapFolderVersions(dbContext, folder)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Delete(MicrotingDbContext dbContext) { field_values fieldValues = await dbContext.field_values.FirstOrDefaultAsync(x => x.Id == Id); if (fieldValues == null) { throw new NullReferenceException($"Could not find Field Value with Id: {Id}"); } fieldValues.WorkflowState = Constants.Constants.WorkflowStates.Removed; if (dbContext.ChangeTracker.HasChanges()) { fieldValues.UpdatedAt = DateTime.UtcNow; fieldValues.Version += 1; dbContext.field_value_versions.Add(MapFieldValueVersions(fieldValues)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Delete(MicrotingDbContext dbContext) { site_tags siteTags = await dbContext.SiteTags.FirstOrDefaultAsync(x => x.Id == Id).ConfigureAwait(false); if (siteTags == null) { throw new NullReferenceException($"Could not find SiteTag withe Id {Id}"); } siteTags.WorkflowState = Constants.Constants.WorkflowStates.Removed; if (dbContext.ChangeTracker.HasChanges()) { siteTags.Version += 1; siteTags.UpdatedAt = DateTime.UtcNow; dbContext.SiteTagVersions.Add(MapVersions(siteTags)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Delete(MicrotingDbContext dbContext) { units unit = await dbContext.units.FirstOrDefaultAsync(x => x.Id == Id); if (unit == null) { throw new NullReferenceException($"Could not find Unit with Id: {Id}"); } unit.WorkflowState = Constants.Constants.WorkflowStates.Removed; if (dbContext.ChangeTracker.HasChanges()) { unit.Version += 1; unit.UpdatedAt = DateTime.UtcNow; dbContext.unit_versions.Add(MapVersions(unit)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Delete(MicrotingDbContext dbContext) { entity_items entityItem = await dbContext.entity_items.FirstOrDefaultAsync(x => x.Id == Id); if (entityItem == null) { throw new NullReferenceException($"Could not find Entity Item with Id: {Id}"); } entityItem.WorkflowState = Constants.Constants.WorkflowStates.Removed; if (dbContext.ChangeTracker.HasChanges()) { entityItem.UpdatedAt = DateTime.UtcNow; entityItem.Version += 1; dbContext.entity_item_versions.Add(MapEntityItemVersions(entityItem)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }
public async Task Delete(MicrotingDbContext dbContext) { language_question_sets languageQuestionSet = await dbContext.LanguageQuestionSets.SingleOrDefaultAsync(x => x.Id == Id).ConfigureAwait(false); if (languageQuestionSet == null) { throw new NullReferenceException($"Could not find language_question_set with id {Id}"); } languageQuestionSet.WorkflowState = Constants.Constants.WorkflowStates.Removed; if (dbContext.ChangeTracker.HasChanges()) { languageQuestionSet.UpdatedAt = DateTime.UtcNow; languageQuestionSet.Version += 1; dbContext.LanguageQuestionSetVersions.Add(MapVersions(languageQuestionSet)); await dbContext.SaveChangesAsync().ConfigureAwait(false); } }