Browse Source

Fix zip code update

feature/19315_Customer-Registration
shakun 11 months ago
parent
commit
54952cdd4d
  1. 94
      CustomerOnlineV2/CustomerOnlineV2.Business/Business/AccountBusiness/AccountBusiness.cs
  2. 2
      CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/AccountRepository/AccountRepository.cs
  3. 4
      CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/HomeRepository/HomeRepository.cs
  4. 2
      CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/RegisterRepository/RegisterRepository.cs
  5. 37
      CustomerOnlineV2/CustomerOnlineV2/Views/Customer/CustomerProfile.cshtml
  6. 31
      CustomerOnlineV2/CustomerOnlineV2/Views/Home/Index.cshtml
  7. 10
      CustomerOnlineV2/CustomerOnlineV2/Views/Shared/_Layout.cshtml
  8. 8
      CustomerOnlineV2/CustomerOnlineV2/Views/Shared/_Layout2.cshtml
  9. 1
      CustomerOnlineV2/CustomerOnlineV2/wwwroot/css/styles-login.css

94
CustomerOnlineV2/CustomerOnlineV2.Business/Business/AccountBusiness/AccountBusiness.cs

@ -1,7 +1,15 @@
using CustomerOnlineV2.Common.Models;
using CustomerOnlineV2.Common.Helper;
using CustomerOnlineV2.Common.Models;
using CustomerOnlineV2.Common.Models.AccountModel;
using CustomerOnlineV2.Common.Models.HomeModel;
using CustomerOnlineV2.Common.Models.Notification;
using CustomerOnlineV2.Repository.Repository.AccountRepository;
using Microsoft.Extensions.Logging;
using Microsoft.IdentityModel.Tokens;
using Notify = Azure.Core.HttpHeader;
using Newtonsoft.Json;
using static CustomerOnlineV2.Common.Models.Notification.PasswordGenerator;
namespace CustomerOnlineV2.Business.Business.AccountBusiness
{
@ -32,7 +40,91 @@ namespace CustomerOnlineV2.Business.Business.AccountBusiness
}
public async Task<CommonResponse> PasswordReset(PasswordResetModel model, LoginResponse logindetails)
{
//var randomPassword = PasswordGenerator.GenerateRandomPassword();
//model.RandomPassword = randomPassword;
SendNotificationRequest request = new SendNotificationRequest()
{
IsBulkNotification = false,
UserName = model.Username,
//ProcessId = processId,
ProviderId = "ResetPassword",
NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(),
//Template = Common.Model.Enum.NotifyTemplate.RESET_PASSWORD_EMAIL,
Recipients = new List<RecipientViewModel>()
{
new RecipientViewModel()
{
NotificationContent = new NotificationDTO() {
// Body = JsonConvert.SerializeObject(bodyMappings),
//Title will be set by mapping json
},
Address= model.Username
}
}
};
return await _accountRepo.PasswordReset(model, logindetails);
}
public static string GenerateRandomPassword(PasswordOptions opts = null)
{
if (opts == null) opts = new PasswordOptions()
{
RequiredLength = 8,
RequiredUniqueChars = 4,
RequireDigit = true,
RequireLowercase = true,
RequireNonAlphanumeric = true,
RequireUppercase = true
};
string[] randomChars = new[] {
"ABCDEFGHJKMNPQRSTUVWXYZ", // uppercase
"abcdefghjkmnpqrstuvwxyz", // lowercase
"23456789", // digits
"@#" // non-alphanumeric
};
string[] randomChars1 = new[] {
// uppercase
"abcdefghjkmnpqrstuvwxyz", // lowercase
"23456789", // digits
// non-alphanumeric
};
Random rand = new Random();
List<char> chars = new List<char>();
if (opts.RequireUppercase)
chars.Insert(rand.Next(0, chars.Count),
randomChars[0][rand.Next(0, randomChars[0].Length)]);
if (opts.RequireLowercase)
chars.Insert(rand.Next(0, chars.Count),
randomChars[1][rand.Next(0, randomChars[1].Length)]);
if (opts.RequireDigit)
chars.Insert(rand.Next(0, chars.Count),
randomChars[2][rand.Next(0, randomChars[2].Length)]);
if (opts.RequireNonAlphanumeric)
chars.Insert(rand.Next(0, chars.Count),
randomChars[3][rand.Next(0, randomChars[3].Length)]);
for (int i = chars.Count; i < opts.RequiredLength
|| chars.Distinct().Count() < opts.RequiredUniqueChars; i++)
{
string rcs = randomChars1[rand.Next(0, randomChars1.Length)];
chars.Insert(rand.Next(0, chars.Count),
rcs[rand.Next(0, rcs.Length)]);
}
return new string(chars.ToArray());
}
}
}

2
CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/AccountRepository/AccountRepository.cs

