Exemplo n.º 1
0
        private LoadedPage AddMappingToTransaction(TransactionState state, long startPage, long size, MappedAddresses mappedAddresses)
        {
            state.TotalLoadedSize += size;
            state.AddressesToUnload.Add(mappedAddresses);
            var loadedPage = new LoadedPage
            {
                Pointer       = (byte *)mappedAddresses.Address,
                NumberOfPages = (int)(size / Constants.Storage.PageSize),
                StartPage     = startPage
            };

            state.LoadedPages[startPage] = loadedPage;
            return(loadedPage);
        }
Exemplo n.º 2
0
        /// <param name="typeID"> For categories: the chosen category; For Admin page: the selected text for edit;</param>
        /// <param name="loadCategories">If it should load the categories for the menu. Must be true if the page is not loaded
        /// via AJAX request, otherwise false, because the categories are not going to be refreshed anyway </param>
        public static BMainModel GetData(LoadedPage page, int?typeID = null, bool loadCategories = true)
        {
            BMainModel model = null;

            switch (page)
            {
            case LoadedPage.AboutUs:
                model = LoadDataForAboutUsPage(loadCategories);
                break;

            case LoadedPage.Categories:
                model = LoadDataForCategoriesPage(loadCategories, typeID: typeID);
                break;

            case LoadedPage.Firms:
                model = LoadDataForFirmsPage(loadCategories);
                break;

            case LoadedPage.Promotions:
                model = LoadDataForPromotionsPage(loadCategories);
                break;

            case LoadedPage.Services:
                model = LoadDataForServicesPage(loadCategories);
                break;

            case LoadedPage.Admin:
                model = LoadDataForAdminPage(typeID);
                break;

            case LoadedPage.ContactUs:
                model = LoadDataForContactUsPage(loadCategories);
                break;

            case LoadedPage.SiteMap:
                model = LoadDataForSiteMapPage();
                break;

            default:
                BTools.NewBException(string.Format("Страница '{0}' не се поддържа за зареждане на информация от бизнес слоя.", page));
                break;
            }

            model.ExcIfNull();

            return(model);
        }
Exemplo n.º 3
0
        public MainModel GetModel(LoadedPage page, int?typeID = null, bool isAjaxRequest = false)
        {
            MainModel mainModel = new MainModel();

            BMainModel bModel = Main.GetData(page, typeID: typeID, loadCategories: !isAjaxRequest);

            bModel.ExcIfNull();

            mainModel.Categories = bModel.Categories;
            mainModel.Firms      = bModel.Firms;
            mainModel.Gallery    = bModel.Gallery;
            mainModel.Texts      = bModel.Texts;

            mainModel.MailToSent = bModel.MailToSend;

            mainModel.OperationResult = string.Empty;

            return(mainModel);
        }
Exemplo n.º 4
0
        internal static List <BText> GetTextsForPage(TrucksReserveEntities trModel, LoadedPage page)
        {
            trModel.ExcIfNull();

            List <BText> texts = new List <BText>();

            switch (page)
            {
            case LoadedPage.Promotions:
                BText promText = GetText(trModel, TextType.Promotions, onlyWithFilledDescription: true, excIfNull: false);
                if (promText != null)
                {
                    texts.Add(promText);
                }
                break;

            default:
                BTools.NewBException(string.Format("За страница {0} не се поддържа вземането на текстове за показване.", page));
                break;
            }

            return(texts);
        }