Esempio n. 1
0
        /// <summary>
        /// This function is called when the client navigates to *hostname*/CompanyListings/DisplayCompany/*info*
        /// </summary>
        /// <param name="id">The name of the company whos info is to be displayed</param>
        /// <returns>A view to be sent to the client</returns>
        public ActionResult DisplayCompany(string id)
        {
            if (Globals.isLoggedIn() == false)
            {
                return(RedirectToAction("Index", "Authentication"));
            }
            if ("".Equals(id))
            {
                return(View("Index"));
            }

            ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser());

            if (connection == null)
            {
                return(RedirectToAction("Index", "Authentication"));
            }

            ViewBag.CompanyName = id;
            companyNameeeee     = id;
            string location = "";

            GetCompanyInfoRequest  infoRequest  = new GetCompanyInfoRequest(new CompanyInstance(id));
            GetCompanyInfoResponse infoResponse = connection.getCompanyInfo(infoRequest);

            ViewBag.CompanyInfo = infoResponse.companyInfo;
            location            = infoResponse.companyInfo.locations[0];

            //CompanyReviewSearchRequest reviewRequest = new CompanyReviewSearchRequest(id);
            // CompanyReviewResponse reviewResponse = connection.searchCompanyReview(reviewRequest);
            // ViewBag.Reviewlist = reviewResponse.reviews;

            WeatherNeededRequest  weatherRequest  = new WeatherNeededRequest(location);
            WeatherNeededResponse weatherResponse = connection.getWeatherData(weatherRequest);

            if (!weatherResponse.result)
            {
                WeatherData wd = new WeatherData("not available", "not available", "not available", "not available", "not available", "not available");
                ViewBag.WeatherData = wd;
            }
            else
            {
                ViewBag.WeatherData = weatherResponse.weatherData;
            }



            return(View("DisplayCompany"));
        }