Esempio n. 1
0
        private void GetFragements()
        {
            _availableAttachments = new Dictionary <string, DocumentFragment>();
            List <ISharePointListItem> fragments = null;

            if (Cache.Contains(Constants.CacheNames.QuoteSlipFragments))
            {
                fragments = (List <ISharePointListItem>)Cache.Get(Constants.CacheNames.QuoteSlipFragments);
            }
            else
            {
                var list      = ListFactory.Create(Settings.Default.GeneralFragmentsListName, ListQueries.FactFinderFragmentsByKey());
                var presenter = new SharePointListPresenter(list, this);
                fragments = presenter.GetItems();
            }


            foreach (var i in fragments)
            {
                var key      = i.GetFieldValue("Key");
                var txtTitle = i.Title + " " + i.GetFieldValue("OAMPS_x0020_Version");
                switch (key)
                {
                case Constants.FragmentKeys.FinancialServicesGuide:
                {
                    chkFSG.Text = txtTitle;
                    _availableAttachments.Add(key, new DocumentFragment
                        {
                            Title  = txtTitle,
                            Key    = key,
                            Url    = Settings.Default.FragmentFSG,
                            Locked = i.GetFieldValue("Locked")
                        });

                    break;
                }


                case Constants.FragmentKeys.GeneralAdviceWarning:
                {
                    _availableAttachments.Add(key, new DocumentFragment
                        {
                            Title  = txtTitle,
                            Key    = key,
                            Url    = Settings.Default.FragmentWarning,
                            Locked = i.GetFieldValue("Locked")
                        });
                    break;
                }


                case Constants.FragmentKeys.PrivacyStatement:
                {
                    _availableAttachments.Add(key, new DocumentFragment
                        {
                            Title  = txtTitle,
                            Key    = key,
                            Url    = Settings.Default.FragmentPrivacy,
                            Locked = i.GetFieldValue("Locked")
                        });

                    break;
                }


                case Constants.FragmentKeys.StatutoryNotices:
                {
                    chkSatutory.Text = txtTitle;
                    _availableAttachments.Add(key, new DocumentFragment
                        {
                            Title  = txtTitle,
                            Key    = key,
                            Url    = Settings.Default.FragmentStatutory,
                            Locked = i.GetFieldValue("Locked")
                        });

                    break;
                }


                case Constants.FragmentKeys.UninsuredRisksReviewList:
                {
                    _availableAttachments.Add(key, new DocumentFragment
                        {
                            Title  = txtTitle,
                            Key    = key,
                            Url    = Settings.Default.FragmentUninsuredRisks,
                            Locked = i.GetFieldValue("Locked")
                        });
                    break;
                }
                }
            }
        }