Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
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);
        }
Exemplo n.º 5
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));
        }
Exemplo n.º 6
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"));
        }