示例#1
0
        public async Task <ContactDetailsResponse> UpdateUserPassword([FromBody] ContactDetailsRequest request)
        {
            var response = new ContactDetailsResponse();

            if (!string.IsNullOrWhiteSpace(request.Email))
            {
                //response = _UserRepository.GetContactsByEmailId(request);
                response = await _UserRepository.UpdateUserPassword(request);

                if (response != null)
                {
                    response.Status = "Sucess";

                    return(response);
                }
                else
                {
                    response.Status = "Invalid Email";
                    return(response);
                }
            }
            else
            {
                response.Status = "Email Id can not be blank";
                return(response);
            }
        }
示例#2
0
        public void ReturnContactDetailsResponse()
        {
            var domain = new ContactDetailsDomain
            {
                Id               = 1234,
                Type             = "Address",
                ContactValue     = "123456",
                AddedBy          = "test",
                IsActive         = false,
                IsDefault        = false,
                DateLastModified = new DateTime(2020, 04, 23),
                ModifiedBy       = "Tester",
                SubType          = "Home",
                DateAdded        = new DateTime(2021, 05, 21),
                ResidentId       = 12345
            };
            var expectedResponse = new ContactDetailsResponse
            {
                Id               = 1234,
                Type             = "Address",
                Value            = "123456",
                AddedBy          = "test",
                Active           = false,
                Default          = false,
                DateLastModified = new DateTime(2020, 04, 23),
                ModifiedBy       = "Tester",
                SubType          = "Home",
                DateAdded        = new DateTime(2021, 05, 21),
            };

            domain.ToResponse().Should().BeEquivalentTo(expectedResponse);
        }
示例#3
0
        public ContactDetailsResponse UpdateUserDetails([FromBody] ContactDetailsRequest request)
        {
            var response = new ContactDetailsResponse();

            if (!string.IsNullOrWhiteSpace(request.Users.VoyagerUser_Id))
            {
                //response = _UserRepository.GetContactsByEmailId(request);
                response = _UserRepository.UpdateUserDetails(request);

                if (response != null)
                {
                    response.Status = "Sucess";

                    return(response);
                }
                else
                {
                    response.Status = "Invalid Voyager User Id";
                    return(response);
                }
            }
            else
            {
                response.Status = "Voyager User Id can not be blank";
                return(response);
            }
        }
        [Test] // For new Contact Details API
        public void WhenContactDetailsExist_ReturnsContactDetails()
        {
            // Arrange
            ApiGateway client = new ApiGateway(new HttpClientFactoryWrapper(Client));

            var assetResponse = _fixture.Create <AssetResponseObject>();

            MockApiGateway.SetAssetApiResponse(assetResponse);

            var tenureResponse = _fixture.Create <TenureResponseObject>();

            MockApiGateway.SetTenureInformationApiResponse(tenureResponse);

            var propertyReference = _fixture.Create <string>();

            var contactDetailsResponse = new ContactDetailsResponse
            {
                Results = _fixture.CreateMany <ContactDetailsResponseObject>(3)
            };

            MockApiGateway.SetContactDetailsApiResponse(contactDetailsResponse);

            // Act
            var response = client.ExecuteRequest <PropertyResponse>("dummy", new Uri($"/api/v2/properties/{propertyReference}", UriKind.Relative)).Result;

            // Assert
            response.IsSuccess.Should().BeTrue();
            response.Status.Should().Be(HttpStatusCode.OK);

            response.Content.ContactDetails.Should().NotBeNull();
            response.Content.ContactDetails.Should().HaveCount(contactDetailsResponse.Results.Count());
        }
示例#5
0
        public ActionResult Manage()
        {
            string EmailId = HttpContext.Request.Cookies["EmailId"] ?? ckUserEmailId;

            ManageViewModel manageViewModel = new ManageViewModel();

            LoginProviders     objLoginProvider      = new LoginProviders(_configuration);
            UserDetailsRequest objUserDetailsRequest = new UserDetailsRequest();

            objUserDetailsRequest.UserName = EmailId;

            UserDetailsResponse   objUserDetailsResponse = objLoginProvider.GetUserDetails(objUserDetailsRequest, token).Result;
            ContactDetailsRequest req1 = new ContactDetailsRequest()
            {
                Email = EmailId, Users = new mUsers {
                    VoyagerUser_Id = ckLoginUser_Id
                }
            };
            ContactDetailsResponse res1 = objLoginProvider.GetContactDetails(req1, token).Result;

            manageViewModel.Telephone      = res1.Contacts.TEL;
            manageViewModel.MobileNumber   = res1.Contacts.MOBILE;
            manageViewModel.FaxNumber      = res1.Contacts.FAX;
            manageViewModel.WebSite        = res1.Contacts.WEB;
            manageViewModel.VoyagerUser_Id = objUserDetailsResponse.VoyagerUser_Id;
            //manageViewModel.PhotoPath = _configuration.GetValue<string>("SystemSettings:CountryImageInitial") + objUserDetailsResponse.Photo;
            manageViewModel.PhotoPath = _configuration.GetValue <string>("UIBaseUrl") + objUserDetailsResponse.Photo;
            return(View(manageViewModel));
        }
