예제 #1
0
    protected void rptPages_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e == null)
        {
            throw new ArgumentNullException("e");
        }

        LogbookPrintedPage lep = (LogbookPrintedPage)e.Item.DataItem;

        HashSet <int> hsRedundantProps = new HashSet <int>()
        {
            (int)CustomPropertyType.KnownProperties.IDPropStudentName, (int)CustomPropertyType.KnownProperties.IDPropNameOfPIC, (int)CustomPropertyType.KnownProperties.IDPropNightTakeoff
        };

        hsRedundantProps.UnionWith(Options.ExcludedPropertyIDs);
        foreach (LogbookEntryDisplay led in lep.Flights)
        {
            List <CustomFlightProperty> lstProps = new List <CustomFlightProperty>(led.CustomProperties);
            lstProps.RemoveAll(cfp => hsRedundantProps.Contains(cfp.PropTypeID));
            led.CustPropertyDisplay = CustomFlightProperty.PropListDisplay(lstProps, CurrentUser.UsesHHMM, PropSeparator);
        }

        Repeater rpt = (Repeater)e.Item.FindControl("rptFlight");

        rpt.DataSource = lep.Flights;
        rpt.DataBind();

        rpt            = (Repeater)e.Item.FindControl("rptSubtotalCollections");
        rpt.DataSource = lep.Subtotals;
        rpt.DataBind();
    }
예제 #2
0
        protected void RefreshLogbookData()
        {
            mvLayouts.ActiveViewIndex = (int)PrintOptions1.Options.Layout;
            pnlResults.Visible        = true;
            lblCoverDate.Text         = String.Format(CultureInfo.CurrentCulture, Resources.LocalizedText.PrintViewCoverSheetDateTemplate, DateTime.Now);

            PrintingOptions po = PrintOptions1.Options;

            // Set any global font appropriately.
            pnlResults.Style["font-size"] = po.Size == PrintingOptions.FontSize.Normal ? "9pt" : String.Format(CultureInfo.InvariantCulture, po.Size == PrintingOptions.FontSize.Small ? "7pt" : "11pt");

            // Make sure that any PDF and section information is up-to-date, and that the PrintOptions property is set up correctly
            po.Sections    = printingSections;
            po.PDFSettings = pdfOptions;
            PrintOptions   = po;

            // Make sure copy link is up-to-date
            lnkPermalink.NavigateUrl = PermaLink(po, mfbSearchForm1.Restriction);

            mvLayouts.Visible       = po.Sections.IncludeFlights;
            pnlEndorsements.Visible = po.Sections.Endorsements != PrintingSections.EndorsementsLevel.None;
            rptImages.Visible       = po.Sections.Endorsements == PrintingSections.EndorsementsLevel.DigitalAndPhotos;
            pnlTotals.Visible       = po.Sections.IncludeTotals;
            pnlCover.Visible        = po.Sections.IncludeCoverPage;

            IList <LogbookEntryDisplay> lstFlights = LogbookEntryDisplay.GetFlightsForQuery(LogbookEntry.QueryCommand(mfbSearchForm1.Restriction, fAsc: true), CurrentUser.UserName, string.Empty, SortDirection.Ascending, CurrentUser.UsesHHMM, CurrentUser.UsesUTCDateOfFlight);
            PrintLayout pl = LogbookPrintedPage.LayoutLogbook(CurrentUser, lstFlights, ActiveTemplate, po, SuppressFooter);

            Master.PrintingCSS = pl.CSSPath.ToAbsoluteURL(Request).ToString();
        }
