Добавьте файлы проекта.

This commit is contained in:
FrigaT
2026-01-05 00:29:19 +03:00
committed by FrigaT
parent 76a09d80d4
commit d0653c2098
105 changed files with 6729 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace SQLVision.Core.Models;
public class ChartSeries
{
public string Name { get; set; }
public List<object> Values { get; set; } = new();
public string Color { get; set; }
public double LineSmoothness { get; set; } = 0;
public bool ShowPoints { get; set; } = true;
}

View File

@@ -0,0 +1,36 @@
using System.Text.Json.Serialization;
namespace SQLVision.Core.Models;
public class ExecutionHistoryItem
{
[JsonPropertyName("id")]
public string Id { get; set; } = Guid.NewGuid().ToString();
[JsonPropertyName("scriptId")]
public string ScriptId { get; set; } = string.Empty;
[JsonPropertyName("scriptName")]
public string ScriptName { get; set; } = string.Empty;
[JsonPropertyName("executionTime")]
public DateTime ExecutionTime { get; set; }
[JsonPropertyName("duration")]
public TimeSpan Duration { get; set; }
[JsonPropertyName("success")]
public bool Success { get; set; }
[JsonPropertyName("parameters")]
public Dictionary<string, object> Parameters { get; set; } = new();
[JsonPropertyName("rowCount")]
public int RowCount { get; set; }
[JsonPropertyName("errorMessage")]
public string? ErrorMessage { get; set; }
[JsonPropertyName("executedSql")]
public string? ExecutedSql { get; set; }
}

View File

@@ -0,0 +1,41 @@
using System.Data;
using System.Text.Json.Serialization;
namespace SQLVision.Core.Models;
public class ExecutionResult
{
[JsonPropertyName("data")]
public DataSet? Data { get; set; }
[JsonPropertyName("isSuccess")]
public bool IsSuccess { get; set; }
[JsonPropertyName("errorMessage")]
public string? ErrorMessage { get; set; }
[JsonPropertyName("executionTime")]
public TimeSpan ExecutionTime { get; set; }
[JsonPropertyName("isFromCache")]
public bool IsFromCache { get; set; }
[JsonPropertyName("executionDate")]
public DateTime ExecutionDate { get; set; } = DateTime.UtcNow;
[JsonPropertyName("parameters")]
public Dictionary<string, object> Parameters { get; set; } = new();
[JsonPropertyName("executedSql")]
public string ExecutedSql { get; set; } = string.Empty;
[JsonPropertyName("rowCount")]
public int RowCount { get; set; }
[JsonPropertyName("metrics")]
public Dictionary<string, object> Metrics { get; set; } = new();
[JsonPropertyName("connectionName")]
public string? ConnectionName { get; set; }
}

View File

@@ -0,0 +1,12 @@
namespace SQLVision.Core.Models;
public class ExportOptions
{
public string Format { get; set; } = "Excel";
public bool IncludeHeaders { get; set; } = true;
public bool AutoFilter { get; set; } = true;
public bool IncludeCharts { get; set; } = false;
public string? ChartType { get; set; }
public bool OpenAfterExport { get; set; } = false;
public Dictionary<string, object> CustomOptions { get; set; } = new();
}

View File

@@ -0,0 +1,38 @@
using SQLVision.Core.Enums;
using System.Text.Json.Serialization;
namespace SQLVision.Core.Models;
public class OutputDefinition
{
[JsonPropertyName("type")]
public OutputType Type { get; set; } = OutputType.Table;
[JsonPropertyName("subType")]
public string? SubType { get; set; }
[JsonPropertyName("description")]
public string Description { get; set; } = "Result";
[JsonPropertyName("isPrimary")]
public bool IsPrimary { get; set; } = false;
[JsonPropertyName("options")]
public Dictionary<string, string> Options { get; set; } = new();
[JsonPropertyName("dataTableName")]
public string? DataTableName { get; set; }
// Для графиков
[JsonPropertyName("xAxisColumn")]
public string? XAxisColumn { get; set; }
[JsonPropertyName("yAxisColumn")]
public string? YAxisColumn { get; set; }
[JsonPropertyName("seriesColumn")]
public string? SeriesColumn { get; set; }
[JsonPropertyName("chartType")]
public ChartType ChartType { get; set; } = ChartType.Line;
}