@ -53,6 +53,8 @@ namespace CustomerOnlineV2.Repository.Repository.AccountRepository
_response.FullName = Convert.ToString(dr["fullName"]);
_response.GoogleAuthCode = "";
_response.MobileNumber = Convert.ToString(dr["mobile"]);
_response.MembershipId = Convert.ToString(dr["membershipId"]);
_response.RewardPoints = Convert.ToString(dr["rewardPoints"]);
_response.RememberMe = model.RememberMe;
_response.SessionId = model.SessionId;
}

4
CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/HomeRepository/HomeRepository.cs

@ -194,7 +194,9 @@ namespace CustomerOnlineV2.Repository.Repository.HomeRepository
pCountry = Convert.ToString(item["pCountry"]),
Id = Convert.ToString(item["Id"]),
TransactionDay = Convert.ToString(item["tranDate"]),
Status = Convert.ToString(item["Status"])
Rate = Convert.ToString(item["customerRate"]),
Status = Convert.ToString(item["Status"]),
receiverName = Convert.ToString(item["ReceiverName"])
});
}
_response.CustomerTransaction = obj;

2
CustomerOnlineV2/CustomerOnlineV2.Repository/Repository/RegisterRepository/RegisterRepository.cs

@ -212,7 +212,7 @@ namespace CustomerOnlineV2.Repository.Repository.RegisterRepository
sql += ",@customerId =" + _connHelper.FilterString(id);
sql += ",@postalCode =" + _connHelper.FilterString(model.zipCode);
//sql += ",@nativeCountry =" + _connHelper.FilterString(model.NativeCountry);
sql += ",@city =" + _connHelper.FilterString(model.city);
sql += ",@address1 =" + _connHelper.FilterString(model.address);
sql += ",@address2 =" + _connHelper.FilterString(model.address2);

37
CustomerOnlineV2/CustomerOnlineV2/Views/Customer/CustomerProfile.cshtml

@ -184,7 +184,7 @@
<tr>
<th>SN</th>
<th>Address1</th>
<th>Address2</th>
<th>City</th>
<th>Action</th>
</tr>
</thead>
@ -205,11 +205,11 @@
</div>
<div class="col-12 col-sm-6">
<label for="input-zone" class="form-label">Address1</label>
<input type="text" class="form-control" asp-for="address" />
<input type="text" class="form-control" id="pAddress1" />
</div>
<div class="col-12 col-sm-6">
<label for="input-zone" class="form-label">Address2</label>
<input type="text" class="form-control" asp-for="address2" />
<input type="text" class="form-control" id="pAddress2" />
</div>
<div class="col-12 mt-4 d-grid"><button class="btn btn-primary" type="submit" onclick="UpdateAddress()">Update Changes</button></div>
@ -564,21 +564,20 @@
var row = $('<tr>');
row.append($('<td>').text(index + 1));
row.append($('<td>').text(item.Address1));
row.append($('<td>').text(item.Address2));
row.append($('<td>').text(item.City));
var selectButton = $('<button>')
.addClass('btn btn-primary')
.text('Select')
.click(function (event) {
var additionalAddress = item.Address1;
var city = item.Address2;
var Address1 = item.Address1;
var city = item.City;
$('#pCity').val(city);
$('#address').val(additionalAddress);
// $('#address2').val(additionalAddress);
$('#pAddress1').val(Address1);
$('#apiDataPopup').modal('hide');
event.preventDefault();
});
@ -642,26 +641,24 @@
data: {
//CustomerId: $("#customerId").val(),
zipCode: $("#postalCode").val(),
address: $("#address").val(),
address2: $("#address2").val(),
city: $("#pCity").val(),
address: $("#pAddress1").val(),
address2: $("#pAddress2").val(),
},
success: function (data) {
if (data === 1) {
alert("Updated Successfully");
success: function (response) {
if (response.responseCode != 0) {
ShowAlertMessageErrorOnly(data, response.responseMessage);
return false;
}
ShowAlertMessage("0", "Address Updated successfully.");
},
error: function (data) {
alert("Sorry Couldn't be updated");
ShowAlertMessageErrorOnly(1, "Error ocurred during update!");
}
}
);
} );
}

31
CustomerOnlineV2/CustomerOnlineV2/Views/Home/Index.cshtml

