-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathAddCompany.razor.designer.cs
More file actions
115 lines (97 loc) · 3.53 KB
/
AddCompany.razor.designer.cs
File metadata and controls
115 lines (97 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using System;
using System.Linq;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.JSInterop;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Web;
using Radzen;
using Radzen.Blazor;
using SimpleInvoiceManagementSoftware.Models.SimpleInvoice;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Identity;
using SimpleInvoiceManagementSoftware.Models;
namespace SimpleInvoiceManagementSoftware.Pages
{
public partial class AddCompanyComponent : ComponentBase
{
[Parameter(CaptureUnmatchedValues = true)]
public IReadOnlyDictionary<string, dynamic> Attributes { get; set; }
public void Reload()
{
InvokeAsync(StateHasChanged);
}
public void OnPropertyChanged(PropertyChangedEventArgs args)
{
}
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[Inject]
protected NavigationManager UriHelper { get; set; }
[Inject]
protected DialogService DialogService { get; set; }
[Inject]
protected TooltipService TooltipService { get; set; }
[Inject]
protected ContextMenuService ContextMenuService { get; set; }
[Inject]
protected NotificationService NotificationService { get; set; }
[Inject]
protected SecurityService Security { get; set; }
[Inject]
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
[Inject]
protected SimpleInvoiceService SimpleInvoice { get; set; }
SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Company _company;
protected SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Company company
{
get
{
return _company;
}
set
{
if (!object.Equals(_company, value))
{
var args = new PropertyChangedEventArgs(){ Name = "company", NewValue = value, OldValue = _company };
_company = value;
OnPropertyChanged(args);
Reload();
}
}
}
protected override async System.Threading.Tasks.Task OnInitializedAsync()
{
await Security.InitializeAsync(AuthenticationStateProvider);
if (!Security.IsAuthenticated())
{
UriHelper.NavigateTo("Login", true);
}
else
{
await Load();
}
}
protected async System.Threading.Tasks.Task Load()
{
company = new SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Company(){};
}
protected async System.Threading.Tasks.Task Form0Submit(SimpleInvoiceManagementSoftware.Models.SimpleInvoice.Company args)
{
try
{
var simpleInvoiceCreateCompanyResult = await SimpleInvoice.CreateCompany(company);
DialogService.Close(company);
}
catch (System.Exception simpleInvoiceCreateCompanyException)
{
NotificationService.Notify(new NotificationMessage(){ Severity = NotificationSeverity.Error,Summary = $"Error",Detail = $"Unable to create new Company!" });
}
}
protected async System.Threading.Tasks.Task Button2Click(MouseEventArgs args)
{
DialogService.Close(null);
}
}
}