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

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

            //if (SessionManager.CurrentStaffAttribute != null)
            //{
            //    model.StaffAttributeItem = SessionManager.CurrentStaffAttribute;
            //}

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

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

            //SetAccessContext(model);

            //Set the context of the check based on check number
            //SetCheckContext(model);

            return(model);
        }
Esempio n. 2
0
        private StaffAttributeVM ConvertStaffAttributeDC(StaffAttributeVMDC returnedObject)
        {
            StaffAttributeVM model = new StaffAttributeVM();

            model.StaffAttributeItem = Mapper.Map <StaffAttributeDC, StaffAttributeModel>(returnedObject.StaffAttributeItem);

            RepopulateListsFromCacheSession(model);

            return(model);
        }
Esempio n. 3
0
        private void RepopulateListsFromCacheSession(StaffAttributeVM model)
        {
            //*********************************
            //*PLACE HOLDER FOR SESSION LISTS *
            //*********************************


            //*********************************
            //*     POPULATE CACHED LISTS     *
            //*********************************
        }
Esempio n. 4
0
        private void SetFlagsFalse(StaffAttributeVM 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
 private void SetAccessContext(StaffAttributeVM model)
 {
     //Decide on access context
     if (model.StaffAttributeItem.Code == Guid.Empty)
     {
         //model.AccessContext = AccessContext.Create;
     }
     else
     {
         //model.AccessContext = AccessContext.Edit;
     }
 }
Esempio n. 6
0
        // GET: /StaffAttribute/Edit?code=
        public ActionResult Edit(string code)
        {
            StaffAttributeVM model = new StaffAttributeVM();

            //Not from staff or error
            if (String.IsNullOrEmpty(code))
            {
                //If session has lists then use them
                RepopulateListsFromCacheSession(model);

                //Assume we are in create mode as no code passed
                model.StaffAttributeItem = new StaffAttributeModel();
            }
            //if we have been passed a code then assume we are in edit situation and we need to retreive from the database.
            else
            {
                try
                {
                    AdminServiceClient sc             = new AdminServiceClient();
                    StaffAttributeVMDC returnedObject = null;//sc.GetSecurityCheckAndLookUps(SessionManager.UserID, SessionManager.UserID, "SecurityMonitoring", "", false, code);

                    //Get view model from database
                    model = ConvertStaffAttributeDC(returnedObject);

                    ResolveFieldCodesToFieldNamesUsingLists(model);

                    //Store the DB version of the check.
                    //SessionManager.StaffAttributeDBVersion = model.StaffAttributeItem;
                }
                catch (Exception e)
                {
                    SetAccessContext(model);
                    model.Message = Resources.MESSAGE_RETREIVAL_FAILED;
                    return(View(model));
                }
            }

            //Adds current retreived StaffAttribute to session
            //SessionManager.CurrentStaffAttribute = model.StaffAttributeItem;
            //SetAccessContext(model);

            return(View(model));
        }
Esempio n. 7
0
 private void ResolveFieldCodesToFieldNamesUsingLists(StaffAttributeVM model)
 {
     var ListCache = CacheManager.ListCache;
     //TODO:
 }