Пример #1
0
        public ActionResult Index()
        {
            IntroductoryInformationVM model = new IntroductoryInformationVM();

            // Create service instance
            UcbServiceClient sc = new UcbServiceClient();

            try
            {
                // Get users localisation
                LanguageManager language = new LanguageManager(sessionManager);
                string          locale   = language.GetLocale();

                // Call service to get IntroductoryInformation item and any associated lookups based on locale
                IntroductoryInformationVMDC returnedObject = sc.GetIntroductoryInformationByLocale(CurrentUser, CurrentUser, appID, "", locale);

                // Close service communication
                sc.Close();

                //Get view model from service
                model = ConvertIntroductoryInformationDC(returnedObject);

                ResolveFieldCodesToFieldNamesUsingLists(model);

                //Store the service version
                sessionManager.IntroductoryInformationServiceVersion = model.IntroductoryInformationItem;
            }
            catch (Exception e)
            {
                // Handle the exception
                string message = ExceptionManager.HandleException(e, sc);
                model.Message = message;

                return(View(model));
            }

            if (sessionManager.PageFrom == "EditIncident" || sessionManager.PageFrom == "EditReferral")
            {
                if (!string.IsNullOrEmpty(sessionManager.MessageFromPageFrom))
                {
                    model.Message = sessionManager.MessageFromPageFrom;
                    sessionManager.MessageFromPageFrom = null;
                }
            }

            //Adds current retrieved IntroductoryInformation to session
            sessionManager.CurrentIntroductoryInformation = model.IntroductoryInformationItem;
            SetAccessContext(model);

            return(View(model));
        }