Esempio n. 1
0
        /// <summary>
        /// Private method to merge in the model
        /// </summary>
        /// <returns></returns>
        private IntroductoryInformationVM GetUpdatedModel()
        {
            IntroductoryInformationVM model = new IntroductoryInformationVM();

            RepopulateListsFromCacheSession(model);
            model.Message = "";

            if (sessionManager.CurrentIntroductoryInformation != null)
            {
                model.IntroductoryInformationItem = sessionManager.CurrentIntroductoryInformation;
            }

            //***************************************NEED WHITE LIST ---- BLACK LIST ------ TO PREVENT OVERPOSTING **************************
            bool result = TryUpdateModel(model);//This also validates and sets ModelState

            //*******************************************************************************************************************************
            if (sessionManager.CurrentIntroductoryInformation != null)
            {
                //*****************************************PREVENT OVER POSTING ATTACKS******************************************************
                //Get the values for read only fields from session
                MergeNewValuesWithOriginal(model.IntroductoryInformationItem);
                //***************************************************************************************************************************
            }

            SetAccessContext(model);

            return(model);
        }
Esempio n. 2
0
        private void RepopulateListsFromCacheSession(IntroductoryInformationVM model)
        {
            // Populate cached lists if they are empty. Will invoke service call
            IntroductoryInformationLookupListsCacheObject CachedLists = cacheManager.IntroductoryInformationListCache;

            // Retrieve any cached lists to model
        }
Esempio n. 3
0
        private IntroductoryInformationVM ConvertIntroductoryInformationDC(IntroductoryInformationVMDC returnedObject)
        {
            IntroductoryInformationVM model = new IntroductoryInformationVM();

            // Map IntroductoryInformation Item
            model.IntroductoryInformationItem = Mapper.Map <IntroductoryInformationDC, IntroductoryInformationModel>(returnedObject.IntroductoryInformationItem);

            // Map lookup data lists

            return(model);
        }
Esempio n. 4
0
        private void SetFlagsFalse(IntroductoryInformationVM model)
        {
            model.IsDeleteConfirmed = "False";
            model.IsExitConfirmed   = "False";
            model.IsNewConfirmed    = "False";

            //Stop the binder resetting the posted values
            ModelState.Remove("IsDeleteConfirmed");
            ModelState.Remove("IsExitConfirmed");
            ModelState.Remove("IsNewConfirmed");
        }
Esempio n. 5
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));
        }
Esempio n. 6
0
 private void ResolveFieldCodesToFieldNamesUsingLists(IntroductoryInformationVM model)
 {
     //TODO:
 }
Esempio n. 7
0
 private void SetAccessContext(IntroductoryInformationVM model)
 {
     // Edit context
     model.AccessContext = IntroductoryInformationAccessContext.View;
 }