From d302f92dc3c43dc229705d6e8490231e9382fe3b Mon Sep 17 00:00:00 2001 From: Leeza Baidar Date: Wed, 18 Oct 2023 21:10:05 +0545 Subject: [PATCH] #20532 updated --- .../AccountBusiness/AccountBusiness.cs | 72 +++++++-------- .../RegisterBusiness/RegisterBusiness.cs | 89 +++++++++---------- .../Controllers/AccountController.cs | 12 --- 3 files changed, 80 insertions(+), 93 deletions(-) diff --git a/CustomerOnlineV2/CustomerOnlineV2.Business/Business/AccountBusiness/AccountBusiness.cs b/CustomerOnlineV2/CustomerOnlineV2.Business/Business/AccountBusiness/AccountBusiness.cs index 905b14e..80d7502 100644 --- a/CustomerOnlineV2/CustomerOnlineV2.Business/Business/AccountBusiness/AccountBusiness.cs +++ b/CustomerOnlineV2/CustomerOnlineV2.Business/Business/AccountBusiness/AccountBusiness.cs @@ -142,43 +142,43 @@ namespace CustomerOnlineV2.Business.Business.AccountBusiness _logger.LogDebug("SubmitOTP | DB RESPONSE : " + JsonConvert.SerializeObject(jsonRx)); - if (jsonRx.ErrorCode.Equals("0")) - { + //if (jsonRx.ErrorCode.Equals("0")) + //{ - List bodyMappings = new List(); - - bodyMappings.Add(new Mapping() { SValue = "CustomerName", SText = loginDetails.FullName }); - bodyMappings.Add(new Mapping() { SValue = "CustomerId", SText = loginDetails.MembershipId.ToString() }); - bodyMappings.Add(new Mapping() { SValue = "UserId", SText = loginDetails.MembershipId }); - bodyMappings.Add(new Mapping() { SValue = "FirstName", SText = loginDetails.FullName }); - bodyMappings.Add(new Mapping() { SValue = "MiddleName", SText = loginDetails.FullName }); - bodyMappings.Add(new Mapping() { SValue = "LastName", SText = loginDetails.FullName }); - bodyMappings.Add(new Mapping() { SValue = "MobileNo", SText = loginDetails.MobileNumber }); - bodyMappings.Add(new Mapping() { SValue = "Address", SText = loginDetails.UserName }); - bodyMappings.Add(new Mapping() { SValue = "EMAIL_ID", SText = loginDetails.Email }); - bodyMappings.Add(new Mapping() { SValue = "RegisteredDate", SText = "" }); - - SendNotificationRequest request = new SendNotificationRequest() - { - IsBulkNotification = false, - UserName = loginDetails.Email, - ProviderId = "BasicRegistration", - NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(), - Template = NotifyTemplate.BASIC_REGISTRATION_EMAIL, - Recipients = new List() - { - new RecipientViewModel() - { - NotificationContent = new NotificationDTO() { - Body = JsonConvert.SerializeObject(bodyMappings), - //Title will be set by mapping json - }, - Address= loginDetails.Email - } - } - }; - jsonRx = NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL); - } + // List bodyMappings = new List(); + + // bodyMappings.Add(new Mapping() { SValue = "CustomerName", SText = loginDetails.FullName }); + // bodyMappings.Add(new Mapping() { SValue = "CustomerId", SText = loginDetails.MembershipId.ToString() }); + // bodyMappings.Add(new Mapping() { SValue = "UserId", SText = loginDetails.MembershipId }); + // bodyMappings.Add(new Mapping() { SValue = "FirstName", SText = loginDetails.FullName }); + // bodyMappings.Add(new Mapping() { SValue = "MiddleName", SText = loginDetails.FullName }); + // bodyMappings.Add(new Mapping() { SValue = "LastName", SText = loginDetails.FullName }); + // bodyMappings.Add(new Mapping() { SValue = "MobileNo", SText = loginDetails.MobileNumber }); + // bodyMappings.Add(new Mapping() { SValue = "Address", SText = loginDetails.UserName }); + // bodyMappings.Add(new Mapping() { SValue = "EMAIL_ID", SText = loginDetails.Email }); + // bodyMappings.Add(new Mapping() { SValue = "RegisteredDate", SText = "" }); + + // SendNotificationRequest request = new SendNotificationRequest() + // { + // IsBulkNotification = false, + // UserName = loginDetails.Email, + // ProviderId = "BasicRegistration", + // NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(), + // Template = NotifyTemplate.BASIC_REGISTRATION_EMAIL, + // Recipients = new List() + // { + // new RecipientViewModel() + // { + // NotificationContent = new NotificationDTO() { + // Body = JsonConvert.SerializeObject(bodyMappings), + // //Title will be set by mapping json + // }, + // Address= loginDetails.Email + // } + // } + // }; + // jsonRx = NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL); + //} //return jsonRx; return await Task.FromResult(jsonRx); diff --git a/CustomerOnlineV2/CustomerOnlineV2.Business/Business/RegisterBusiness/RegisterBusiness.cs b/CustomerOnlineV2/CustomerOnlineV2.Business/Business/RegisterBusiness/RegisterBusiness.cs index 35b25a0..ca85733 100644 --- a/CustomerOnlineV2/CustomerOnlineV2.Business/Business/RegisterBusiness/RegisterBusiness.cs +++ b/CustomerOnlineV2/CustomerOnlineV2.Business/Business/RegisterBusiness/RegisterBusiness.cs @@ -37,53 +37,52 @@ namespace CustomerOnlineV2.Business.Business.RegisterBusiness public async Task AddCustomers(OnlineCustomerRegisterModel register) { var model1 = await _registerRepository.AddRegisterDetails(register); - return model1; - //try - //{ - // if (model1.ErrorCode.Equals("0")) - // { - // List bodyMappings = new List(); + try + { + if (model1.ErrorCode.Equals("0")) + { + List bodyMappings = new List(); - // bodyMappings.Add(new Mapping() { SValue = "CustomerName", SText = register.fullName }); - // bodyMappings.Add(new Mapping() { SValue = "CustomerId", SText = "" }); - // bodyMappings.Add(new Mapping() { SValue = "UserId", SText = register.membershipId }); - // bodyMappings.Add(new Mapping() { SValue = "FirstName", SText = register.firstName }); - // bodyMappings.Add(new Mapping() { SValue = "MiddleName", SText = register.middleName }); - // bodyMappings.Add(new Mapping() { SValue = "LastName", SText = register.lastName1 }); - // bodyMappings.Add(new Mapping() { SValue = "MobileNo", SText = register.mobile }); - // bodyMappings.Add(new Mapping() { SValue = "Address", SText = register.address }); - // bodyMappings.Add(new Mapping() { SValue = "EMAIL_ID", SText = register.email }); - // bodyMappings.Add(new Mapping() { SValue = "RegisteredDate", SText = "" }); + bodyMappings.Add(new Mapping() { SValue = "CustomerName", SText = register.fullName }); + bodyMappings.Add(new Mapping() { SValue = "CustomerId", SText = "" }); + bodyMappings.Add(new Mapping() { SValue = "UserId", SText = register.membershipId }); + bodyMappings.Add(new Mapping() { SValue = "FirstName", SText = register.firstName }); + bodyMappings.Add(new Mapping() { SValue = "MiddleName", SText = register.middleName }); + bodyMappings.Add(new Mapping() { SValue = "LastName", SText = register.lastName1 }); + bodyMappings.Add(new Mapping() { SValue = "MobileNo", SText = register.mobile }); + bodyMappings.Add(new Mapping() { SValue = "Address", SText = register.address }); + bodyMappings.Add(new Mapping() { SValue = "EMAIL_ID", SText = register.email }); + bodyMappings.Add(new Mapping() { SValue = "RegisteredDate", SText = "" }); - // SendNotificationRequest request = new SendNotificationRequest() - // { - // IsBulkNotification = false, - // UserName = register.email, - // ProviderId = "BasicRegistration", - // NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(), - // Template = Common.Models.Notification.NotifyTemplate.BASIC_REGISTRATION_EMAIL, - // Recipients = new List() - // { - // new RecipientViewModel() - // { - // NotificationContent = new NotificationDTO() { - // Body = JsonConvert.SerializeObject(bodyMappings), - // //Title will be set by mapping json - // }, - // Address= register.email - // } - // } - // }; - // var model = NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL); - // } - // return model1; - //} - //catch (Exception ex) - //{ - // _logger.LogError("Something Went Wrong, Please Try Again!!", ex); - // model1.SetResponse("1", "Error occurred while calling RequestOTP."); - // return model1; - //} + SendNotificationRequest request = new SendNotificationRequest() + { + IsBulkNotification = false, + UserName = register.email, + ProviderId = "BasicRegistration", + NotificationTypeId = NOTIFICATION_TYPE.EMAIL.ToString(), + Template = Common.Models.Notification.NotifyTemplate.BASIC_REGISTRATION_EMAIL, + Recipients = new List() + { + new RecipientViewModel() + { + NotificationContent = new NotificationDTO() { + Body = JsonConvert.SerializeObject(bodyMappings), + //Title will be set by mapping json + }, + Address= register.email + } + } + }; + var model = NotifierV2.SendNotification(request, NOTIFICATION_TYPE.EMAIL); + } + return model1; + } + catch (Exception ex) + { + _logger.LogError("Something Went Wrong, Please Try Again!!", ex); + model1.SetResponse("1", "Error occurred while calling RequestOTP."); + return model1; + } } public Task GetAddressList(AddressRequest addressRequest) diff --git a/CustomerOnlineV2/CustomerOnlineV2/Controllers/AccountController.cs b/CustomerOnlineV2/CustomerOnlineV2/Controllers/AccountController.cs index 09e3c8a..6025f2b 100644 --- a/CustomerOnlineV2/CustomerOnlineV2/Controllers/AccountController.cs +++ b/CustomerOnlineV2/CustomerOnlineV2/Controllers/AccountController.cs @@ -271,18 +271,6 @@ namespace CustomerOnlineV2.Controllers if (response.ErrorCode == ResponseHelper.SUCCESS.ToString()) { - var currentUser = HttpContext.User as ClaimsPrincipal; - var identity = currentUser?.Identity as ClaimsIdentity; - if (identity != null) - { - var isEmailVerifiedClaim = identity.FindFirst("IsEmailVerified"); - if (isEmailVerifiedClaim != null) - { - identity.RemoveClaim(isEmailVerifiedClaim); - } - identity.AddClaim(new Claim("IsEmailVerified", "true")); - - } Log.Debug("ACCOUNTCONTROLLER | VERIFYOTP | REQUEST ARRIVED | " + loginDetails.Email); return RedirectToAction("Index", "Home"); }