Example #1
0
        private async void DeleteButton_Click(object sender, EventArgs e)
        {
            if (!_dataGridViewService.TryGetSelectedCellIndices(out _, out var rowIndex, true) ||
                !_dataGridViewService.TryParseIntCell(ColumnName.DiseaseId, rowIndex, out var diseaseId) ||
                !_dataGridViewService.TryParseIntCell(ColumnName.SymptomId, rowIndex, out var symptomId))
            {
                return;
            }

            var dataGridViewData = new
            {
                DiseaseName = _dataGridViewService.GetCellValue(ColumnName.DiseaseName, rowIndex),
                SymptomName = _dataGridViewService.GetCellValue(ColumnName.SymptomName, rowIndex)
            };

            if (!MessageBoxService.ShowDeleteQuestion(@"Are you sure you want to delete relation between " +
                                                      $@"Disease '{dataGridViewData.DiseaseName}' and Symptom '{dataGridViewData.SymptomName}'?"))
            {
                return;
            }

            await _diseasesSymptomsService.DeleteRelationByIdAsync(diseaseId, symptomId);

            await RefreshDataViewGridAsync();
        }
Example #2
0
        private async void DeleteButton_Click(object sender, EventArgs e)
        {
            if (!_dataGridViewService.TryGetSelectedCellIndices(out _, out var rowIndex, true) ||
                !_dataGridViewService.TryParseIntCell(ColumnName.Id, rowIndex, out var symptomId))
            {
                return;
            }

            var symptomName = _dataGridViewService.GetCellValue(ColumnName.Name, rowIndex);

            if (!MessageBoxService.ShowDeleteQuestion($@"Are you sure you want to delete Symptom '{symptomName}'?"))
            {
                return;
            }

            await _symptomsService.DeleteByIdAsync(symptomId);

            await RefreshDataViewGridAsync();
        }
Example #3
0
        private async void DeleteButton_Click(object sender, EventArgs e)
        {
            if (!_dataGridViewService.TryGetSelectedCellIndices(out _, out var rowIndex, true) ||
                !_dataGridViewService.TryParseIntCell(ColumnName.RecipeId, rowIndex, out var recipeId) ||
                !_dataGridViewService.TryParseIntCell(ColumnName.MedicamentId, rowIndex, out var medicamentId))
            {
                return;
            }

            if (!MessageBoxService.ShowDeleteQuestion(
                    $"Are you sure you want to delete this relation?"))
            {
                return;
            }

            await _recipesMedicamentsService.DeleteRelationByIdAsync(recipeId, medicamentId);

            await RefreshDataGridViewAsync();
        }
Example #4
0
        private async void DeleteButton_Click(object sender, EventArgs e)
        {
            if (!_recipesDataGridViewService.TryGetSelectedCellIndices(out _, out var rowIndex, true) ||
                !_recipesDataGridViewService.TryParseIntCell(ColumnName.Id, rowIndex, out var recipeId))
            {
                return;
            }

            var clientFullName = _recipesDataGridViewService.GetCellValue(ColumnName.ClientName, rowIndex);
            var diseaseName    = _recipesDataGridViewService.GetCellValue(ColumnName.DiseaseName, rowIndex);

            if (!MessageBoxService.ShowDeleteQuestion(
                    $"Are you sure you want to delete Recipe '{clientFullName}' - '{diseaseName}'?"))
            {
                return;
            }

            await _recipesService.DeleteByIdAsync(recipeId);

            await RefreshRecipesDataGridViewAsync();
        }
Example #5
0
        private async void DeleteButton_Click(object sender, EventArgs e)
        {
            if (!_dosagesDataGridViewService.TryGetSelectedCellIndices(out _, out var rowIndex, true) ||
                !_dosagesDataGridViewService.TryParseIntCell(ColumnName.Id, rowIndex, out var dosageId))
            {
                return;
            }

            var diseaseName    = _dosagesDataGridViewService.GetCellValue(ColumnName.DiseaseName, rowIndex);
            var medicamentName = _dosagesDataGridViewService.GetCellValue(ColumnName.MedicamentName, rowIndex);

            if (!MessageBoxService.ShowDeleteQuestion(
                    $"Are you sure you want to delete Dosage '{diseaseName} - {medicamentName}'?"))
            {
                return;
            }

            await _dosagesService.DeleteByIdAsync(dosageId);

            await RefreshDataViewGridAsync();
        }
Example #6
0
        private async void OriginalDeleteButton_Click(object sender, EventArgs e)
        {
            if (!_originalDataGridViewService.TryGetSelectedCellIndices(out _, out var rowIndex, true) ||
                !_originalDataGridViewService.TryParseIntCell(OriginalColumnName.MedicamentId,
                                                              rowIndex,
                                                              out var originalMedicamentId))
            {
                return;
            }

            var originalMedicamentName = _originalDataGridViewService.GetCellValue(OriginalColumnName.MedicamentName,
                                                                                   rowIndex);

            if (!MessageBoxService.ShowDeleteQuestion(
                    $"Are you sure you want to delete Medicament '{originalMedicamentName}'?"))
            {
                return;
            }

            await _substitutesService.DeleteByIdAsync(originalMedicamentId, _medicament.Id);

            await RefreshOriginalDataGridViewAsync();
        }