Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
densen2014 committed Apr 3, 2022
1 parent 55e098c commit 7389acc
Show file tree
Hide file tree
Showing 17 changed files with 340 additions and 120 deletions.
132 changes: 132 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# To learn more about .editorconfig see https://aka.ms/editorconfigdocs
###############################
# Core EditorConfig Options #
###############################
root=true
# All files
[*]
indent_style = space
# Code files
[*.{cs,csx,vb,vbx}]
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
[*.{cs,css,js,json,html,razor}]
charset = utf-8-bom
[*.{json,yml,xml}]
indent_size = 2
###############################
# .NET Coding Conventions #
###############################
[*.{cs,vb}]
# Organize usings
dotnet_sort_system_directives_first = false
# this. preferences
dotnet_style_qualification_for_field = false:silent
dotnet_style_qualification_for_property = false:silent
dotnet_style_qualification_for_method = false:silent
dotnet_style_qualification_for_event = false:silent
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
dotnet_style_predefined_type_for_member_access = true:silent
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
dotnet_style_readonly_field = true:suggestion
# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:silent
dotnet_prefer_inferred_tuple_names = true:suggestion
dotnet_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:silent
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
###############################
# Naming Conventions #
###############################
# Style Definitions
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
# Use PascalCase for constant fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.applicable_accessibilities = *
dotnet_naming_symbols.constant_fields.required_modifiers = const
###############################
# C# Coding Conventions #
###############################
[*.cs]
# var preferences
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = true:silent
# Expression-bodied members
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
# Pattern matching preferences
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
# Null-checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
# Expression-level preferences
csharp_prefer_braces = true:silent
csharp_style_deconstructed_variable_declaration = true:suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_pattern_local_over_anonymous_function = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
###############################
# C# Formatting Rules #
###############################
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Space preferences
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
# Wrapping preferences
csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
###############################
# VB Coding Conventions #
###############################
[*.vb]
dotnet_diagnostic.CA2100.severity = silent
# Modifier preferences
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion
[*.{cs,vb}]
# Add file header
file_header_template = ********************************** \nDensen Informatica 中讯科技 \n作者:Alex Chow\ne-mail:[email protected] \n**********************************
5 changes: 3 additions & 2 deletions Blazor100.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Blazor100", "Blazor100\Blaz
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5165E290-A44D-4042-A9C0-EB6415B425B5}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
LICENSE = LICENSE
Expand Down Expand Up @@ -52,9 +53,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "b03sqlite", "b03sqlite\b03s
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "b05tree", "b05tree\b05tree.csproj", "{9F70B74D-3E9A-487D-AC77-103D67A353D1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BlazorRecord", "BlazorRecord\BlazorRecord.csproj", "{B356302D-73BF-4546-B9DD-71D9016D650B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorRecord", "BlazorRecord\BlazorRecord.csproj", "{B356302D-73BF-4546-B9DD-71D9016D650B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "b06chart", "b06chart\b06chart.csproj", "{4701FDAF-2E22-46CD-A03C-2A992247C3F7}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "b06chart", "b06chart\b06chart.csproj", "{4701FDAF-2E22-46CD-A03C-2A992247C3F7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
14 changes: 7 additions & 7 deletions b03sqlite/b03sqlite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.4.7" />
<PackageReference Include="BootstrapBlazor" Version="6.4.16" />
<!--<PackageReference Include="BootstrapBlazor.DataAcces.FreeSql" Version="6.0.0" />-->
<PackageReference Include="BootstrapBlazor.FontAwesome" Version="6.0.1" />
<PackageReference Include="Densen.FreeSql.Extensions.BootstrapBlazor" Version="6.3.2" />
<PackageReference Include="FreeSql.Provider.Sqlite" Version="3.2.100" />
<PackageReference Include="Magicodes.IE.Core" Version="2.6.1" />
<PackageReference Include="Magicodes.IE.Excel" Version="2.6.1" />
<PackageReference Include="Magicodes.IE.Html" Version="2.6.1" />
<PackageReference Include="Magicodes.IE.Pdf" Version="2.6.1" />
<PackageReference Include="Magicodes.IE.Word" Version="2.6.1" />
<PackageReference Include="FreeSql.Provider.Sqlite" Version="3.2.301" />
<PackageReference Include="Magicodes.IE.Core" Version="2.6.3" />
<PackageReference Include="Magicodes.IE.Excel" Version="2.6.3" />
<PackageReference Include="Magicodes.IE.Html" Version="2.6.3" />
<PackageReference Include="Magicodes.IE.Pdf" Version="2.6.3" />
<PackageReference Include="Magicodes.IE.Word" Version="2.6.3" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions b05tree/b05tree.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BootstrapBlazor" Version="6.4.7" />
<PackageReference Include="BootstrapBlazor" Version="6.4.16" />
<PackageReference Include="BootstrapBlazor.FontAwesome" Version="6.0.1" />
<PackageReference Include="Densen.FreeSql.Extensions.BootstrapBlazor" Version="6.3.2" />
<PackageReference Include="FreeSql.Provider.Sqlite" Version="3.2.100" />
<PackageReference Include="FreeSql.Provider.Sqlite" Version="3.2.301" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion b06chart/Components/ChartsBase.razor
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
{
if (!IsLineChart)
{
<Chart ChartType="ChartType.Bar" OnInitAsync="OnInit" @ref="BarChart" />
<Chart ChartType="ChartType.Bar" OnInitAsync="OnInit" @ref="BarChart" Width="" />
}
else
{
Expand Down
33 changes: 20 additions & 13 deletions b06chart/Components/ChartsBase.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace b06chart
{
public partial class ChartsBase
{
[NotNull] private Chart? LineChart { get; set; }
[NotNull] private Chart? BarChart { get; set; }
private Chart? LineChart { get; set; }
private Chart? BarChart { get; set; }

/// <summary>
/// 设定当前年份
Expand Down Expand Up @@ -89,7 +89,7 @@ private Task OnConfirm(DateTimeRangeValue value)
起始日期 = value.Start.FirstSecond();
结束日期 = value.End.Year == 1 ? value.Start.LastSecond() : value.End.LastSecond();

Chart chart = IsLineChart ? LineChart : BarChart;
Chart? chart = IsLineChart ? LineChart : BarChart;
chart?.Update(ChartAction.Update);
//StateHasChanged();
return Task.CompletedTask;
Expand All @@ -98,7 +98,7 @@ private Task OnClear(DateTimeRangeValue value)
{
起始日期 = DateTime.Today.FirstDay();
结束日期 = DateTime.Today.LastDay();
Chart chart = IsLineChart ? LineChart : BarChart;
Chart? chart = IsLineChart ? LineChart : BarChart;
chart?.Update(ChartAction.Update);
//StateHasChanged();
return Task.CompletedTask;
Expand Down Expand Up @@ -173,8 +173,15 @@ protected Task<ChartDataSource> OnInit()
else
数据生成Callback.InvokeAsync(ds);

ForceRefresh = LastCount < (ds.Labels?.Count()??0);
LastCount = ds.Labels?.Count()??0;
if (ds.Labels ==null || ds.Labels!.Count() == 0)
{
LastCount = 0;
Show = false;
return Task.FromResult(ds);
}
Show = true;
ForceRefresh = LastCount == 0 || LastCount < ds.Labels!.Count();
LastCount = ds.Labels!.Count();

if (!FirstLoad && ForceRefresh)
{
Expand All @@ -197,37 +204,37 @@ protected virtual void 数据生成(ChartDataSource ds)

private Task SetYear(int year)
{
Chart chart = IsLineChart ? LineChart : BarChart;
Chart? chart = IsLineChart ? LineChart : BarChart;
Year = year;
chart?.Update(ChartAction.Update);
return Task.CompletedTask;
}
private Task SetMonth(int month)
{
Chart chart = IsLineChart ? LineChart : BarChart;
Chart? chart = IsLineChart ? LineChart : BarChart;
Month = month;
chart?.Update(ChartAction.Update);
return Task.CompletedTask;
}
private Task PreMonth()
{
Chart chart = IsLineChart ? LineChart : BarChart;
Chart? chart = IsLineChart ? LineChart : BarChart;
Year = Month - 1 >= 1 ? Year : Year - 1;
Month = Month - 1 >= 1 ? Month - 1 : 12;
chart?.Update(ChartAction.Update);
return Task.CompletedTask;
}
private Task NextMonth()
{
Chart chart = IsLineChart ? LineChart : BarChart;
Chart? chart = IsLineChart ? LineChart : BarChart;
Year = Month + 1 <= 12 ? Year : Year + 1;
Month = Month + 1 <= 12 ? Month + 1 : 1;
chart?.Update(ChartAction.Update);
return Task.CompletedTask;
}
private Task SetNow()
{
Chart chart = IsLineChart ? LineChart : BarChart;
Chart? chart = IsLineChart ? LineChart : BarChart;
Year = DateTime.Now.Year;
Month = DateTime.Now.Month;
chart?.Update(ChartAction.Update);
Expand All @@ -236,7 +243,7 @@ private Task SetNow()

private Task RandomData()
{
Chart chart = IsLineChart ? LineChart : BarChart;
Chart? chart = IsLineChart ? LineChart : BarChart;
chart?.Update(ChartAction.Update);
return Task.CompletedTask;
}
Expand All @@ -260,7 +267,7 @@ private void SwitchStacked()
/// </summary>
private async void ReloadChart(bool reloadData=false)
{
Chart chart = IsLineChart ? LineChart : BarChart;
Chart? chart = IsLineChart ? LineChart : BarChart;
if (reloadData) chart?.Update(ChartAction.Update);
Show = false;
await InvokeAsync(StateHasChanged);
Expand Down
18 changes: 11 additions & 7 deletions b06chart/Model/OrdersEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ public static void DemoDatas(IFreeSql fsql)
if (res == 0)
{
var items = new List<Orders>();
for (int i = 1; i < 15; i++)
for (int i = 1; i < 100; i++)
{
var demo = Enumerable.Range(1, 10).Select((j, index) =>
var demo = Enumerable.Range(1, Randomer.Next(5, 12)).Select((j, index) =>
new Orders
{
OrderID = i,
OrderDate = DateTime.Now.Date.AddDays(-(15 - i)),
SubTotal = Randomer.Next(200, 370),
OrderDetailss = Enumerable.Range(5, 20).Select((j, index) =>
//OrderID = i,
OrderDate = DateTime.Now.Date.AddDays(-(100 - i)),
SubTotal = Randomer.Next(3, 45),
OrderDetailss = Enumerable.Range(1, Randomer.Next(3, 10)).Select((j, index) =>
new OrderDetails
{
OrderID = i,
Expand All @@ -66,7 +66,7 @@ public static void DemoDatas(IFreeSql fsql)
}

var repo = fsql.GetRepository<Orders>();//仓库类
repo.DbContextOptions.EnableAddOrUpdateNavigateList = true; //开启一对多,多对多级联保存功能
repo.DbContextOptions.EnableAddOrUpdateNavigateList = true; //开启一对多,多对多级联保存功能
repo.Insert(items);
}

Expand Down Expand Up @@ -94,4 +94,8 @@ public partial class OrderDetails
[DisplayName("数量")]
public decimal Quantity { get; set; }

[AutoGenerateColumn(Ignore = true)]
[Navigate(nameof(OrderID))]
public virtual Orders Orders { get; set; }

}
42 changes: 23 additions & 19 deletions b06chart/Pages/DayReport.razor
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
@page "/TopSales"
@page "/DayReport"
@namespace b06chart
<p>日报表</p>

<ChartsBase @ref="charts"
数据生成Callback="@((ds)=>数据生成(ds))"
Total="@Total" TotalString2="@TotalString2" />
<Tab>
<TabItem Text="日报表">
<ChartsBase @ref="charts"
TitleCharts="日报表"
数据生成Callback="@((ds)=>数据生成(ds))"
Total="@Total" TotalString2="@TotalString2" />



<Table TItem="Orders"
IsPagination="true"
IsStriped="true"
IsBordered="true"
AutoGenerateColumns="true"
ShowSearch="true"
ShowToolbar="true"
ShowExtendButtons="true"
DoubleClickToEdit=true
ShowColumnList=true
ShowCardView=true>
</Table>
</TabItem>
<TabItem Text="数据">
<Table TItem="Orders"
IsPagination="true"
IsStriped="true"
IsBordered="true"
AutoGenerateColumns="true"
ShowSearch="true"
ShowToolbar="true"
ShowExtendButtons="true"
DoubleClickToEdit=true
ShowColumnList=true
ShowCardView=true>
</Table>
</TabItem>
</Tab>
Loading

0 comments on commit 7389acc

Please sign in to comment.