예제 #1
0
        public ViewResult RateReportViewer(SearchParameterModel searchParameterModel)
        {
            ViewBag.CountryID = new SelectList(db.Countries.ToList(), "ID", "Name");

            IList <Service> serviceList = db.Services.GroupBy(i => i.Name).Select(g => g.FirstOrDefault()).ToList();

            ViewBag.ServiceID = new SelectList(serviceList, "ID", "Name");
            return(View(searchParameterModel));
        }
        public IActionResult Index(SearchParameterModel searchParameters)
        {
            if (ModelState.IsValid)
            {
                //now call for api from here
                string   certId    = searchParameters.CertId;
                DateTime startDate = searchParameters.StartDate;
                DateTime endDate   = searchParameters.EndDate;

                // if api returns false then show not found

                //otherwise create template for table on searchresult method
                IList <FinalSearchResultModel> finalSearchResultList = new List <FinalSearchResultModel>()
                {
                    new FinalSearchResultModel()
                    {
                        Name    = "Gaurav Kalia",
                        City    = "Amritsar",
                        Pincode = "143001",
                        Country = "India"
                    }, new FinalSearchResultModel()
                    {
                        Name    = "Taran Kalia",
                        City    = "Chandigarh",
                        Pincode = "160047",
                        Country = "India"
                    }, new FinalSearchResultModel()
                    {
                        Name    = "Harjot Singh",
                        City    = "Chandigarh",
                        Pincode = "160001",
                        Country = "India"
                    }, new FinalSearchResultModel()
                    {
                        Name    = "Saurav Kalia",
                        City    = "Delhi",
                        Pincode = "110001",
                        Country = "India"
                    }
                };
                return(View("SearchResult", finalSearchResultList));
            }
            else
            {
                return(View());
            }
        }
예제 #3
0
        public HttpResponseMessage GetMovies([FromUri] PagingParameterModel pagingParameterModel, [FromUri] SearchParameterModel searchParameterModel)
        {
            //System.Diagnostics.Debug.WriteLine("Session " + System.Web.HttpContext.Current.Session!=null);

            //foreach (string key in HttpContext.Current.Session.Contents)
            //{
            //    string value = "Key: " + key + ", Value: " + HttpContext.Current.Session[key].ToString();

            //    System.Diagnostics.Debug.WriteLine(value);
            //}

            if (pagingParameterModel == null)
            {
                pagingParameterModel = new PagingParameterModel();
            }

            if (searchParameterModel == null)
            {
                searchParameterModel = new SearchParameterModel();
            }

            // list of all movies
            var source = _movieRepository.GetMovies(searchParameterModel.SearchString);

            var filtered = Filter(source, searchParameterModel.Year, searchParameterModel.Genre);

            var sorted = new SorterFactory().Get(searchParameterModel.Order).Sorted(filtered).AsQueryable();

            // number of movies in db
            int count = source.Count();

            int CurrentPage = pagingParameterModel.PageNumber;
            int PageSize    = pagingParameterModel.PageSize;

            int TotalCount = count;

            int TotalPages = (int)Math.Ceiling(count / (double)PageSize);

            var items = sorted
                        .Skip((CurrentPage - 1) * PageSize)
                        .Take(PageSize)
                        .ToList();

            var movies = ToMovieListViewModel(items);

            var previousPage = CurrentPage > 1 ? "Yes" : "No";

            var nextPage = CurrentPage < TotalPages ? "Yes" : "No";

            var paginationMetadata = new
            {
                totalCount  = TotalCount,
                pageSize    = PageSize,
                currentPage = CurrentPage,
                totalPages  = TotalPages,
                previousPage,
                nextPage
            };

            // Setting Header
            HttpContext.Current.Response.Headers.Add("Paging-Headers", JsonConvert.SerializeObject(paginationMetadata));

            return(Request.CreateResponse(HttpStatusCode.OK, movies));
        }
예제 #4
0
 public ViewResult ReportViewer(SearchParameterModel um)
 {
     return(View(um));
 }
예제 #5
0
 public ViewResult TrafficSummaryReportViewer(SearchParameterModel searchParameterModel)
 {
     return(View(searchParameterModel));
 }
예제 #6
0
 public ViewResult SummarySalesRepCommissionReportViewer(SearchParameterModel searchParameterModel)
 {
     return(View(searchParameterModel));
 }
예제 #7
0
 public ViewResult CustomerBillReportViewer(SearchParameterModel searchParameterModel)
 {
     return(View(searchParameterModel));
 }