Ejemplo n.º 1
0
        private static bool IsValidationGridDataFailed(FormCollection formCollection)
        {
            ImportViewModelManager model = new ImportViewModelManager();

            model = SessionWrapper.GetSession_Model();
            ExtractFormCollectionData extractFrmCollection = new ExtractFormCollectionData();

            model.DataModel = extractFrmCollection.XtractFormCollectionData(formCollection);

            ValidateExcelData validateExcelData = new ValidateExcelData();

            validateExcelData.RunValidationCheck(model.DataModel);

            //get the latest model data after validation done.
            model = SessionWrapper.GetSession_Model();

            if (model.ValidationFailed.Count > 0)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        private void SubmitButton(FormCollection formCollection, string submitButton)
        {
            if (submitButton == Constants.SAVE_TO_DB)
            {
                if (formCollection.Count > 0 && formCollection != null)
                {
                    if (SessionWrapper.GetSession_Model() != null)
                    {
                        if (IsValidationGridDataFailed(formCollection))
                        {
                            DisplayInvalidData();
                        }
                        else
                        {
                            ImportViewModelManager model = new ImportViewModelManager();
                            model = SessionWrapper.GetSession_Model();
                            ExtractFormCollectionData extractFrmCollection = new ExtractFormCollectionData();
                            model.DataModel = extractFrmCollection.XtractFormCollectionData(formCollection);
                            SessionWrapper.StoreSession_Model(model);

                            //save to db....
                            List <DisplayMessage> successMSG = UpsertClass.UpsertData();

                            DisplayStatus(successMSG);
                        }
                    }
                }
            }
            else if (submitButton == Constants.REFRESH_GRID)
            {
                Session.RemoveAll();
            }
            else if (submitButton == Constants.REMOVE_ITEM_FROM_GRID)
            {
                RemoveItems(formCollection);
            }
            else if (submitButton == Constants.VALIDATE_DATA)
            {
                bool isValid = IsValidationGridDataFailed(formCollection);
                if (isValid)
                {
                    DisplayInvalidData();
                }
                else
                {
                    DisplayValidData();
                }
            }
            else if (Constants.SELECT_RECORD_ARRAY_LIST.Select(x => x.Trim()).Contains(submitButton))
            {
                //AFTER POST THE PAGE IT LOOSES THE PREVIOUS SELECTION...!!! NEEDS TO FIND OUT HOW TO PERSIST THE RECORDS..
                ShowRecords(submitButton);
            }
            else if (Constants.SELECT_PAGE_SIZE_ARRAY_LIST.Select(x => x.Trim()).Contains(submitButton))
            {
                if (SessionWrapper.GetSession_Model() != null)
                {
                    if (((ImportViewModelManager)(SessionWrapper.GetSession_Model())).DataModel.Count > 10)
                    {
                        SetPageSize(submitButton);
                    }
                }
            }
        }