public IPagedList <PostViewModel> SearchPost(PostSearchModel searchModel) { try { var parameter = new DbParameter[] { _dbCMSContext.GetParameter("@pPostCategoryFID", searchModel.CategoryFID), _dbCMSContext.GetParameter("@pLanguageFID", searchModel.LanguageFID), _dbCMSContext.GetParameter("@pIsActivated", searchModel.IsActived), _dbCMSContext.GetParameter("@pCreatedBy", searchModel.CreatedBy), _dbCMSContext.GetParameter("@pTitle", searchModel.Title), _dbCMSContext.GetParameter("@pDeleted", searchModel.IsDeleted), _dbCMSContext.GetParameter("@pPageSize", searchModel.PageSize), _dbCMSContext.GetParameter("@pPageNumber", searchModel.PageIndex), }; var result = _dbCMSContext.EntityFromSql <PostViewModel>("usp_Post_Search", parameter).ToList(); int totalRows = 0; if (result.Count > 0) { totalRows = result[0].TotalRows; } var pagedListModel = new PagedList <PostViewModel>(result, searchModel.PageIndex, searchModel.PageSize, totalRows); return(pagedListModel); } catch (AQException ex) { throw ex; } }
public PostNavigationDetailViewModel GetPostNavigationDetail(PostSearchModel searchModel) { try { var parameter = new DbParameter[] { _dbCMSContext.GetParameter("@pPostCategoryFID", searchModel.CategoryFID), _dbCMSContext.GetParameter("@pLanguageFID", searchModel.LanguageFID), _dbCMSContext.GetParameter("@pIsActivated", searchModel.IsActived), _dbCMSContext.GetParameter("@pCreatedBy", searchModel.CreatedBy), _dbCMSContext.GetParameter("@pCurrentPostID", searchModel.CurrentPostId), }; var result = _dbCMSContext.EntityFromSql <NavigationInfo>("usp_Post_Next_Prev", parameter).ToList(); var model = new PostNavigationDetailViewModel(); if (result.Count > 0) { model.PreviousPost = result.FirstOrDefault(item => item.Type == "PREV"); model.NextPost = result.FirstOrDefault(item => item.Type == "NEXT"); } return(model); } catch (AQException ex) { throw ex; } }
public async Task <JsonResult> GetTravelBlog(PostSearchModel searchModel) { var response = await _postService.Search(searchModel); var pageList = response.GetDataResponse(); pageList.Data = await PreparingBlogCustomProperties(pageList.Data); return(Json(pageList)); }
public ActionResult Search(string term) { if (string.IsNullOrEmpty(term)) { return(HomePage()); } var model = new PostSearchModel() { Term = term }; return(View(model)); }
public IPagedList <PostViewModel> SearchPost(PostSearchModel searchModel) { string sortString = !string.IsNullOrEmpty(searchModel.SortString) ? searchModel.SortString : "DefaultTitle ASC"; var query = (from p in _dbCMSContext.Posts.AsNoTracking() where (p.DefaultTitle.Contains(searchModel.DefaultTitle) || string.IsNullOrEmpty(searchModel.DefaultTitle)) && (p.IsActivated == searchModel.IsActivated || searchModel.IsActivated == null) && ((p.CreatedDate >= searchModel.CreatedDateFrom || searchModel.CreatedDateFrom == null) && (p.CreatedDate <= searchModel.CreatedDateTo || searchModel.CreatedDateTo == null)) && p.Deleted == false select _mapper.Map <Posts, PostViewModel>(p)).OrderBy(sortString).ToList(); query.ForEach(x => x.postDetail = _dbCMSContext.PostDetails.AsNoTracking().Where(y => y.PostFid == x.Id).Select(y => _mapper.Map <PostDetails, PostDetailViewModel>(y)).FirstOrDefault()); query.ForEach(x => x.postFileStream = _dbCMSContext.PostFileStreams.AsNoTracking().Where(y => y.PostFid == x.Id).Select(y => _mapper.Map <PostFileStreams, PostFileStreamViewModel>(y)).ToList()); return(new PagedList <PostViewModel>(query.AsQueryable(), searchModel.PageIndex, searchModel.PageSize)); }
public IActionResult SearchPost([FromQuery] PostSearchModel model) { try { var res = _postService.SearchPost(model); if (res != null) { return(Ok(res)); } return(NoContent()); } catch (Exception ex) { return(BadRequest(ex.StackTrace.ToString())); } }
public IActionResult SearchPost([FromQuery] PostSearchModel model) { try { var res = _postService.SearchPost(model); if (res != null) { return(OkBaseResponse(res)); } return(ErrorBaseResponse(System.Net.HttpStatusCode.NoContent)); } catch (Exception ex) { return(ErrorBaseResponse(ex)); } }
public ActionResult PostReports(PostSearchModel model) { if (!string.IsNullOrEmpty(model.SearchButton) || model.Page.HasValue) { var results = db.Posts .Where(p => (p.PostTitle.Contains(model.Title) || model.Title == null)) .OrderBy(p => p.PostID); var pageIndex = model.Page ?? 1; model.SearchResults = results.ToPagedList(pageIndex, RecordsPerPage); return(View(model)); } return(View(model)); }
/// <summary> /// Search all available travel blog /// </summary> /// <param name="searchModel">Search config</param> /// <returns>Travel blog</returns> public async Task <BaseResponse <PagedListClient <PostViewModel> > > Search(PostSearchModel searchModel) { try { var apiExecute = new APIExcute(AuthenticationType.Bearer); var url = string.Format("{0}{1}", (_baseAdminApiUrl + _adminApiUrl.Post.Search), ConvertToUrlParameter(searchModel)); var response = await apiExecute.GetData <PagedListClient <PostViewModel> >(url, token : _token); return(response); } catch (Exception ex) { return(BaseResponse <PagedListClient <PostViewModel> > .InternalServerError(ex)); } }
public ActionResult BookOnHold(String refCode, String buttonId) { ViewBag.RefCode = refCode; ViewBag.ButtonId = buttonId; var pageVm = new PaymentConfirmaton(); try { if (Session["transactionDetails"] != null && Session["BookingRequest"] != null) { } var tranDetals = (PostSearchResponseModel)Session["transactionDetails"]; pageVm.BookingResponse = tranDetals.Object; pageVm.BookingRequest = (PostSearchModel)Session["BookingRequest"]; pageVm.BookingRequest.SeatNumber = pageVm.BookingRequest.SeatRegistrations.Split(':')[1]; } catch (Exception ex) { bool IsReturnTrp = false; if ((int)Session["roundTripHire"] == 1) { IsReturnTrp = true; } var hireRequestReturn = IsReturnTrp ? (GetHireRefcodeRequestReturn)Session["HireRequest"] : null; var hireRequest = !IsReturnTrp ? (GetHireRefcodeRequest)Session["HireRequest"] : null; var tranDetails = new PostSearchResponseModel.BookingResponse(); var bookingRequest = new PostSearchModel(); var hireResponse = new getVehicleForHireResponse(); var hireRefCodeAmountObj = new hireRefcodeAmount(); var hirePageVm = new PaymentConfirmatonHire(); hireResponse = (getVehicleForHireResponse)Session["HireResponse"]; hireRefCodeAmountObj = (hireRefcodeAmount)Session["HireResponse_"]; hirePageVm.BookingRequestReturn = hireRequestReturn; hirePageVm.BookingRequest = hireRequest; hirePageVm.BookingResponse = hireResponse; hirePageVm.HirePayResponse = hireRefCodeAmountObj; ViewBag.HireService = true; tranDetails.BookingReferenceCode = hireRefCodeAmountObj.RefCode; if (IsReturnTrp) { tranDetails.Amount = hireRequestReturn.Amount; tranDetails.DepartureDate = hireRequestReturn.OnewayPickupDate; bookingRequest.Amount = hireRequestReturn.Amount.ToString(); bookingRequest.FirstName = hireRequestReturn.FullName; bookingRequest.Email = hireRequestReturn.Email; bookingRequest.PhoneNumber = hireRequestReturn.PhoneNumber; bookingRequest.PaymentMethod = Convert.ToInt32(hireRequestReturn.PaymentMethod); pageVm.BookingRequest = bookingRequest; pageVm.BookingResponse = tranDetails; } else { tranDetails.Amount = hireRequest.Amount; tranDetails.DepartureDate = hireRequest.OnewayPickupDate; bookingRequest.Amount = hireRequest.Amount.ToString(); bookingRequest.FirstName = hireRequest.FullName; bookingRequest.Email = hireRequest.Email; bookingRequest.PhoneNumber = hireRequest.PhoneNumber; bookingRequest.PaymentMethod = Convert.ToInt32(hireRequest.PaymentMethod); pageVm.BookingRequest = bookingRequest; pageVm.BookingResponse = tranDetails; } Logical.WriteToLog(ex.Message); } return(View(pageVm)); }
public ActionResult PaymentConfirmation() { //Hire Service if (Session["HireResponse_"] != null) { bool IsReturnTrp = false; if ((int)Session["roundTripHire"] == 1) { IsReturnTrp = true; } var hireRequestReturn = IsReturnTrp ? (GetHireRefcodeRequestReturn)Session["HireRequest"] : null; var hireRequest = !IsReturnTrp ? (GetHireRefcodeRequest)Session["HireRequest"] : null; var hireResponse = new getVehicleForHireResponse(); var hireRefCodeAmountObj = new hireRefcodeAmount(); var hirePageVm = new PaymentConfirmatonHire(); try { hireResponse = (getVehicleForHireResponse)Session["HireResponse"]; hireRefCodeAmountObj = (hireRefcodeAmount)Session["HireResponse_"]; hirePageVm.BookingRequestReturn = hireRequestReturn; hirePageVm.BookingRequest = hireRequest; hirePageVm.BookingResponse = hireResponse; hirePageVm.HirePayResponse = hireRefCodeAmountObj; ViewBag.HireService = true; var vhire = (getVehicleForHireResponse)Session["HireResponse"]; return(View(hirePageVm)); } catch (Exception ex) { Logical.WriteToLog(ex.Message); return(View(hirePageVm)); } } else { var bookingRequest = new PostSearchModel(); var tranDetals = new PostSearchResponseModel(); tranDetals.Object = new PostSearchResponseModel.BookingResponse(); String otherSeats = String.Empty; var pageVm = new PaymentConfirmaton(); try { tranDetals = (PostSearchResponseModel)Session["transactionDetails"]; pageVm.BookingResponse = tranDetals.Object; pageVm.BookingRequest = (PostSearchModel)Session["BookingRequest"]; pageVm.BookingRequest.SeatNumber = pageVm.BookingRequest.SeatRegistrations.Split(':')[1]; int i = 0; foreach (var item in pageVm.BookingRequest.Beneficiaries) { i++; otherSeats += item.SeatNumber; if (i < pageVm.BookingRequest.Beneficiaries.Count) { otherSeats += ":"; } } Session["OtherSeats"] = otherSeats; // pageVm.BookingRequest.SeatRegistrations.Split } catch (Exception ex) { Logical.WriteToLog(ex.Message + "::" + ex.StackTrace); pageVm.BookingResponse = ((PostSearchResponseModel)Session["booking"]).Object; pageVm.BookingRequest = (PostSearchModel)Session["BookingRequest"]; int i = 0; foreach (var item in pageVm.BookingRequest.Beneficiaries) { i++; otherSeats += item.SeatNumber; if (i < pageVm.BookingRequest.Beneficiaries.Count) { otherSeats += ":"; } } } ViewBag.Status = true; return(View(pageVm)); } }
/// <summary> /// Get Post Nagivation /// </summary> /// <param name="postSearchModel">Post search condition</param> /// <returns>Post Nagivation</returns> public async Task <BaseResponse <PostNavigationDetailViewModel> > GetPostNagivation(PostSearchModel postSearchModel) { try { var apiExecute = new APIExcute(AuthenticationType.Bearer); var url = string.Format("{0}{1}", (_baseAdminApiUrl + _adminApiUrl.Post.PostNagivation), ConvertToUrlParameter(postSearchModel)); var response = await apiExecute.GetData <PostNavigationDetailViewModel>(url, token : _token); return(response); } catch (Exception ex) { return(BaseResponse <PostNavigationDetailViewModel> .InternalServerError(ex)); } }
public async Task <BaseResponse <PagedListClient <PostViewModel> > > SearchPost(PostSearchModel searchModel) { try { var requestParams = ConvertToUrlParameter(searchModel); string urlRequest = $"{_baseAdminAPIUrl}{_adminPortalApiUrl.PostAPI.Search}{requestParams}"; var res = await _aPIExcute.GetData <PagedListClient <PostViewModel> >(urlRequest, null, Token); return(res); } catch (Exception ex) { return(BaseResponse <PagedListClient <PostViewModel> > .InternalServerError(message : ex.Message, fullMsg : ex.StackTrace)); } }
public static async Task <Tuple <PostSearchResponseModel, ErrorModel> > PostSearchObjects(PostSearchModel fullbookingobj) { using (HttpClientHelper client = new HttpClientHelper()) { var bookobj = new PostSearchResponseModel(); ErrorModel errorModel = null; await client.ProcessClientRequestAsync <PostSearchResponseModel>(GigUrl.PostBookingDetails, HttpMethod.Post, fullbookingobj, success => { bookobj = success; }, error => { errorModel = error; } ); return(new Tuple <PostSearchResponseModel, ErrorModel>(bookobj, errorModel)); } }
public async Task <JsonResult> PostBooking(PostSearchModel booking) { Session["BookingRequest"] = booking; booking.Discount = 0; var payStackUrl = String.Empty; try { if (booking.Beneficiaries == null) { booking.Beneficiaries = new List <GigmsBookingBeneficiary>(); } } catch (Exception ex) { Console.Write(ex); booking.Beneficiaries = new List <GigmsBookingBeneficiary>(); } var response = await Logical.PostSearchObjects(booking); if (!response.Item1.Code.Equals("200")) { return(new JsonResult { Data = null }); } Session["transactionDetails"] = response.Item1; var amount = Convert.ToInt64(booking.Amount) * 100; // var response = api.Transactions.Initialize(email, (int)amount); //Flutterwave if (booking.PaymentMethod.Equals(8)) { Tuple <String, String, String> response_ = new Tuple <string, string, String>("", "", ""); if (!String.IsNullOrEmpty(response.Item1.Object.BookingReferenceCode)) { var pubKey = ConfigurationManager.AppSettings["FlutterWavePublicKey"]; var secKey = ConfigurationManager.AppSettings["FlutterWaveSecretKey"]; var txref = response.Item1.Object.BookingReferenceCode; var redirectUrl = ConfigurationManager.AppSettings["FlutterWaveRedirect"] + txref; //PBFPubKey.Text + amount.Text + "NG" + "NGN" + customer_email.Text + "card" + 1 + redirect_url.Text + txref.Text + secKey var hash = _GetSha256Hash(pubKey + booking.Amount.Split(new String[] { "." }, StringSplitOptions.None)[0] + "NG" + "NGN" + booking.Email + "card" + 1 + redirectUrl + txref + secKey); response_ = new Tuple <String, String, String>(response.Item1.Object.BookingReferenceCode, hash, redirectUrl); } return(new JsonResult { Data = response_ }); } //Paystack else if (booking.PaymentMethod.Equals(5)) { var request = new TransactionInitializeRequest(); request.Email = booking.Email; request.AmountInKobo = (int)amount; request.CallbackUrl = ConfigurationManager.AppSettings["PaystackResponse"]; request.MetadataObject["cancel_action"] = ConfigurationManager.AppSettings["PaystackResponse"]; request.Reference = response.Item1.Object.BookingReferenceCode; request.SubAccount = ConfigurationManager.AppSettings["PaystackSubAccount"] ?? ""; var testOrLiveSecret = ConfigurationManager.AppSettings["PayStackSecret"]; var api = new PayStackApi(testOrLiveSecret); try { var payStackResponse = api.Transactions.Initialize(request); if (payStackResponse.Status) { var PaystackDetails = new ProcessPayStackPayment { amount = (int)amount, RefCode = request.Reference, PayStackReference = payStackResponse.Data.Reference, email = request.Email }; Session["PaystackDetails"] = PaystackDetails; payStackUrl = payStackResponse.Data.AuthorizationUrl; return(new JsonResult { Data = payStackUrl }); } else { return(new JsonResult { Data = null }); } } catch (Exception ex) { Logical.WriteToLog(ex.Message); return(new JsonResult { Data = null }); } } else if (booking.PaymentMethod.Equals(12)) { var buttonId = "lnkbtnGtbUssd"; Session["PaymentGatewayType"] = 12; var returnUrl = "/Pages/BookOnHold?refCode=" + response.Item1.Object.BookingReferenceCode + "&buttonId=" + buttonId; return(new JsonResult { Data = returnUrl }); } else if (booking.PaymentMethod.Equals(7) || booking.PaymentMethod.Equals(10) || booking.PaymentMethod.Equals(12) || booking.PaymentMethod.Equals(14) || booking.PaymentMethod.Equals(16)) { var buttonId = "ussd"; Session["PaymentGatewayType"] = 0; var returnUrl = "/Pages/BookOnHold?refCode=" + response.Item1.Object.BookingReferenceCode + "&buttonId=" + buttonId; return(new JsonResult { Data = returnUrl }); } else { return(null); } }