TemporaryClientRegister
This commit is contained in:
@@ -9,6 +9,13 @@ public interface ISmsService
|
||||
void Send(string number, string message);
|
||||
bool VerifySend(string number, string message);
|
||||
bool LoginSend(string number, string message);
|
||||
/// <summary>
|
||||
/// ارسال کد به کلاینت برای تکمیل فرایند ثبت نام
|
||||
/// </summary>
|
||||
/// <param name="number"></param>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
Task<SentSmsViewModel> SendVerifyCodeToClient(string number, string code);
|
||||
bool SendAccountsInfo(string number,string fullName, string userName);
|
||||
Task<ApiResultViewModel> GetByMessageId(int messId);
|
||||
Task<List<ApiResultViewModel>> GetApiResult(string startDate, string endDate);
|
||||
|
||||
32
0_Framework/Application/Sms/SentSmsViewModel.cs
Normal file
32
0_Framework/Application/Sms/SentSmsViewModel.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
namespace _0_Framework.Application;
|
||||
|
||||
public class SentSmsViewModel
|
||||
{
|
||||
public SentSmsViewModel()
|
||||
{
|
||||
IsSuccedded = false;
|
||||
}
|
||||
|
||||
public bool IsSuccedded { get; set; }
|
||||
public string Message { get; set; }
|
||||
public byte StatusCode { get; set; }
|
||||
public int MessageId { get; set; }
|
||||
|
||||
public SentSmsViewModel Succedded(byte statusCode, string message, int messageId)
|
||||
{
|
||||
IsSuccedded = true;
|
||||
Message = message;
|
||||
StatusCode = statusCode;
|
||||
MessageId = messageId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SentSmsViewModel Failed(byte statusCode, string message, int messageId)
|
||||
{
|
||||
IsSuccedded = false;
|
||||
Message = message;
|
||||
StatusCode = statusCode;
|
||||
MessageId = messageId;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using IPE.SmsIrClient;
|
||||
using IPE.SmsIrClient.Models.Requests;
|
||||
using IPE.SmsIrClient.Models.Results;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
|
||||
namespace _0_Framework.Application.Sms;
|
||||
@@ -110,6 +111,31 @@ public class SmsService : ISmsService
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<SentSmsViewModel> SendVerifyCodeToClient(string number, string code)
|
||||
{
|
||||
SmsIr smsIr = new SmsIr("Og5M562igmzJRhQPnq0GdtieYdLgtfikjzxOmeQBPxJjZtyge5Klc046Lfw1mxSa");
|
||||
var result = new SentSmsViewModel();
|
||||
//var bulkSendResult = smsIr.BulkSendAsync(95007079000006, "your text message", new string[] { "9120000000" });
|
||||
|
||||
var sendResult = await smsIr.VerifySendAsync(number, 768382, new VerifySendParameter[] { new VerifySendParameter("VerificationCode", code) });
|
||||
Thread.Sleep(2000);
|
||||
|
||||
if (sendResult.Message == "موفق")
|
||||
{
|
||||
var status = sendResult.Status;
|
||||
var message = sendResult.Message;
|
||||
var messaeId = sendResult.Data.MessageId;
|
||||
return result.Succedded(status, message, messaeId);
|
||||
}
|
||||
else
|
||||
{
|
||||
var status = sendResult.Status;
|
||||
var message = sendResult.Message;
|
||||
var messaeId = sendResult.Data.MessageId;
|
||||
return result.Failed(status, message, messaeId);
|
||||
}
|
||||
}
|
||||
|
||||
public bool SendAccountsInfo(string number, string fullName, string userName)
|
||||
{
|
||||
|
||||
|
||||
@@ -20,4 +20,11 @@ public interface IContractingPartyTempRepository :IRepository<long, ContractingP
|
||||
/// <param name="nationalCode"></param>
|
||||
/// <returns></returns>
|
||||
ContractingPartyTempViewModel GetByNationalCode(string nationalCode);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت اطلاعات طرف حساب موقت با کد ملی
|
||||
/// </summary>
|
||||
/// <param name="nationalCode"></param>
|
||||
/// <returns></returns>
|
||||
ContractingPartyTempViewModel GetByContractingPartyTempId(long contractingPartyTempId);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application.UID;
|
||||
using _0_Framework.Domain;
|
||||
|
||||
namespace Company.Domain.TemporaryClientRegistrationAgg;
|
||||
@@ -119,4 +120,15 @@ public class InstitutionContractTemp : EntityBase
|
||||
VerifyCodeEndTime = verifyCodeEndTime;
|
||||
}
|
||||
|
||||
public void Update(string verifyCode, string registrationStatus, int messageId, DateTime? sendVerifyCodeTime, DateTime? verifyCodeEndTime)
|
||||
{
|
||||
VerifyCode = verifyCode;
|
||||
RegistrationStatus = registrationStatus;
|
||||
MessageId = messageId;
|
||||
SendVerifyCodeTime = sendVerifyCodeTime;
|
||||
VerifyCodeEndTime = verifyCodeEndTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -63,6 +63,8 @@ public class CreateInstitutionContractTemp
|
||||
/// -
|
||||
/// VerifyCodeSent کد ارسال شده
|
||||
/// -
|
||||
/// ReceivedCodeFromClient
|
||||
/// -
|
||||
/// Completed ثبت نام تکمیل شده
|
||||
/// </summary>
|
||||
public string RegistrationStatus { get; set; }
|
||||
|
||||
@@ -62,5 +62,34 @@ public interface ITemporaryClientRegistrationApplication
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> CreateOrUpdateInstitutionContractTemp(long contractingPartyTempId, string periodModel, string paymentModel);
|
||||
Task<OperationResult> CreateOrUpdateInstitutionContractTemp(long contractingPartyTempId, string periodModel, string paymentModel, double totalPayment, double valueAddedTax);
|
||||
|
||||
/// <summary>
|
||||
/// دریافت کد برای کلاینت
|
||||
/// از طرف سرور
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> ReceivedCodeFromServer(long contractingPartyTempId);
|
||||
|
||||
/// <summary>
|
||||
/// ورود کد از طرف کلاینت
|
||||
/// برا چک کردن
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <param name="verifyCode"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> CheckVerifyCodeIsTrue(long contractingPartyTempId, string verifyCode);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// تکمیل پرداخت
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <param name="verifyCode"></param>
|
||||
/// <returns></returns>
|
||||
Task<OperationResult> PayOffCompleted(long contractingPartyTempId);
|
||||
}
|
||||
@@ -25,7 +25,7 @@ public class SmsResultApplication : ISmsResultApplication
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
public List<SmsResultViewModel> Search(SmsResultSearchModel searchModel)
|
||||
public List<App.Contracts.SmsResult.SmsResultViewModel> Search(SmsResultSearchModel searchModel)
|
||||
{
|
||||
|
||||
var result = _smsResultRepository.Search(searchModel);
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using _0_Framework.Application;
|
||||
using _0_Framework.Application.Sms;
|
||||
using _0_Framework.Application.UID;
|
||||
using Company.Domain.ContarctingPartyAgg;
|
||||
using Company.Domain.InstitutionPlanAgg;
|
||||
using Company.Domain.TemporaryClientRegistrationAgg;
|
||||
using CompanyManagment.App.Contracts.InstitutionPlan;
|
||||
using CompanyManagment.App.Contracts.TemporaryClientRegistration;
|
||||
using IPE.SmsIrClient.Models.Results;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using PersianTools.Core;
|
||||
|
||||
@@ -22,8 +25,9 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
private readonly IPlanPercentageRepository _planPercentageRepository;
|
||||
private readonly IWorkshopServicesTempRepository _workshopServicesTempRepository;
|
||||
private readonly IInstitutionContractTempRepository _institutionContractTempRepository;
|
||||
private readonly ISmsService _smsService;
|
||||
|
||||
public TemporaryClientRegistrationApplication(IContractingPartyTempRepository contractingPartyTempRepository, IPersonalContractingPartyRepository personalContractingPartyRepository, IUidService uidService, IWorkshopTempRepository workshopTempRepository, IPlanPercentageRepository planPercentageRepository, IWorkshopServicesTempRepository workshopServicesTempRepository, IInstitutionContractTempRepository institutionContractTempRepository)
|
||||
public TemporaryClientRegistrationApplication(IContractingPartyTempRepository contractingPartyTempRepository, IPersonalContractingPartyRepository personalContractingPartyRepository, IUidService uidService, IWorkshopTempRepository workshopTempRepository, IPlanPercentageRepository planPercentageRepository, IWorkshopServicesTempRepository workshopServicesTempRepository, IInstitutionContractTempRepository institutionContractTempRepository, ISmsService smsService)
|
||||
{
|
||||
_contractingPartyTempRepository = contractingPartyTempRepository;
|
||||
_personalContractingPartyRepository = personalContractingPartyRepository;
|
||||
@@ -32,6 +36,7 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
_planPercentageRepository = planPercentageRepository;
|
||||
_workshopServicesTempRepository = workshopServicesTempRepository;
|
||||
_institutionContractTempRepository = institutionContractTempRepository;
|
||||
_smsService = smsService;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -60,6 +65,9 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
|
||||
if (!mobile.IsMobileValid())
|
||||
return op.Failed("شماره همراه نا معتبر است");
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -82,6 +90,15 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
//اگر طرف حساب موقت قبلا ایجاد شده دیتای آن را برمیگرداند
|
||||
if (getExistTemp != null)
|
||||
{
|
||||
var institutionContractTemp = await
|
||||
_institutionContractTempRepository.GetInstitutionContractTemp(0, getExistTemp.Id);
|
||||
|
||||
if (institutionContractTemp != null)
|
||||
{
|
||||
|
||||
if (institutionContractTemp.RegistrationStatus == "Completed")
|
||||
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
|
||||
}
|
||||
|
||||
if (getExistTemp.DateOfBirth != dateOfBirthGr)
|
||||
return op.Failed("تاریخ تولد مطابقت ندارد");
|
||||
@@ -396,19 +413,192 @@ public class TemporaryClientRegistrationApplication : ITemporaryClientRegistrati
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OperationResult> CreateOrUpdateInstitutionContractTemp(long contractingPartyTempId, string periodModel, string paymentModel)
|
||||
public async Task<OperationResult> CreateOrUpdateInstitutionContractTemp(long contractingPartyTempId, string periodModel, string paymentModel, double totalPayment, double valueAddedTax)
|
||||
{
|
||||
|
||||
var op = new OperationResult();
|
||||
var contractingPartyTemp = await
|
||||
var institutionContractTemp = await
|
||||
_institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
|
||||
|
||||
if (contractingPartyTemp == null)
|
||||
if (institutionContractTemp == null)
|
||||
{
|
||||
var periodModelInt = Convert.ToInt32(periodModel);
|
||||
var contractstart = DateTime.Now;
|
||||
var contractEnd = DateTime.Now.AddMonths(periodModelInt);
|
||||
var create = new InstitutionContractTemp(contractingPartyTempId,paymentModel,periodModel,totalPayment,contractstart,contractEnd,"official", valueAddedTax,"", "BeforeSendVerifyCode", 0,null,null);
|
||||
_institutionContractTempRepository.Create(create);
|
||||
_institutionContractTempRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (institutionContractTemp.VerifyCodeEndTime != null)
|
||||
{
|
||||
var spaning = (institutionContractTemp.VerifyCodeEndTime.Value - DateTime.Now);
|
||||
if (institutionContractTemp.RegistrationStatus == "VerifyCodeSent" && spaning > new TimeSpan(0, 0, 0) && spaning < new TimeSpan(0, 1, 0))
|
||||
return op.Failed("شما به تازگی پیامک دریافت نموده اید دو دقیقه صبر کنید و دوباره تلاش کنید");
|
||||
}
|
||||
|
||||
if (institutionContractTemp.RegistrationStatus == "Completed")
|
||||
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
|
||||
|
||||
|
||||
return op.Failed("");
|
||||
|
||||
throw new System.NotImplementedException();
|
||||
var periodModelInt = Convert.ToInt32(periodModel);
|
||||
var contractstart = DateTime.Now;
|
||||
var contractEnd = DateTime.Now.AddMonths(periodModelInt);
|
||||
var update = _institutionContractTempRepository.Get(institutionContractTemp.Id);
|
||||
update.Edit(contractingPartyTempId, paymentModel, periodModel, totalPayment, contractstart, contractEnd, "official", valueAddedTax, "", "BeforeSendVerifyCode", 0, null, null);
|
||||
_institutionContractTempRepository.SaveChanges();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// دریافت کد برای کلاینت
|
||||
/// از طرف سرور
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OperationResult> ReceivedCodeFromServer(long contractingPartyTempId)
|
||||
{
|
||||
|
||||
var op = new OperationResult();
|
||||
var institutionContractTemp = await
|
||||
_institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
|
||||
if (institutionContractTemp == null)
|
||||
return op.Failed("خظا");
|
||||
|
||||
var update = _institutionContractTempRepository.Get(institutionContractTemp.Id);
|
||||
|
||||
|
||||
|
||||
|
||||
if (institutionContractTemp.RegistrationStatus == "BeforeSendVerifyCode")
|
||||
{
|
||||
//ساخت کد شش رقمی
|
||||
Random generator = new Random();
|
||||
String code = generator.Next(1, 1000000).ToString("D6");
|
||||
//ارسال اس ام اس
|
||||
var getContractingPaty = _contractingPartyTempRepository.GetByContractingPartyTempId(contractingPartyTempId);
|
||||
var sendResult = await _smsService.SendVerifyCodeToClient(getContractingPaty.Phone, code);
|
||||
|
||||
if (!sendResult.IsSuccedded)
|
||||
return op.Failed($"{sendResult.Message}");
|
||||
|
||||
//ذخیره کد در دیتا بیس
|
||||
//ذخیره تاریخ ارسال و مهلت پایان
|
||||
//ذخیره آیدی پیامک
|
||||
//تغییر وضعیت به ارسال شده
|
||||
if (update != null)
|
||||
{
|
||||
update.Update(code, "VerifyCodeSent", sendResult.MessageId, DateTime.Now, DateTime.Now.AddMinutes(2));
|
||||
_institutionContractTempRepository.SaveChanges();
|
||||
return op.Succcedded(1, "کد برای شما پیامک شد");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (institutionContractTemp.RegistrationStatus == "VerifyCodeSent")
|
||||
|
||||
{
|
||||
var spaning = (institutionContractTemp.VerifyCodeEndTime.Value - DateTime.Now);
|
||||
if ((spaning > new TimeSpan(0, 0, 0) && spaning < new TimeSpan(0, 1, 0)))
|
||||
return op.Failed("شما به تازگی پیامک دریافت نموده اید دو دقیقه صبر کنید و دوباره تلاش کنید");
|
||||
|
||||
if ((spaning > new TimeSpan(0, 0, 0) && spaning > new TimeSpan(0, 1, 0)))
|
||||
{
|
||||
//ساخت کد شش رقمی
|
||||
Random generator = new Random();
|
||||
String code = generator.Next(1, 1000000).ToString("D6");
|
||||
//ارسال اس ام اس
|
||||
var getContractingPaty = _contractingPartyTempRepository.GetByContractingPartyTempId(contractingPartyTempId);
|
||||
var sendResult =await _smsService.SendVerifyCodeToClient(getContractingPaty.Phone, code);
|
||||
|
||||
if(!sendResult.IsSuccedded)
|
||||
return op.Failed($"{sendResult.Message}");
|
||||
|
||||
|
||||
|
||||
//ذخیره کد در دیتا بیس
|
||||
//ذخیره تاریخ ارسال و مهلت پایان
|
||||
//ذخیره آیدی پیامک
|
||||
//تغییر وضعیت به ارسال شده
|
||||
|
||||
if (update != null)
|
||||
{
|
||||
update.Update(code, "VerifyCodeSent",sendResult.MessageId, DateTime.Now, DateTime.Now.AddMinutes(2));
|
||||
_institutionContractTempRepository.SaveChanges();
|
||||
return op.Succcedded(1, "کد برای شما پیامک شد");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//if (institutionContractTemp.RegistrationStatus == "ReceivedCodeFromClient")
|
||||
// return op.Succcedded(2, "انتقال به بخش پرداخت");
|
||||
|
||||
if (institutionContractTemp.RegistrationStatus == "Completed")
|
||||
return op.Failed("شما قبلا ثبت نام خود را تکمیل نموده اید");
|
||||
return op.Failed("خظا");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ورود کد از طرف کلاینت
|
||||
/// برا چک کردن
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <param name="verifyCode"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OperationResult> CheckVerifyCodeIsTrue(long contractingPartyTempId, string verifyCode)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
var institutionContractTemp = await
|
||||
_institutionContractTempRepository.GetInstitutionContractTemp(0, contractingPartyTempId);
|
||||
if (institutionContractTemp == null)
|
||||
return op.Failed("خظا");
|
||||
if(institutionContractTemp.RegistrationStatus != "VerifyCodeSent")
|
||||
return op.Failed("خطا");
|
||||
|
||||
if(institutionContractTemp.VerifyCodeEndTime < DateTime.Now)
|
||||
return op.Failed("کد شما منقضی شده است");
|
||||
|
||||
if(institutionContractTemp.SendVerifyCodeTime < DateTime.Now && institutionContractTemp.VerifyCodeEndTime >= DateTime.Now)
|
||||
{
|
||||
if (institutionContractTemp.VerifyCode == verifyCode)
|
||||
{
|
||||
|
||||
|
||||
return op.Succcedded();
|
||||
}
|
||||
else
|
||||
{
|
||||
return op.Failed("کد وارد شده صحیح نیست");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return op.Failed("کد وارد شده صحیح نیست");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// تکمیل پرداخت
|
||||
/// </summary>
|
||||
/// <param name="contractingPartyTempId"></param>
|
||||
/// <param name="verifyCode"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<OperationResult> PayOffCompleted(long contractingPartyTempId)
|
||||
{
|
||||
var op = new OperationResult();
|
||||
return op.Succcedded();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -70,4 +70,30 @@ public class ContractingPartyTempRepository : RepositoryBase<long, ContractingPa
|
||||
}).FirstOrDefault(x => x.NationalCode == nationalCode);
|
||||
|
||||
}
|
||||
public ContractingPartyTempViewModel GetByContractingPartyTempId(long contractingPartyTempId)
|
||||
{
|
||||
return _context.ContractingPartyTemps.Select(x => new ContractingPartyTempViewModel
|
||||
{
|
||||
Id = x.id,
|
||||
DateOfBirth = x.DateOfBirth,
|
||||
DateOfBirthFa = x.DateOfBirth.ToFarsi(),
|
||||
IdNumberSeri = x.IdNumberSeri,
|
||||
IdNumberSerial = x.IdNumberSerial,
|
||||
Address = x.Address,
|
||||
City = x.City,
|
||||
FatherName = x.FatherName,
|
||||
FName = x.FName,
|
||||
LName = x.LName,
|
||||
Gender = x.Gender,
|
||||
NationalCode = x.NationalCode,
|
||||
IdNumber = x.IdNumber,
|
||||
Phone = x.Phone,
|
||||
State = x.State,
|
||||
|
||||
|
||||
}).FirstOrDefault(x => x.Id == contractingPartyTempId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -15,10 +15,10 @@ public class SmsResultRepository : RepositoryBase<long, SmsResult> , ISmsResultR
|
||||
_context = context;
|
||||
}
|
||||
|
||||
public List<SmsResultViewModel> Search(SmsResultSearchModel searchModel)
|
||||
public List<App.Contracts.SmsResult.SmsResultViewModel> Search(SmsResultSearchModel searchModel)
|
||||
{
|
||||
|
||||
var query = _context.SmsResults.Select(x => new SmsResultViewModel()
|
||||
var query = _context.SmsResults.Select(x => new App.Contracts.SmsResult.SmsResultViewModel()
|
||||
{
|
||||
Id = x.id,
|
||||
MessageId = x.MessageId,
|
||||
|
||||
@@ -85,71 +85,132 @@ namespace ServiceHost.Pages
|
||||
//اصلاحات محاصبه پایه سنوات در فیش حقوقی
|
||||
//_yearlySalaryRepository.TestDayliFeeCompute();
|
||||
bool ex = false;
|
||||
//while (!ex)
|
||||
//{
|
||||
// Console.WriteLine("enter National code ... ");
|
||||
// var nationalCode = Console.ReadLine();
|
||||
// Console.WriteLine("enter DateOfBirth ... ");
|
||||
// var dateOfBirth = Console.ReadLine();
|
||||
// Console.WriteLine("enter phoneNumber ... ");
|
||||
// var phone = Console.ReadLine();
|
||||
// var res = _clientRegistrationApplication.CreateContractingPartyTemp(nationalCode, dateOfBirth, phone).GetAwaiter().GetResult();
|
||||
// if (res.IsSuccedded)
|
||||
// {
|
||||
// var updateAddress =
|
||||
// _clientRegistrationApplication.UpdateAddress(res.Data.Id, "gilan", "rasht", "hajiabad").GetAwaiter().GetResult();
|
||||
// if (updateAddress.IsSuccedded)
|
||||
// {
|
||||
// var workshopSelected = _clientRegistrationApplication.GetWorkshopTemp(res.Data.Id).GetAwaiter().GetResult();
|
||||
// if (workshopSelected.Count > 0)
|
||||
// {
|
||||
// var result = _clientRegistrationApplication.GetTotalPaymentAndWorkshopList(res.Data.Id,"12","OneTime").GetAwaiter().GetResult();
|
||||
// Console.WriteLine("sumOfWorkshopPayment : " + result.SumOfWorkshopsPaymentDouble);
|
||||
// Console.WriteLine("TotalPaymentDouble : " + result.TotalPaymentDouble);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var workshops = new List<WorkshopTempViewModel>();
|
||||
// workshops.Add(new WorkshopTempViewModel
|
||||
// {
|
||||
// ContractAndCheckout = true,
|
||||
// ContractingPartyTempId = res.Data.Id,
|
||||
// CountPerson = 10,
|
||||
// CustomizeCheckout = true,
|
||||
// Insurance = true,
|
||||
// RollCall = true,
|
||||
// WorkshopName = "dadmehr",
|
||||
while (!ex)
|
||||
{
|
||||
Console.WriteLine("enter National code ... ");
|
||||
var nationalCode = Console.ReadLine();
|
||||
Console.WriteLine("enter DateOfBirth ... ");
|
||||
var dateOfBirth = Console.ReadLine();
|
||||
Console.WriteLine("enter phoneNumber ... ");
|
||||
var phone = Console.ReadLine();
|
||||
var res = await _clientRegistrationApplication.CreateContractingPartyTemp(nationalCode, dateOfBirth,
|
||||
phone);
|
||||
if (res.IsSuccedded)
|
||||
{
|
||||
var updateAddress =await
|
||||
_clientRegistrationApplication.UpdateAddress(res.Data.Id, "gilan", "rasht", "hajiabad");
|
||||
if (updateAddress.IsSuccedded)
|
||||
{
|
||||
var workshopSelected = _clientRegistrationApplication.GetWorkshopTemp(res.Data.Id).GetAwaiter().GetResult();
|
||||
if (workshopSelected.Count > 0)
|
||||
{
|
||||
var result = await
|
||||
_clientRegistrationApplication.GetTotalPaymentAndWorkshopList(res.Data.Id, "12",
|
||||
"OneTime");
|
||||
Console.WriteLine("sumOfWorkshopPayment : " + result.SumOfWorkshopsPaymentDouble);
|
||||
Console.WriteLine("TotalPaymentDouble : " + result.TotalPaymentDouble);
|
||||
var createInstitutionContract = await
|
||||
_clientRegistrationApplication.CreateOrUpdateInstitutionContractTemp(res.Data.Id, null,
|
||||
null, result.TotalPaymentDouble, 0);
|
||||
if (createInstitutionContract.IsSuccedded)
|
||||
{
|
||||
var sendVerfyCode =await _clientRegistrationApplication.ReceivedCodeFromServer(res.Data.Id);
|
||||
if (sendVerfyCode.IsSuccedded)
|
||||
{
|
||||
Console.WriteLine("enter the code ... ");
|
||||
var codeReceived = Console.ReadLine();
|
||||
|
||||
// });
|
||||
// workshops.Add(new WorkshopTempViewModel
|
||||
// {
|
||||
// ContractAndCheckout = true,
|
||||
// ContractingPartyTempId = res.Data.Id,
|
||||
// CountPerson = 20,
|
||||
// CustomizeCheckout = true,
|
||||
// Insurance = true,
|
||||
// RollCall = true,
|
||||
// WorkshopName = "kababMahdi",
|
||||
var completeSms = await
|
||||
_clientRegistrationApplication.CheckVerifyCodeIsTrue(res.Data.Id, codeReceived);
|
||||
if (completeSms.IsSuccedded)
|
||||
{
|
||||
var payOffCompleted =
|
||||
await _clientRegistrationApplication.PayOffCompleted(res.Data.Id);
|
||||
if (payOffCompleted.IsSuccedded)
|
||||
{
|
||||
Console.WriteLine("finaly completed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(payOffCompleted.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// });
|
||||
// var creteWorkshops = _clientRegistrationApplication.CreateOrUpdateWorkshopTemp(workshops)
|
||||
// .GetAwaiter().GetResult();
|
||||
}
|
||||
else
|
||||
{
|
||||
var workshops = new List<WorkshopTempViewModel>();
|
||||
workshops.Add(new WorkshopTempViewModel
|
||||
{
|
||||
ContractAndCheckout = true,
|
||||
ContractingPartyTempId = res.Data.Id,
|
||||
CountPerson = 10,
|
||||
CustomizeCheckout = true,
|
||||
Insurance = true,
|
||||
RollCall = true,
|
||||
WorkshopName = "dadmehr",
|
||||
|
||||
// if (creteWorkshops.IsSuccedded)
|
||||
// {
|
||||
// var result = _clientRegistrationApplication.GetTotalPaymentAndWorkshopList(res.Data.Id).GetAwaiter().GetResult();
|
||||
// Console.WriteLine("sumOfWorkshopPayment : " + result.SumOfWorkshopsPaymentDouble);
|
||||
// Console.WriteLine("TotalPaymentDouble : " + result.TotalPaymentDouble);
|
||||
// }
|
||||
// }
|
||||
});
|
||||
workshops.Add(new WorkshopTempViewModel
|
||||
{
|
||||
ContractAndCheckout = true,
|
||||
ContractingPartyTempId = res.Data.Id,
|
||||
CountPerson = 20,
|
||||
CustomizeCheckout = true,
|
||||
Insurance = true,
|
||||
RollCall = true,
|
||||
WorkshopName = "kababMahdi",
|
||||
|
||||
// }
|
||||
// }
|
||||
// Console.WriteLine("do you want to exit ... ");
|
||||
// var exitCheck = Console.ReadLine();
|
||||
// if (exitCheck == "yes")
|
||||
// ex = true;
|
||||
//}
|
||||
});
|
||||
var creteWorkshops = _clientRegistrationApplication.CreateOrUpdateWorkshopTemp(workshops)
|
||||
.GetAwaiter().GetResult();
|
||||
|
||||
if (creteWorkshops.IsSuccedded)
|
||||
{
|
||||
var result = _clientRegistrationApplication.GetTotalPaymentAndWorkshopList(res.Data.Id).GetAwaiter().GetResult();
|
||||
Console.WriteLine("sumOfWorkshopPayment : " + result.SumOfWorkshopsPaymentDouble);
|
||||
Console.WriteLine("TotalPaymentDouble : " + result.TotalPaymentDouble);
|
||||
|
||||
var createInstitutionContract = await
|
||||
_clientRegistrationApplication.CreateOrUpdateInstitutionContractTemp(res.Data.Id, null,
|
||||
null, result.TotalPaymentDouble, 0);
|
||||
if (createInstitutionContract.IsSuccedded)
|
||||
{
|
||||
var sendVerfyCode = await _clientRegistrationApplication.ReceivedCodeFromServer(res.Data.Id);
|
||||
if (sendVerfyCode.IsSuccedded)
|
||||
{
|
||||
Console.WriteLine("enter the code ... ");
|
||||
var codeReceived = Console.ReadLine();
|
||||
|
||||
var completeSms = await
|
||||
_clientRegistrationApplication.CheckVerifyCodeIsTrue(res.Data.Id, codeReceived);
|
||||
if (completeSms.IsSuccedded)
|
||||
{
|
||||
var payOffCompleted =
|
||||
await _clientRegistrationApplication.PayOffCompleted(res.Data.Id);
|
||||
if (payOffCompleted.IsSuccedded)
|
||||
{
|
||||
Console.WriteLine("finaly completed");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(payOffCompleted.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Console.WriteLine("do you want to exit ... ");
|
||||
var exitCheck = Console.ReadLine();
|
||||
if (exitCheck == "y")
|
||||
ex = true;
|
||||
}
|
||||
|
||||
// while (!ex)
|
||||
// {
|
||||
|
||||
Reference in New Issue
Block a user