示例#6
0
        public async Task <CostingGetRes> GetCostingDetailsByQRFID(CostingGetReq request)
        {
            //var builder = Builders<mQRFPrice>.Filter;
            //var filter = builder.Where(q => q.QRFID == request.QRFID && q.IsCurrentVersion == true);
            //return await _MongoContext.mQRFPrice.Find(filter).Project(q => new CostingGetProperties
            //{
            //    QRFID = q.QRFID,
            //    VersionId = q.VersionId,
            //    VersionName = q.VersionName,
            //    VersionDescription = q.VersionDescription,
            //    IsCurrentVersion = q.IsCurrentVersion,
            //    SalesOfficer = q.SalesOfficer,
            //    CostingOfficer = q.CostingOfficer,
            //    ProductAccountant = q.ProductAccountant,
            //    AgentInfo = q.AgentInfo,
            //    AgentProductInfo = q.AgentProductInfo,
            //    AgentPassengerInfo = q.AgentPassengerInfo,
            //    AgentRoom = q.QRFAgentRoom,
            //    DepartureDates = q.Departures,
            //}).FirstOrDefaultAsync();

            CostingGetRes response = new CostingGetRes();
            var           qrfprice = _MongoContext.mQRFPrice.AsQueryable().Where(x => x.QRFID == request.QRFID && x.IsCurrentVersion == true).OrderByDescending(y => y.VersionId).FirstOrDefault();

            response.CostingGetProperties.QRFID                  = qrfprice.QRFID;
            response.CostingGetProperties.QRFPriceID             = qrfprice.QRFPrice_Id;
            response.CostingGetProperties.VersionId              = qrfprice.VersionId;
            response.CostingGetProperties.VersionName            = qrfprice.VersionName;
            response.CostingGetProperties.VersionDescription     = qrfprice.VersionDescription;
            response.CostingGetProperties.IsCurrentVersion       = qrfprice.IsCurrentVersion;
            response.CostingGetProperties.SalesOfficer           = qrfprice.SalesOfficer;
            response.CostingGetProperties.CostingOfficer         = qrfprice.CostingOfficer;
            response.CostingGetProperties.ProductAccountant      = qrfprice.ProductAccountant;
            response.CostingGetProperties.ValidForAcceptance     = qrfprice.ValidForAcceptance;
            response.CostingGetProperties.ValidForTravel         = qrfprice.ValidForTravel;
            response.CostingGetProperties.AgentInfo              = qrfprice.AgentInfo;
            response.CostingGetProperties.AgentProductInfo       = qrfprice.AgentProductInfo;
            response.CostingGetProperties.AgentPassengerInfo     = qrfprice.AgentPassengerInfo;
            response.CostingGetProperties.AgentRoom              = qrfprice.QRFAgentRoom;
            response.CostingGetProperties.DepartureDates         = qrfprice.Departures;
            response.CostingGetProperties.FollowUpCostingOfficer = qrfprice.FollowUpCostingOfficer;
            response.CostingGetProperties.FollowUpWithClient     = qrfprice.FollowUpWithClient;

            ContactDetailsResponse objContactDetailsRes = _userRepository.GetContactsByEmailId(new ContactDetailsRequest {
                Email = qrfprice.SalesOfficer
            });

            if (objContactDetailsRes != null && objContactDetailsRes.Contacts != null)
            {
                response.CostingGetProperties.SalesOfficerMobile = !string.IsNullOrEmpty(objContactDetailsRes.Contacts.MOBILE) ? objContactDetailsRes.Contacts.MOBILE : objContactDetailsRes.Contacts.TEL;
            }

            response.EnquiryPipeline = _MongoContext.mQuote.AsQueryable().Where(x => x.QRFID == request.QRFID).Select(y => y.CurrentPipeline).FirstOrDefault();

            bool IsLinkedQRFsExist = _quoteRepository.ChcekLinkedQRFsExist(request.QRFID).Result;

            response.IsLinkedQRFsExist = IsLinkedQRFsExist;
            return(response);
        }
