/// <summary>
        /// This function is called when the client navigates to *hostname*/CompanyListings/Search
        /// </summary>
        /// <returns>A view to be sent to the client</returns>
        public ActionResult Search(string textCompanyName)
        {
            if (Globals.isLoggedIn() == false)
            {
                return(RedirectToAction("Index", "Authentication"));
            }

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

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

            CompanySearchRequest request = new CompanySearchRequest(textCompanyName);

            CompanySearchResponse response = connection.searchCompanyByName(request);

            if (response.result == false)
            {
                return(RedirectToAction("Index", "Authentication"));
            }

            ViewBag.Companylist = response.list;

            return(View("Index"));
        }
Esempio n. 2
0
        /// <summary>
        /// This function is called when the client navigates to *hostname*/CompanyListings
        /// </summary>
        /// <returns>A view to be sent to the client</returns>
        public ActionResult Index()
        {
            if (Globals.isLoggedIn())
            {
                ViewBag.Companylist = null;
                ViewBag.Index       = true;

                ServiceBusConnection connection = ConnectionManager.getConnectionObject(Globals.getUser());
                if (connection == null)
                {
                    return(RedirectToAction("Index", "Authentication"));
                }

                CompanySearchRequest  request  = new CompanySearchRequest("");
                CompanySearchResponse response = connection.searchCompanyByName(request);

                if (response.result)
                {
                    ViewBag.Companylist = response.list.companyNames;
                }

                return(View("Index"));
            }
            return(RedirectToAction("Index", "Authentication"));
        }
Esempio n. 3
0
        /// <summary>
        /// This function is called when the client navigates to *hostname*/CompanyListings/Search
        /// </summary>
        /// <returns>A view to be sent to the client</returns>
        public ActionResult Search(string textCompanyName)
        {
            ViewBag.DebugMessage = "Point 1";

            if (Globals.isLoggedIn() == false)
            {
                ViewBag.DM = "User Is not logged in";
                return(View("Index"));
            }

            ViewBag.DebugMessage = "Point 2";


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

            if (connection == null)
            {
                ViewBag.DM = "Connection is null";
                return(View("Index"));
            }

            ViewBag.DebugMessage = "Point 3";


            CompanySearchRequest request = new CompanySearchRequest(textCompanyName);

            ServiceBusResponse response = connection.searchCompanyByName(request);

            if (response.result == false)
            {
                ViewBag.DM = response.response;
                return(View("Index"));
            }

            ViewBag.DebugMessage = "Point 4";



            ViewBag.Companylist = response.response.Split(new String[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
            ViewBag.DM          = response.response;
            return(View("Index"));
        }