예제 #3
0
    protected void RefreshLogbookData()
    {
        mvLayouts.ActiveViewIndex = (int)PrintOptions1.Options.Layout;
        pnlResults.Visible        = true;

        IList <LogbookEntryDisplay> lstFlights = LogbookEntryDisplay.GetFlightsForQuery(LogbookEntry.QueryCommand(mfbSearchForm1.Restriction, fAsc: true), CurrentUser.UserName, string.Empty, SortDirection.Ascending, CurrentUser.UsesHHMM, CurrentUser.UsesUTCDateOfFlight);
        PrintLayout pl = LogbookPrintedPage.LayoutLogbook(CurrentUser, lstFlights, ActiveTemplate, PrintOptions1.Options, SuppressFooter);

        Master.PrintingCSS = pl.CSSPath.ToAbsoluteURL(Request).ToString();
    }
예제 #4
0
    protected void rptPages_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e == null)
        {
            throw new ArgumentNullException("e");
        }

        LogbookPrintedPage lep = (LogbookPrintedPage)e.Item.DataItem;

        Repeater rpt = (Repeater)e.Item.FindControl("rptFlight");

        rpt.DataSource = lep.Flights;
        rpt.DataBind();

        rpt            = (Repeater)e.Item.FindControl("rptSubtotalCollections");
        rpt.DataSource = lep.Subtotals;
        rpt.DataBind();
    }
        protected void rptPages_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            LogbookPrintedPage lep = (LogbookPrintedPage)e.Item.DataItem;

            StripRedundantOrExcludedProperties(null, lep.Flights);

            Repeater rpt = (Repeater)e.Item.FindControl("rptFlight");

            rpt.DataSource = lep.Flights;
            rpt.DataBind();

            rpt            = (Repeater)e.Item.FindControl("rptSubtotalCollections");
            rpt.DataSource = lep.Subtotals;
            rpt.DataBind();
        }
예제 #6
0
        protected void rptPages_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            LogbookPrintedPage lep = (LogbookPrintedPage)e.Item.DataItem;

            StripRedundantOrExcludedProperties(new int[] { (int)CustomPropertyType.KnownProperties.IDPropStudentName, (int)CustomPropertyType.KnownProperties.IDPropNameOfSIC, (int)CustomPropertyType.KnownProperties.IDPropNameOfPIC, (int)CustomPropertyType.KnownProperties.IDPropNightTakeoff }, lep.Flights);

            Repeater rpt = (Repeater)e.Item.FindControl("rptFlight");

            rpt.DataSource = lep.Flights;
            rpt.DataBind();

            rpt            = (Repeater)e.Item.FindControl("rptSubtotalCollections");
            rpt.DataSource = lep.Subtotals;
            rpt.DataBind();
        }
예제 #7
0
    protected void RefreshLogbookData()
    {
        MyFlightbook.Profile pf = MyFlightbook.Profile.GetUser(Page.User.Identity.Name);
        PrintingOptions      printingOptions = PrintOptions1.Options;

        mvLayouts.ActiveViewIndex = (int)printingOptions.Layout;
        List <LogbookEntryDisplay> lstFlights = LogbookEntryDisplay.GetFlightsForQuery(LogbookEntry.QueryCommand(mfbSearchForm1.Restriction, fAsc: true), pf.UserName, string.Empty, SortDirection.Ascending, pf.UsesHHMM, pf.UsesUTCDateOfFlight);

        IPrintingTemplate pt = ActiveTemplate;

        PrintLayout pl = PrintLayout.LayoutForType(printingOptions.Layout, CurrentUser);
        bool        fCanIncludeImages = pl.SupportsImages;

        List <int> lstPropsToExclude = new List <int>(printingOptions.ExcludedPropertyIDs);
        string     szPropSeparator   = printingOptions.PropertySeparatorText;

        // set up properties per flight, and compute rough lineheight
        foreach (LogbookEntryDisplay led in lstFlights)
        {
            // Fix up properties according to the printing options
            List <CustomFlightProperty> lstProps = new List <CustomFlightProperty>(led.CustomProperties);
            lstProps.RemoveAll(cfp => lstPropsToExclude.Contains(cfp.PropTypeID));

            led.CustomProperties    = lstProps.ToArray();
            led.CustPropertyDisplay = CustomFlightProperty.PropListDisplay(lstProps, pf.UsesHHMM, szPropSeparator);

            if (printingOptions.IncludeImages)
            {
                led.PopulateImages(true);
            }

            led.RowHeight = pl.RowHeight(led);
        }

        Master.PrintingCSS = pl.CSSPath.ToAbsoluteURL(Request).ToString();

        pt.BindPages(LogbookPrintedPage.Paginate(lstFlights, printingOptions.FlightsPerPage, printingOptions.OptionalColumns), CurrentUser, printingOptions.IncludeImages, !SuppressFooter, printingOptions.OptionalColumns);

        pnlResults.Visible = true;
    }