示例#7
0
        public async Task <ContactDetailsResponse> UpdateUserDetails(ContactDetailsRequest objUserDetailsRequest, string ticket)
        {
            ContactDetailsResponse objContactDetailsResponse = new ContactDetailsResponse();

            objContactDetailsResponse = await serviceProxy.PostData(_configuration.GetValue <string>("ServiceSetUserDetails"), objUserDetailsRequest, typeof(ContactDetailsResponse), ticket);

            return(objContactDetailsResponse);
        }
示例#8
0
        public void EntitiesHaveADateAdded()
        {
            var entity = new ContactDetailsResponse();
            var date   = new DateTime(2019, 02, 21);

            entity.DateAdded = date;

            entity.DateAdded.Should().BeSameDateAs(date);
        }
        public void CreateRecordReturns201IfSuccessful()
        {
            var useCaseResponse = new ContactDetailsResponse();

            _mockCreateContactDetails.Setup(x => x.Execute(It.IsAny <ResidentContact>())).Returns(useCaseResponse);
            var result = _classUnderTest.CreateContactRecord(It.IsAny <ResidentContact>()) as CreatedAtActionResult;

            result.Should().NotBeNull();
            result.Value.Should().BeEquivalentTo(useCaseResponse);
            result.StatusCode.Should().Be(201);
        }
示例#10
0
        public void ContactDetailsResponse_ToDomain_MapsToDomainObject()
        {
            // Arrange
            var numberOfContacts = _random.Next(2, 5);

            var apiResults = _fixture.Build <ContactDetailsResponseObject>()
                             .With(x => x.ContactInformation, GenerateContactInformation(ContactType.phone))
                             .CreateMany(numberOfContacts)
                             .ToList();

            apiResults.Last().ContactInformation = GenerateContactInformation(ContactType.address);

            var model = new ContactDetailsResponse
            {
                Results = apiResults
            };


            var householdMember = _fixture.Create <HouseholdMember>();

            // Act
            var result = model.ToDomain(householdMember);

            // Assert
            result.Should().NotBeNull();
            result.FullName.Should().Be(householdMember.FullName);
            result.TenureType.Should().Be(householdMember.PersonTenureType);

            result.PhoneNumbers.Should().HaveCount(numberOfContacts - 1);

            for (int i = 0; i < result.PhoneNumbers.Count; i++)
            {
                var phoneNumber = result.PhoneNumbers[i];

                phoneNumber.ContactType.Should().Be(apiResults[i].ContactInformation.ContactType.ToString());
                phoneNumber.Value.Should().Be(apiResults[i].ContactInformation.Value);
                phoneNumber.Description.Should().Be(apiResults[i].ContactInformation.Description);
            }
        }
