This commit is contained in:
mmrbnjd
2024-04-14 22:19:39 +03:30
parent f7e3f3b02a
commit 3f429e0539
8 changed files with 118 additions and 42 deletions

View File

@@ -34,7 +34,7 @@
<ItemGroup>
<Reference Include="Service">
<HintPath>..\..\..\LocalGit\TaxPayerTools\Service\bin\Debug\Service.dll</HintPath>
<HintPath>..\..\Dlls\Service.dll</HintPath>
</Reference>
</ItemGroup>

View File

@@ -37,20 +37,14 @@ namespace Back.Controllers
item.CompanyID = pid.Value.ToString();
var Ticket = await _servTicket.NewTicket(item, StatusTicket.unknownPerson);
var code= await _servValidatinMsg.GenerateCode(new VerificationCode
var ID= await _servValidatinMsg.GenerateCode(new VerificationCode
{
ID = 0,
prm = Ticket.ID.ToString(),
val = item.Mobile,
Type = "NewTicketNoAuthentication"
});
return Ticket == null ? BadRequest() : Ok(new VerificationCodeDto
{
prm = Ticket.ID.ToString(),
val = item.Mobile,
Type = "NewTicketNoAuthentication"
});
return Ticket == null ? BadRequest() : Ok(ID);
}
}
}

View File

@@ -6,8 +6,9 @@ namespace Back.Data.Models
{
public class VerificationCode
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public int ID { get; set; }
public int Code { get; set; }
public string prm { get; set; }
public string val { get; set; }
public string Type { get; set; }

View File

@@ -22,14 +22,14 @@ namespace Back.Services
}
public async Task<int> GenerateCode(VerificationCode code)
{
code.ID = Random.Shared.Next(1000, 9000);
code.Code = Random.Shared.Next(1000, 9000);
while (await GetRegistrationCode(code.ID) != null)
code.ID = Random.Shared.Next(1000, 9000);
code.Code = Random.Shared.Next(1000, 9000);
await _verificationCodeRepo.AddAsync(code);
var indb= await _verificationCodeRepo.AddAsync(code);
return code.ID;
return indb.ID;
}
}
}

View File

@@ -10,10 +10,10 @@ namespace Shared.DTOs
public class CTicketNoAuthenticationDto:CTicketDto
{
[Required]
[StringLength(11)]
[StringLength(11,MinimumLength =11)]
public string Mobile { get; set; }
[Required]
[StringLength(5)]
[MinLength(4)]
public string FullName { get; set; }
}
}

View File

@@ -1,7 +1,7 @@
@using Front.Pages
@using Shared.DTOs
@inject HttpClient _hc
@inject NavigationManager nav
<div class="contact-info-area pb-90" id="contact">
<div class="container">
<div class="row">
@@ -100,25 +100,18 @@
@functions{
private async Task newTicket(){
// var request = await _hc.PostAsJsonAsync("Ticket/NewTicketNoAuthentication", model);
// if (request.IsSuccessStatusCode)
// {
// messageStore?.Clear();
// var res = await request.Content.ReadFromJsonAsync<VerificationCodeDto>();
Verification pa = new Verification();
pa.model = new VerificationCodeDto
{
prm =" Ticket.ID.ToString()",
val = "item.Mobile",
Type = "NewTicketNoAuthentication"
};
await Task.Run(()=>pa);
// }
// else
// {
// var error = await request.Content.ReadFromJsonAsync<List<string>>();
// messageStore?.Add(() => model.Mobile, error);
var request = await _hc.PostAsJsonAsync("Ticket/NewTicketNoAuthentication", model);
if (request.IsSuccessStatusCode)
{
messageStore?.Clear();
var res = await request.Content.ReadFromJsonAsync<int>();
nav.NavigateTo($"Verification/{res}");
}
else
{
var error = await request.Content.ReadFromJsonAsync<List<string>>();
messageStore?.Add(() => model.Mobile, error);
// }
}
}
}

View File

@@ -1,13 +1,101 @@
@using Shared.DTOs
@page "/Verification/{model}"
<h3>Verification</h3>
@page "/Verification/{ID:int}"
<main>
<div class="limiter">
<div class="container-login100">
<div class="wrap-login100 p-t-50 p-b-90">
<form method="post" class="login100-form validate-form flex-sb flex-w">
<input type="hidden" asp-for="Code" />
<input type="hidden" asp-for="Type" />
<span class="login100-form-title p-b-51" id="sty1">
احراز هویت
</span>
@* <div class="container-login100-form-btn m-t-17">
<h5 class="success">کد ارسال شده به شماره @Model.Mobile</h5>
</div> *@
<EditForm Model="Code" OnSubmit="Submit">
<DataAnnotationsValidator />
<div class="postbox__comment-input mb-30">
<InputNumber @bind-Value="Code" id="cn" type="text" class="inputText" required="" />
<span class="floating-label">کد تائید</span>
</div>
</EditForm>
@*
<div class="container-login100-form-btn m-t-17">
<div class="wrap-input100 validate-input m-b-16" id="sty1" data-validate="کد الزامی می باشد">
<input asp-for=VerificationCode id="sty1" class="input100" type="text" name="VerificationCode" placeholder="کد تائید">
<span class="focus-input100"></span>
</div>
<span class="error" asp-validation-for="VerificationCode"></span>
</div> *@
@* <a href="/ResendMsg/?type=@Model.Type&Code=@Model.Code&Mobile=@Model.Mobile" class="txt1">
ارسال مجدد
</a> *@
<div class="container-login100-form-btn m-t-17">
<button class="login100-form-btn" id="sty1">
احراز
</button>
</div>
<div class="container-login100-form-btn m-t-17">
<div class="col-md-6">
<a href="/login" class="txt1">
ورود به حساب کاربری
</a>
</div>
<div class="col-md-6">
<a href="/Register" class="txt1">
ثبت نام
</a>
</div>
</div>
</form>
</div>
</div>
</div>
<div id="dropDownSelect1"></div>
</main>
@code {
[Parameter]
public VerificationCodeDto? model { get; set; }
public int ID { get; set; }
[SupplyParameterFromForm]
public int Code { get; set; }
public VerificationCodeDto Model { get; set; }
protected override async Task OnParametersSetAsync()
{
var dfsf = model;
await base.OnParametersSetAsync();
}
}
@functions{
private void Submit()
{
}
}
<script src="~/js/vendor/jquery-3.2.1.min.js"></script>
<script src="~/js/vendor/animsition.min.js"></script>
<script src="~/js/vendor/popper.js"></script>
<script src="~/js/vendor/bootstrap.min.js"></script>
<script src="~/js/vendor/select2.min.js"></script>
<script src="~/js/vendor/moment.min.js"></script>
<script src="~/js/vendor/daterangepicker.js"></script>
<script src="~/js/vendor/countdowntime.js"></script>
<script src="~/js/vendor/main.js"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-23581568-13"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-23581568-13');
</script>
<script defer src="https://static.cloudflareinsights.com/beacon.min.js/v84a3a4012de94ce1a686ba8c167c359c1696973893317" integrity="sha512-euoFGowhlaLqXsPWQ48qSkBSCFs3DPRyiwVu3FjR96cMPx+Fr+gpWRhIafcHwqwCqWS42RZhIudOvEI+Ckf6MA==" data-cf-beacon='{"rayId":"846c94483adc6ae1","version":"2023.10.0","token":"cd0b4b3a733644fc843ef0b185f98241"}' crossorigin="anonymous"></script>

View File

@@ -7,9 +7,9 @@ var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:7075/api/") });
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
//builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("http://localhost:5271/api/") });
CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("fa-Ir");