예제 #8
0
    protected void RefreshLogbookData()
    {
        MyFlightbook.Profile pf = MyFlightbook.Profile.GetUser(Page.User.Identity.Name);
        PrintingOptions      printingOptions = PrintOptions1.Options;

        mvLayouts.ActiveViewIndex = (int)printingOptions.Layout;
        List <LogbookEntryDisplay> lstFlights = LogbookEntryDisplay.GetFlightsForQuery(LogbookEntry.QueryCommand(mfbSearchForm1.Restriction, fAsc: true), pf.UserName, string.Empty, SortDirection.Ascending, pf.UsesHHMM, pf.UsesUTCDateOfFlight);

        IPrintingTemplate pt = ActiveTemplate;

        PrintLayout pl = PrintLayout.LayoutForType(printingOptions.Layout, CurrentUser);
        bool        fCanIncludeImages = pl.SupportsImages;

        // Exclude both excluded properties and properties that have been moved to their own columns
        HashSet <int> lstPropsToExclude    = new HashSet <int>(printingOptions.ExcludedPropertyIDs);
        HashSet <int> lstPropsInOwnColumns = new HashSet <int>();

        foreach (OptionalColumn oc in printingOptions.OptionalColumns)
        {
            if (oc.ColumnType == OptionalColumnType.CustomProp)
            {
                lstPropsInOwnColumns.Add(oc.IDPropType);
            }
        }
        string szPropSeparator = printingOptions.PropertySeparatorText;

        // set up properties per flight, and compute rough lineheight
        foreach (LogbookEntryDisplay led in lstFlights)
        {
            // Fix up properties according to the printing options
            List <CustomFlightProperty> lstProps = new List <CustomFlightProperty>(led.CustomProperties);

            // And fix up model as well.
            switch (printingOptions.DisplayMode)
            {
            case PrintingOptions.ModelDisplayMode.Full:
                break;

            case PrintingOptions.ModelDisplayMode.Short:
                led.ModelDisplay = led.ShortModelName;
                break;

            case PrintingOptions.ModelDisplayMode.ICAO:
                led.ModelDisplay = led.FamilyName;
                break;
            }


            // Remove from the total property set all explicitly excluded properties...
            lstProps.RemoveAll(cfp => lstPropsToExclude.Contains(cfp.PropTypeID));

            // ...and then additionally exclude from the display any that's in its own column to avoid redundancy.
            lstProps.RemoveAll(cfp => lstPropsInOwnColumns.Contains(cfp.PropTypeID));
            led.CustPropertyDisplay = CustomFlightProperty.PropListDisplay(lstProps, pf.UsesHHMM, szPropSeparator);

            if (printingOptions.IncludeImages)
            {
                led.PopulateImages(true);
            }

            if (!printingOptions.IncludeSignatures)
            {
                led.CFISignatureState = LogbookEntryBase.SignatureState.None;
            }
            led.RowHeight = pl.RowHeight(led);
        }

        Master.PrintingCSS = pl.CSSPath.ToAbsoluteURL(Request).ToString();

        pt.BindPages(LogbookPrintedPage.Paginate(lstFlights, printingOptions), CurrentUser, printingOptions, !SuppressFooter);

        pnlResults.Visible = true;
    }