View File

@@ -0,0 +1,8 @@
namespace SQLVision.Core.Models;
public class ScriptCategory
{
public string Name { get; set; } = string.Empty;
public List<ScriptMetadata> Scripts { get; set; } = new();
public bool IsExpanded { get; set; } = true;
}

View File

@@ -0,0 +1,63 @@
using SQLVision.Core.Enums;
using System.Text.Json.Serialization;
namespace SQLVision.Core.Models;
public class ScriptMetadata
{
[JsonPropertyName("id")]
public string Id { get; set; } = Guid.NewGuid().ToString();
[JsonPropertyName("fileName")]
public string FileName { get; set; } = string.Empty;
[JsonPropertyName("fullPath")]
public string FullPath { get; set; } = string.Empty;
[JsonPropertyName("description")]
public string? Description { get; set; }
[JsonPropertyName("rawSql")]
public string RawSql { get; set; } = string.Empty;
[JsonPropertyName("processedSql")]
public string ProcessedSql { get; set; } = string.Empty;
[JsonPropertyName("connectionString")]
public string? ConnectionString { get; set; }
[JsonPropertyName("databaseProvider")]
public DatabaseProvider DatabaseProvider { get; set; } = DatabaseProvider.SqlServer;
[JsonPropertyName("parameters")]
public List<ScriptParameter> Parameters { get; set; } = new();
[JsonPropertyName("outputs")]
public List<OutputDefinition> Outputs { get; set; } = new();
[JsonPropertyName("metadata")]
public Dictionary<string, object> Metadata { get; set; } = new();
[JsonPropertyName("lastModified")]
public DateTime LastModified { get; set; } = DateTime.UtcNow;
[JsonPropertyName("category")]
public string? Category { get; set; }
[JsonPropertyName("tags")]
public List<string> Tags { get; set; } = new();
[JsonPropertyName("executionCount")]
public int ExecutionCount { get; set; }
[JsonPropertyName("averageExecutionTime")]
public TimeSpan AverageExecutionTime { get; set; }
[JsonIgnore]
public string DisplayName => !string.IsNullOrEmpty(Description)
? Description
: Path.GetFileNameWithoutExtension(FileName);
[JsonIgnore]
public bool IsVisible { get; set; } = true;
}

View File

@@ -0,0 +1,66 @@
using SQLVision.Core.Enums;
using System.Text.Json.Serialization;
namespace SQLVision.Core.Models;
public class ScriptParameter
{
[JsonPropertyName("name")]
public string Name { get; set; } = string.Empty;
[JsonPropertyName("type")]
public ParameterType Type { get; set; } = ParameterType.String;
[JsonPropertyName("displayName")]
public string? DisplayName { get; set; }
[JsonPropertyName("description")]
public string? Description { get; set; }
[JsonPropertyName("defaultValue")]
public object? DefaultValue { get; set; }
[JsonPropertyName("isRequired")]
public bool IsRequired { get; set; } = false;
[JsonPropertyName("order")]
public int Order { get; set; } = 0;
[JsonPropertyName("group")]
public string? Group { get; set; }
[JsonPropertyName("tableQuery")]
public string? TableQuery { get; set; }
[JsonPropertyName("valueMember")]
public string ValueMember { get; set; } = "Id";
[JsonPropertyName("displayMember")]
public string DisplayMember { get; set; } = "Name";
[JsonPropertyName("dependsOn")]
public string? DependsOn { get; set; }
[JsonPropertyName("dependencyValues")]
public Dictionary<string, object>? DependencyValues { get; set; }
[JsonPropertyName("validationRules")]
public Dictionary<string, object>? ValidationRules { get; set; }
[JsonPropertyName("watermark")]
public string? Watermark { get; set; }
[JsonPropertyName("icon")]
public string? Icon { get; set; }
[JsonIgnore]
public string EffectiveDisplayName => DisplayName ?? Name;
public bool Validate(object? value)
{
if (IsRequired && (value == null || string.IsNullOrWhiteSpace(value.ToString())))
return false;
return true;
}
}