@ -128,6 +128,7 @@
<div class="my-auto text-center">
<div class="text-17 text-white my-3" id="hpBankName"><i class="fas fa-building"></i></div>
<h3 class="text-4 text-white fw-400 my-3" id="hpAmt"></h3>
@* <h3 class="text-4 text-white fw-400 my-3" id="hpAmt"></h3> *@
<div class="text-8 fw-500 text-white my-4" id="hDate" ></div>
<p class="text-white"></p>
</div>
@ -140,33 +141,39 @@
<hr>
<div class="px-3">
<ul class="list-unstyled">
<li class="mb-2" id="payAmt">Payment Amount <span class="float-end text-3"></span></li>
<li class="mb-2" id="serviceCharge">Fee <span class="float-end text-3"></span></li>
<li class="mb-2" id="payAmt">Collected Amount (GBP) <span class="float-end text-3">GP</span></li>
<li class="mb-2" id="serviceCharge">Service Fee (GBP) <span class="float-end text-3"></span></li>
<li class="mb-2" id="serviceCharge">Reward Amount used (GBP)<span class="float-end text-3"></span></li>
<li class="mb-2" id="tAmt">Total Sent Amount (GBP) <span class="float-end text-3"></span></li>
<li class="mb-2" id="texrate">Ex Rate (GBP-NPR) <span class="float-end text-3"></span></li>
</ul>
<hr class="mb-2">
<p class="d-flex align-items-center fw-500 mb-0" id="tAmt">Total Amount <span class="text-3 ms-auto"></span></p>
<hr class="mb-2">
<p class="d-flex align-items-center fw-500 mb-0" id="tAmtNpr">Total Amount NPR <span class="text-3 ms-auto"></span></p>
<hr class="mb-4 mt-2">
<ul class="list-unstyled">
@* <ul class="list-unstyled">
<li class="fw-500" id="pBankName">Paid By:</li>
<li class="text-muted"></li>
</ul>
</ul> *@
<ul class="list-unstyled">
<li class="fw-500" id="pCountry">Country:</li>
<li class="text-muted"></li>
</ul>
<ul class="list-unstyled">
<li class="fw-500" id="tReceiverName">ReceiverName:</li>
<li class="text-muted"></li>
</ul>
<ul class="list-unstyled">
<li class="fw-500" id="tranId">Transaction ID:</li>
<li class="text-muted"></li>
</ul>
<ul class="list-unstyled">
<li class="fw-500" id="paymentMethod">Description:</li>
<li class="fw-500" id="paymentMethod">Payment Method:</li>
<li class="text-muted"></li>
</ul>
<ul class="list-unstyled">
<li class="fw-500">Status:</li>
<li class="text-muted" id="status"><span class="text-success text-3 ms-1"></span></li>
<li class="fw-500" id="tstatus">Status:</li>
<li class="text-muted"></li>
</ul>
</div>
</div>
@ -425,17 +432,19 @@
var data = response.customerTransaction[0];
$('#hpBankName').text(data.pBankName);
$('#hpAmt').text(data.acAmt);
$('#hpAmt').text(data.pCountry);
$('#hDate').text(data.transactionDay);
$('#payAmt').find('span').text(data.cAmt);
$('#serviceCharge').find('span').text(data.serviceCharge);
$('#tAmt').find('span').text(data.acAmt);
$('#texrate').find('span').text(data.Rate);
$('#tAmtNpr').find('span').text(data.amount);
$('#pBankName').next().text(data.pBankName);
$('#pCountry').next().text(data.pCountry);
$('#tReceiverName').next().text(data.receiverName);
$('#tranId').next().text(data.id);
$('#paymentMethod').next().text(data.paymentMethod);
$('#status').next().text(data.status);
$('#tstatus').next().text(data.status);
// var statusIcon = '<i class="fas fa-check-circle"></i>';
// if (data.Status.toLowerCase() === 'cancel') {
// statusIcon = '<i class="fas fa-times-circle"></i>';

10
CustomerOnlineV2/CustomerOnlineV2/Views/Shared/_Layout.cshtml

@ -170,11 +170,11 @@
<!-- Need Help? -->
<div class="bg-white rounded text-center p-3 mb-4">
<div class="text-17 text-light my-3"><i class="fa fa-bullhorn"></i></div>
<h3 class="text-5 fw-400 my-4">Refer a Friend</h3>
<p class="text-muted opacity-8 mb-4">Refer a Friend and Earn Rewards!</p>
<div class="d-grid">
<a href="/Customer/Refer" class="text-3">Refer a Friend</a>
</div>
<h3 class="text-5 fw-400 my-4"> <a href="/Customer/Refer" class="text-3">Refer & Earn</a></h3>
<p class="text mb-4"><span><strong>@userId</strong></span> Reward Amount</p>
@* <div class="d-grid">
</div> *@
</div>
<!-- Need Help? End -->
</aside>

8
CustomerOnlineV2/CustomerOnlineV2/Views/Shared/_Layout2.cshtml

@ -188,10 +188,12 @@
async: false,
success: function (response) {
if (response.responseCode != 0) {
ShowAlertMessage(response.responseCode, response.responseMessage);
}
// if (response.responseCode != 0) {
// ShowAlertMessage(response.responseCode, response.responseMessage);
// }
if (response.responseCode == 0) {
PopulateNotificationData(response);
}
},
error: function () {
return null;

1
CustomerOnlineV2/CustomerOnlineV2/wwwroot/css/styles-login.css

@ -83,6 +83,7 @@ a, a:focus {
color: #1397e9;
-webkit-transition: all 0.2s ease;
transition: all 0.2s ease;
text-align: right;
}
a:focus{
color: #d60545;

Loading…
Cancel
Save