Exemplo n.º 1
0
        public ActionResult SoftwareAllReviewsByName(string id)
        {
            try
            {
                Session["calledPage"] = "R";

                SoftwareViewModel softwareViewModel = null;

                SoftwareFilterEntity softwarereviewsFilter = new SoftwareFilterEntity
                {
                    SoftwareName = id.Replace("-", " "),
                    Rows         = 0
                };

                softwareViewModel = new SoftwareService().GetAllSoftwareReviews(softwarereviewsFilter);
                if (softwareViewModel != null && (softwareViewModel.SoftwareList != null && softwareViewModel.SoftwareList.Count > 0))
                {
                    softwareViewModel.WebBaseUrl = _webBaseURL;
                    return(View("~/Views/AllListPages/AllSoftwareReviewsList.cshtml", softwareViewModel));
                }
                else
                {
                    return(View("~/Views/Error/PageNotFound.cshtml"));
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        public ActionResult SoftwareList(string SoftwareName, int SoftwareCategoryID, string sortby, int PageNo, int PageSize, int FirstPage, int LastPage, int OrderColumn)
        {
            SoftwareService softwareService = new SoftwareService();

            SoftwareFilterEntity softwareFilter = new SoftwareFilterEntity
            {
                SoftwareName       = SoftwareName,
                SoftwareCategoryId = SoftwareCategoryID,
                PageNo             = PageNo,
                PageSize           = PageSize,
                SortBy             = sortby,
                UserID             = Convert.ToInt32(Session["UserID"]),
                OrderColumn        = OrderColumn
            };

            SoftwareViewModel softwareViewModel = softwareService.GetSoftware(softwareFilter);

            softwareViewModel.WebBaseUrl = _webBaseUrl;
            softwareViewModel.PageCount  = 0;
            softwareViewModel.PageNumber = PageNo;
            softwareViewModel.PageIndex  = 1;
            if (softwareViewModel.SoftwareList.Count > 0)
            {
                softwareViewModel.PageCount = (softwareViewModel.SoftwareList[0].TotalCount + PageSize - 1) / PageSize;
            }
            if ((PageNo == FirstPage || PageNo == LastPage) && LastPage >= 5)
            {
                if (PageNo == FirstPage && PageNo != 1)
                {
                    softwareViewModel.PageIndex = FirstPage - 1;
                }
                else if (PageNo == LastPage)
                {
                    if (PageNo == softwareViewModel.PageCount)
                    {
                        softwareViewModel.PageIndex = (PageNo - 5) + 1;
                    }
                    else
                    {
                        softwareViewModel.PageIndex = FirstPage + 1;
                    }
                }
            }
            else if (PageNo > LastPage && LastPage >= 5)
            {
                softwareViewModel.PageIndex = (PageNo - 5) + 1;
            }
            else if (PageNo >= FirstPage && PageNo <= LastPage)
            {
                softwareViewModel.PageIndex = FirstPage;
            }

            return(PartialView("_SoftwareList", softwareViewModel));
        }
Exemplo n.º 3
0
        internal SoftwareViewModel GetSoftware(SoftwareFilterEntity softwareFilter)
        {
            StringContent httpContent = new StringContent(JsonConvert.SerializeObject(softwareFilter), Encoding.UTF8, "application/json");

            using (_httpClient = new HttpClient())
            {
                const string apiMethod   = "GetSoftware";
                var          completeUrl = _webApiurl + apiMethod + '/';

                var response          = _httpClient.PostAsync(completeUrl, httpContent).Result;
                var softwareViewModel = JsonConvert.DeserializeObject <SoftwareViewModel>(response.Content.ReadAsStringAsync().Result);
                return(softwareViewModel);
            }
        }
Exemplo n.º 4
0
        // GET: CompanyList
        public ActionResult SoftwareList(string id)
        {
            Session["calledPage"] = "S";
            var urlSoftwareCategory = Convert.ToString(Request.Url.Segments[1]);
            var softwareService     = new SoftwareService();
            var softwareCategoryId  = 0;

            if (Request.Url.Segments.Length > 2)
            {
                urlSoftwareCategory = urlSoftwareCategory.Replace("/", "");
            }
            if (urlSoftwareCategory != string.Empty)
            {
                Session["SoftwareCategory"] = urlSoftwareCategory.ToString();
                softwareCategoryId          = new FocusAreaService().GetSoftwareCategoryID(urlSoftwareCategory);
            }
            SoftwareFilterEntity softwareFilter = new SoftwareFilterEntity
            {
                SoftwareName       = "",
                SoftwareCategoryId = softwareCategoryId,
                PageNo             = 1,
                PageSize           = 25,
                SortBy             = "DESC",
                UserID             = Convert.ToInt32(Session["UserID"]),
                OrderColumn        = 1,
            };

            SoftwareViewModel softwareViewModel = softwareService.GetSoftware(softwareFilter);

            softwareViewModel.WebBaseUrl = _webBaseUrl;
            GetSoftwareCategoryHeadLine(urlSoftwareCategory, softwareViewModel);
            softwareViewModel.SoftwareCategoryId = softwareCategoryId.ToString();
            softwareViewModel.PageCount          = 0;
            softwareViewModel.PageNumber         = 1;
            softwareViewModel.PageIndex          = 1;
            softwareViewModel.TotalNoOfSoftwares = softwareViewModel.SoftwareList.Select(a => a.TotalCount).FirstOrDefault();
            if (softwareViewModel.SoftwareList.Count > 0)
            {
                softwareViewModel.PageCount = (softwareViewModel.SoftwareList[0].TotalCount + 25 - 1) / 25;
            }
            return(View(softwareViewModel));
        }
Exemplo n.º 5
0
        public ActionResult Softwares()
        {
            try
            {
                Session["calledPage"] = "N";
                string            softwareName      = Convert.ToString(Request.Url.Segments[2]).Trim();
                SoftwareViewModel softwareViewModel = null;
                if (softwareName != string.Empty)
                {
                    Session["SoftwareName"] = softwareName;
                }
                if (CacheHandler.Exists(softwareName.ToLower()))
                {
                    softwareViewModel = new SoftwareViewModel();
                    CacheHandler.Get(softwareName.ToLower(), out softwareViewModel);
                }
                else
                {
                    SoftwareFilterEntity companyFilter = new SoftwareFilterEntity
                    {
                        SoftwareName       = softwareName.Replace("-", " "),
                        SortBy             = "DESC",
                        SoftwareCategoryId = 0,
                        UserID             = Convert.ToInt32(Session["UserID"]),
                        PageNo             = 1,
                        PageSize           = 10,
                        OrderColumn        = 1
                    };

                    softwareViewModel = new SoftwareService().GetSoftware(companyFilter);
                    CacheHandler.Add(softwareViewModel, softwareName);
                }

                softwareViewModel.WebBaseUrl = _webBaseURL;
                return(View(softwareViewModel));
            }
            catch (Exception)
            {
                return(null);
            }
        }
Exemplo n.º 6
0
        internal SoftwareViewModel GetAllSoftwareReviews(SoftwareFilterEntity softwareReviewsFilter)
        {
            using (_httpClient = new HttpClient())
            {
                string        apiMethod   = "GetUserReviewsForSoftware";
                string        completeURL = _webApiurl + apiMethod;
                StringContent httpContent = new StringContent(JsonConvert.SerializeObject(softwareReviewsFilter), Encoding.UTF8, "application/json");

                var response = _httpClient.PostAsync(completeURL, httpContent).Result;
                SoftwareViewModel softwareReviewsViewModel = new Models.SoftwareViewModel();
                if (response.IsSuccessStatusCode)
                {
                    softwareReviewsViewModel = JsonConvert.DeserializeObject <SoftwareViewModel>(response.Content.ReadAsStringAsync().Result);
                    return(softwareReviewsViewModel);
                }
                else
                {
                    return(softwareReviewsViewModel);
                }
            }
        }
Exemplo n.º 7
0
        internal CompanySoftwareUserReviews GetUserReviewsForSoftwareListingPage(SoftwareFilterEntity userReviewObj)
        {
            using (_httpClient = new HttpClient())
            {
                const string apiMethod   = "GetSoftwareReviewsForListingPage";
                string       completeUrl = _webApiurl + apiMethod;
                var          httpContent = new StringContent(JsonConvert.SerializeObject(userReviewObj), Encoding.UTF8, "application/json");

                var response        = _httpClient.PostAsync(completeUrl, httpContent).Result;
                var softwareReviews = new CompanySoftwareUserReviews();
                if (response.IsSuccessStatusCode)
                {
                    softwareReviews = JsonConvert.DeserializeObject <CompanySoftwareUserReviews>(response.Content.ReadAsStringAsync().Result);
                    return(softwareReviews);
                }
                else
                {
                    return(softwareReviews);
                }
            }
        }
Exemplo n.º 8
0
        public ActionResult GetSoftwareUserReviews(string softwarename, int PageSize)
        {
            int SoftwareCategoryID = 0;

            if (Session["SoftwareCategory"] != null)
            {
                SoftwareCategoryID = new FocusAreaService().GetSoftwareCategoryID(Session["SoftwareCategory"].ToString());
            }
            SoftwareFilterEntity UserReviewObj = new SoftwareFilterEntity
            {
                SoftwareCategoryId = SoftwareCategoryID,
                SoftwareName       = softwarename,
                PageNo             = 1,
                PageSize           = PageSize
            };

            CompanySoftwareUserReviews companyReViewModel = new CompanySoftwareUserReviews();

            companyReViewModel = new SoftwareService().GetUserReviewsForSoftwareListingPage(UserReviewObj);

            return(PartialView("~/Views/SoftwareList/_SoftwareUsersReviewsList.cshtml", companyReViewModel));
        }