示例#11
0
        public IActionResult ProposalCoveringNote(string QRFID)
        {
            ProposalCoveringNoteViewModel model = new ProposalCoveringNoteViewModel();

            #region Get Proposal Details by QRFId
            proposalGetReq       = new ProposalGetReq();
            proposalGetReq.QRFID = QRFID;
            proposalGetRes       = coProviders.GetProposal(proposalGetReq, token).Result;
            //model.CoveringNote = proposalGetRes.Proposal.CoveringNote;
            model.ProposalIncludeRegions = proposalGetRes.Proposal.ProposalIncludeRegions;
            model.CoveringNote           = model.CoveringNote != null?ReplaceCoveringNoteTableOfContents(proposalGetRes.Proposal.CoveringNote, proposalGetRes.Proposal.ProposalIncludeRegions) : null;

            #endregion

            #region Get Quote Info By QRFId
            SalesProviders   objSalesProvider   = new SalesProviders(_configuration);
            QuoteAgentGetReq objQRFAgentRequest = new QuoteAgentGetReq()
            {
                QRFID = QRFID
            };
            QuoteAgentGetRes        objQRFAgentResponse = objSalesProvider.GetQRFAgentByQRFID(objQRFAgentRequest, token).Result;
            QuoteAgentGetProperties objResult           = objQRFAgentResponse.QuoteAgentGetProperties;

            model.QRFID               = QRFID;
            model.CompanyName         = !string.IsNullOrEmpty(objQRFAgentResponse.QuoteAgentGetProperties.SalesPersonCompany) ? objQRFAgentResponse.QuoteAgentGetProperties.SalesPersonCompany : "";
            model.Destination         = !string.IsNullOrEmpty(objResult.AgentProductInfo.Destination) && objResult.AgentProductInfo.Destination.Contains('|') ? objResult.AgentProductInfo.Destination.Split('|')[1] : "";
            model.SalesPersonUserName = !string.IsNullOrEmpty(objQRFAgentResponse.QuoteAgentGetProperties.SalesPersonUserName) ? objQRFAgentResponse.QuoteAgentGetProperties.SalesPersonUserName : "";
            #endregion

            #region Agent Person Binding
            var agentContactPersonId   = objResult.AgentInfo.ContactPersonID;
            AgentContactDetailsReq req = new AgentContactDetailsReq()
            {
                VoyagerContact_Id = agentContactPersonId
            };
            AgentContactDetailsRes res = objSalesProvider.GetContactDetailsByContactID(req, token).Result;

            model.AgentTitle     = res.AgentContactDetailsProperties != null && !string.IsNullOrEmpty(res.AgentContactDetailsProperties.CommonTitle) ? res.AgentContactDetailsProperties.CommonTitle : "";
            model.AgentFirstName = res.AgentContactDetailsProperties != null && !string.IsNullOrEmpty(res.AgentContactDetailsProperties.FirstName) ? res.AgentContactDetailsProperties.FirstName : "";
            model.AgentLastName  = res.AgentContactDetailsProperties != null && !string.IsNullOrEmpty(res.AgentContactDetailsProperties.LastName) ? res.AgentContactDetailsProperties.LastName : "";
            #endregion

            #region Sales Person Details Binding
            var salesPersonContactEmail = objQRFAgentResponse.QuoteAgentGetProperties.SalesPerson;
            ContactDetailsRequest req1  = new ContactDetailsRequest()
            {
                Email = salesPersonContactEmail
            };
            ContactDetailsResponse res1 = loginProviders.GetContactDetails(req1, token).Result;

            model.SalesPersonCommonTitle = res1.Contacts != null && !string.IsNullOrEmpty(res1.Contacts.CommonTitle) ? res1.Contacts.CommonTitle : "";
            model.SalesPersonTitle       = res1.Contacts != null && !string.IsNullOrEmpty(res1.Contacts.TITLE) ? res1.Contacts.TITLE : "";
            model.SalesPersonFullName    = res1.Contacts != null && !string.IsNullOrEmpty(res1.Contacts.FIRSTNAME) && !string.IsNullOrEmpty(res1.Contacts.LastNAME) ? res1.Contacts.FIRSTNAME + " " + res1.Contacts.LastNAME : objQRFAgentResponse.QuoteAgentGetProperties.SalesPersonUserName;
            model.SalesPersonEmail       = res1.Contacts != null && !string.IsNullOrEmpty(res1.Contacts.MAIL) ? res1.Contacts.MAIL : salesPersonContactEmail;
            model.SalesPersonFax         = res1.Contacts != null && !string.IsNullOrEmpty(res1.Contacts.FAX) ? res1.Contacts.FAX : "";
            model.SalesPersonPhone       = res1.Contacts != null && !string.IsNullOrEmpty(res1.Contacts.MOBILE) ? res1.Contacts.MOBILE : "";

            #endregion

            return(PartialView("_ProposalCoveringNote", model));
        }
