...
This commit is contained in:
@@ -34,32 +34,32 @@
|
||||
<div class="row gx-20">
|
||||
<div class="col-12">
|
||||
<div class="postbox__comment-input mb-30">
|
||||
<InputText @bind-Value="modelTaxTools.cn" id="cn" type="text" class="inputText" required="" />
|
||||
<InputText style="text-align:center" dir="ltr" @bind-Value="modelTaxTools.cn" id="cn" type="text" class="inputText" required="" />
|
||||
<span class="floating-label">نام شرکت به حالت فینگلیش</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="postbox__comment-input mb-30">
|
||||
<InputText @bind-Value="modelTaxTools.sn" id="sn" type="text" class="inputText" required="" />
|
||||
<InputText style="text-align:center" @bind-Value="modelTaxTools.sn" id="sn" dir="ltr" type="number" class="inputText" required="" />
|
||||
<span class="floating-label">شناسه ملی شرکت</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="postbox__comment-input mb-35">
|
||||
<InputText @bind-Value="modelTaxTools.company" id="company" type="text" class="inputText" required="" />
|
||||
<InputText style="text-align:center" @bind-Value="modelTaxTools.company" id="company" type="text" class="inputText" required="" />
|
||||
<span class="floating-label">نام شرکت به فارسی</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="postbox__comment-input mb-35">
|
||||
<InputText @bind-Value="modelTaxTools.Mobile" id="Mobile" type="text" class="inputText" required="" />
|
||||
<InputText style="text-align:center" @bind-Value="modelTaxTools.Mobile" dir="ltr" id="Mobile" type="number" class="inputText" required="" />
|
||||
<span class="floating-label">موبایل</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xxl-6">
|
||||
|
||||
<div class="postbox__btn-box w-50">
|
||||
<button type="submit" class="btn btn-outline-primary">ایجاد CSR و PrivateKey</button>
|
||||
<Button Disabled="SpinnerVisible" Type="ButtonType.Submit" Color="ButtonColor.Primary">ایجاد CSR و PrivateKey</Button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -70,7 +70,9 @@
|
||||
</div> *@
|
||||
</div>
|
||||
</EditForm>
|
||||
<br /> <br />
|
||||
<br />
|
||||
<Spinner Visible="SpinnerVisible" Color="SpinnerColor.Primary" />
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="popular-blog-title mb-20">
|
||||
@@ -84,7 +86,11 @@
|
||||
<div class="row">
|
||||
<label>
|
||||
حداکثر سایز مجاز فایل @maxFileSize بایت:
|
||||
<InputFile OnChange="ReadPublicKeyFromCER" multiple />
|
||||
<InputFile
|
||||
|
||||
hidden="@hidden"
|
||||
|
||||
OnChange="ReadPublicKeyFromCER" multiple />
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@@ -99,9 +105,10 @@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
public string hidden { get; set; }
|
||||
public bool SpinnerVisible { get; set; } = false;
|
||||
private long maxFileSize = 1024 * 15;
|
||||
public string ErrorReadpublickey { get; set; }
|
||||
public string ErrorReadpublickey { get; set; }
|
||||
|
||||
private EditContext? editContext;
|
||||
[SupplyParameterFromForm]
|
||||
@@ -111,6 +118,8 @@
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
SpinnerVisible = false;
|
||||
hidden = null;
|
||||
// modelTaxTools ??= new();
|
||||
// editContext = new(modelTaxTools);
|
||||
// editContext.OnValidationRequested += HandleValidationRequested;
|
||||
@@ -135,7 +144,8 @@
|
||||
@functions {
|
||||
private async Task CreateCsrAndPrivateKey()
|
||||
{
|
||||
|
||||
hidden = "hidden";
|
||||
SpinnerVisible = true;
|
||||
var request = await _hc.PostAsJsonAsync("Base/CreateCsrAndPrivateKey", modelTaxTools);
|
||||
if (request.IsSuccessStatusCode)
|
||||
{
|
||||
@@ -150,9 +160,13 @@
|
||||
messageStore?.Add(() => modelTaxTools.Mobile, error);
|
||||
|
||||
}
|
||||
SpinnerVisible = false;
|
||||
hidden = null;
|
||||
}
|
||||
private async Task ReadPublicKeyFromCER(InputFileChangeEventArgs e)
|
||||
{
|
||||
hidden = "hidden";
|
||||
SpinnerVisible = true;
|
||||
ErrorReadpublickey = "";
|
||||
if (e.GetMultipleFiles()[0].Size <= maxFileSize)
|
||||
{
|
||||
@@ -184,25 +198,31 @@
|
||||
{
|
||||
ErrorReadpublickey = "حجم فایل بیشتر از حد مجاز می باشد";
|
||||
}
|
||||
|
||||
|
||||
hidden = null;
|
||||
SpinnerVisible = false;
|
||||
|
||||
}
|
||||
private Stream GetFileStream(byte[] bytes)
|
||||
{
|
||||
hidden = "hidden";
|
||||
SpinnerVisible = true;
|
||||
var fileStream = new MemoryStream(bytes);
|
||||
|
||||
SpinnerVisible=false;
|
||||
hidden = null;
|
||||
return fileStream;
|
||||
}
|
||||
private async Task DownloadFileFromStream(string Base64, string FileName)
|
||||
{
|
||||
hidden = "hidden";
|
||||
SpinnerVisible = true;
|
||||
byte[] bytes = System.Convert.FromBase64String(Base64);
|
||||
|
||||
var fileStream = GetFileStream(bytes);
|
||||
// var fileName = "log.bin";
|
||||
|
||||
using var streamRef = new DotNetStreamReference(stream: fileStream);
|
||||
|
||||
SpinnerVisible = false ;
|
||||
hidden = null;
|
||||
await JS.InvokeVoidAsync("downloadFileFromStream", FileName, streamRef);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user