示例#12
0
        public ActionResult Manage(ManageViewModel manageViewModel, string command, IFormFile file)
        {
            string rootPath = _configuration.GetValue <string>("SystemSettings:UserImagePath");
            //string pathIntial = _configuration.GetValue<string>("SystemSettings:CountryImageInitial");
            string pathIntial = _configuration.GetValue <string>("UIBaseUrl");
            string imgDbPath  = _configuration.GetValue <string>("SystemSettings:UserImageDbPath");
            //string rootPath = _configuration.GetValue<string>("UserImagePath");

            //string destPath = _env.WebRootPath + @"\resources\DeleteImages";
            ManageViewModel manageViewModel1 = manageViewModel;
            string          EmailId          = HttpContext.Request.Cookies["EmailId"] ?? ckUserEmailId;

            LoginProviders objLoginProvider = new LoginProviders(_configuration);
            string         SuccessMessage   = "";
            string         ErrorMessage     = "";

            switch (command.ToLower())
            {
            case "update":
                ContactDetailsRequest req1 = new ContactDetailsRequest()
                {
                    Email  = EmailId,
                    FAX    = manageViewModel.FaxNumber,
                    TEL    = manageViewModel.Telephone,
                    MOBILE = manageViewModel.MobileNumber,
                    //WEB = manageViewModel.WebSite,
                    Users = new mUsers {
                        Password = manageViewModel.Password, VoyagerUser_Id = manageViewModel.VoyagerUser_Id
                    }
                };

                ContactDetailsResponse res1         = objLoginProvider.UpdateContactDetails(req1, token).Result;
                ContactDetailsResponse res2         = null;
                ResponseStatus         resultusepwd = new ResponseStatus();

                if (manageViewModel.IsPasswordEnabled)
                {
                    req1.IsUpdateCompany = true;
                    res2 = objLoginProvider.UpdateUserPassword(req1, token).Result;
                    if (res2 != null && res2.Status == "Sucess" && res2.Contacts != null && !string.IsNullOrEmpty(res2.Contacts.VoyagerContact_Id))
                    {
                        // Call Bridge service to update User Password in SQL database
                        UserRolesSetReq userreq = new UserRolesSetReq();
                        userreq.Contact_Id = res2.Contacts.VoyagerContact_Id;
                        resultusepwd       = agentProviders.SetUserPassword(userreq, token).Result;
                    }
                    else
                    {
                        res2        = res2 ?? new ContactDetailsResponse();
                        res2.Status = "Error";
                    }
                }

                if (res1 != null)
                {
                    manageViewModel1.MobileNumber = res1.Contacts.MOBILE;
                    manageViewModel1.Telephone    = res1.Contacts.TEL;
                    manageViewModel1.WebSite      = res1.Contacts.WEB;
                    manageViewModel1.FaxNumber    = res1.Contacts.FAX;
                }

                if (res2 != null && res1 != null)
                {
                    if (res2.Status == "Sucess" && res1.Status == "Sucess" && resultusepwd.Status.ToLower() != "success")
                    {
                        SuccessMessage = "Data updated successfully.";
                    }
                    else
                    {
                        if (resultusepwd != null && !string.IsNullOrEmpty(resultusepwd.Status) && resultusepwd.Status.ToLower() != "success")
                        {
                            ErrorMessage = resultusepwd.Status;
                        }
                        else if (res2.Status != "Sucess")
                        {
                            ErrorMessage = res2.Status;
                        }
                        else if (res1.Status != "Sucess")
                        {
                            ErrorMessage = res2.Status;
                        }
                    }
                }
                else if (res1 != null)
                {
                    if (res1.Status == "Sucess")
                    {
                        SuccessMessage = "Data updated successfully.";
                    }
                    else if (res1.Status != "Sucess")
                    {
                        ErrorMessage = res1.Status;
                    }
                }
                break;

            case "upload":
                if (file != null)
                {
                    string _FileName      = Path.GetFileName(file.FileName);
                    string oldFilePath    = Request.Cookies["Photo"];
                    string oldfileName    = Path.GetFileName(oldFilePath);
                    string oldFilePathURL = Path.Combine(rootPath, oldfileName);
                    string extension      = Path.GetExtension(file.FileName);
                    //Guid g = Guid.NewGuid();
                    string _path = Path.Combine(rootPath, manageViewModel.VoyagerUser_Id + extension);

                    //var savePath = "~/resources/UserImages/" + manageViewModel.VoyagerUser_Id + extension;

                    var savePath = imgDbPath + manageViewModel.VoyagerUser_Id + extension;
                    using (var fileStream = new FileStream(_path, FileMode.OpenOrCreate))
                    {
                        manageViewModel1.PhotoPath = _path;
                        file.CopyTo(fileStream);
                        fileStream.Flush();
                        fileStream.Close();
                    }

                    ContactDetailsRequest request = new ContactDetailsRequest()
                    {
                        //WEB = manageViewModel.WebSite,
                        Users = new mUsers {
                            Photo = savePath, VoyagerUser_Id = manageViewModel.VoyagerUser_Id
                        }
                    };

                    string imgLocation = pathIntial + savePath;
                    ContactDetailsResponse response = objLoginProvider.UpdateUserDetails(request, token).Result;
                    Response.Cookies.Append("Photo", imgLocation);

                    //if (System.IO.File.Exists(oldFilePathURL))
                    //{
                    //    FileInfo fileInfo = new FileInfo(oldFilePathURL);
                    //    fileInfo.MoveTo(Path.Combine(destPath, oldfileName));

                    //}
                    if (response.Status == "Sucess")
                    {
                        SuccessMessage = "Photo Uploaded Successfully.";
                    }
                    else
                    {
                        ErrorMessage = response.Status;
                    }
                }
                break;

            case "cancel":

                break;

            default:
                break;
            }

            if (!(string.IsNullOrEmpty(SuccessMessage)))
            {
                TempData["success"] = SuccessMessage;
            }

            if (!(string.IsNullOrEmpty(ErrorMessage)))
            {
                TempData["error"] = ErrorMessage;
            }

            //return View(manageViewModel1);
            return(RedirectToAction("Manage"));
        }
 public static void SetContactDetailsApiResponse(ContactDetailsResponse contactDetailsApiResponse)
 {
     _contactDetailsApiResponse = contactDetailsApiResponse;
 }