示例#1
0
        protected void drawFieldDropBox(object selected, FParameters options, string toolTipTxt = "")
        {
            /*TEXT*/
            ComboBox txt = new ComboBox();

            txt.MinWidth          = 100;
            txt.VerticalAlignment = VerticalAlignment.Center;
            txt.Margin            = new Thickness(BORDER_MARGIN, BORDER_MARGIN, BORDER_MARGIN, BORDER_MARGIN);
            txt.Padding           = new Thickness(PADDING);
            if (toolTipTxt != "")
            {
                txt.ToolTip = toolTipTxt;
            }
            //txt.ItemsSource = options.Parameters
            txt.DisplayMemberPath = "Name";
            txt.SelectedValuePath = "Value";
            txt.ItemsSource       = options.Parameters;
            txt.SelectedValue     = selected;

            _form.Children.Add(txt);
            Grid.SetColumn(txt, formCol);
            Grid.SetRow(txt, formRow);

            incrementsColumns(txt);
        }
示例#2
0
        /// <summary>
        /// print the footer of the page;
        /// can contain eg. long caption lines that did not fit at top of the columns
        /// </summary>
        public override void PrintPageFooter()
        {
            System.Int32 columnNr;
            String       Caption;
            float        StringWidth;
            float        CurrentXPos;
            Int32        oldCurrentSubReport;

            if (FPrinter.PageFooterSpace == 0)
            {
                // this printer does not support page footers
                return;
            }

            FPrinter.LineFeedToPageFooter();
            FPrinter.DrawLine(FPrinter.LeftMargin, FPrinter.Width, eLinePosition.eAbove, eFont.eDefaultBoldFont);
            FPrinter.LineSpaceFeed(eFont.eSmallPrintFont);

            /*
             * TLogging.Log('TopMargin in cm: ' + Convert.ToString(TopMargin* 2.54));
             * TLogging.Log('BottomMargin in cm: ' + Convert.ToString(BottomMargin* 2.54));
             * TLogging.Log('Height in cm: ' + Convert.ToString(Height* 2.54));
             * TLogging.Log('Footerspace in cm: ' + Convert.ToString(FPageFooterSpace));
             * TLogging.Log('smallprintheight in cm: ' + Convert.ToString(SmallPrintFont.GetHeight(ev.Graphics)));
             * TLogging.Log('defaultheight in cm: ' + Convert.ToString(DefaultFont.GetHeight(ev.Graphics)));
             */
            oldCurrentSubReport = FParameters.Get("CurrentSubReport").ToInt();
            FParameters.Add("CurrentSubReport", -1);
            CurrentXPos = FPrinter.LeftMargin;

            for (columnNr = 0; columnNr <= FNumberColumns - 1; columnNr += 1)
            {
                if (FParameters.Exists("LongCaption", columnNr))
                {
                    Caption     = Get("LongCaption", columnNr);
                    StringWidth = FPrinter.GetWidthString(Caption, eFont.eSmallPrintFont);

                    if (FPrinter.ValidXPos(CurrentXPos + StringWidth))
                    {
                        // can print in same line
                        FPrinter.PrintString(Caption, eFont.eSmallPrintFont, CurrentXPos);
                    }
                    else
                    {
                        FPrinter.LineFeed(eFont.eSmallPrintFont);
                        CurrentXPos = FPrinter.LeftMargin;
                        FPrinter.PrintString(Caption, eFont.eSmallPrintFont, CurrentXPos);
                    }

                    CurrentXPos = CurrentXPos + StringWidth + FPrinter.GetWidthString("a", eFont.eSmallPrintFont) * 7;
                }
            }

            FParameters.Add("CurrentSubReport", oldCurrentSubReport);
        }
示例#3
0
        /// <summary>
        /// can either print or simulate
        /// </summary>
        /// <returns>s the current y position after printing or simulating
        /// </returns>
        protected override double PrintNormalLevelFooter(TResult row)
        {
            Boolean linePrinted;

            linePrinted = false;

            // footer
            if (FParameters.Get("SpaceLineAbove", -1, row.depth, eParameterFit.eExact).ToBool() == true)
            {
                FPrinter.LineSpaceFeed(eFont.eDefaultFont);
            }

            if (FParameters.Get("FullLineAbove", -1, row.depth, eParameterFit.eExact).ToBool() == true)
            {
                FPrinter.DrawLine(FPrinter.LeftMargin, FPrinter.Width, eLinePosition.eAbove, eFont.eDefaultFont);
                FPrinter.LineSpaceFeed(eFont.eDefaultFont);
            }

            FPrinter.PrintString(row.descr[0].ToString(), eFont.eDefaultFont,
                                 GetPosition(ReportingConsts.COLUMNLEFT + 1, row.depth,
                                             FPrinter.Cm(COLUMNLEFT1_POS)),
                                 GetWidth(ReportingConsts.COLUMNLEFT + 1, row.depth, FPrinter.Cm(3)),
                                 GetAlignment(ReportingConsts.COLUMNLEFT + 1, row.depth, eAlignment.eLeft));
            PrintColumns(row);
            linePrinted = FPrinter.PrintString(row.descr[1].ToString(), eFont.eDefaultFont,
                                               GetPosition(ReportingConsts.COLUMNLEFT + 1, row.depth,
                                                           FPrinter.Cm(COLUMNLEFT1_POS)),
                                               GetWidth(ReportingConsts.COLUMNLEFT + 1, row.depth, FPrinter.Cm(3)),
                                               GetAlignment(ReportingConsts.COLUMNLEFT + 1, row.depth, eAlignment.eLeft));

            if (linePrinted)
            {
                FPrinter.LineFeed(eFont.eDefaultFont);
            }

            if (FParameters.Get("FullLineBelow", -1, row.depth, eParameterFit.eExact).ToBool() == true)
            {
                FPrinter.DrawLine(FPrinter.LeftMargin, FPrinter.Width, eLinePosition.eAbove, eFont.eDefaultFont);
                FPrinter.LineSpaceFeed(eFont.eDefaultFont);
            }

            if (FParameters.Get("SpaceLineBelow", -1, row.depth, eParameterFit.eExact).ToBool() == true)
            {
                FPrinter.LineSpaceFeed(eFont.eDefaultFont);
            }

            FNextElementLineToPrint[row.depth] = eStageElementPrinting.eFinished;
            return(FPrinter.CurrentYPos);
        }
        public MSSQLOLEDBConnectionStringBuilder()
        {
#if USESQLOLEDB
            _parameters.AddOrUpdate("Provider", "SQLOLEDB");
#else
            FParameters.AddOrUpdate("Provider", "MSDASQL");
#endif

#if !USECONNECTIONPOOLING
            FParameters.AddOrUpdate("OLE DB Services", "-2");     // Turn off OLEDB resource pooling
#endif
            _legend.AddOrUpdate("ServerName", "Data source");
            _legend.AddOrUpdate("DatabaseName", "initial catalog");
            _legend.AddOrUpdate("UserName", "user id");
            _legend.AddOrUpdate("Password", "password");
            _legend.AddOrUpdate("ApplicationName", "app name");
        }
示例#5
0
        /// <summary>
        /// print one value, into the given column
        /// </summary>
        /// <param name="columnNr"></param>
        /// <param name="level"></param>
        /// <param name="column"></param>
        /// <returns></returns>
        protected override bool PrintColumn(Int32 columnNr, Int32 level, TVariant column)
        {
            String s;
            float  position;
            float  width;
            bool   linePrinted;

            linePrinted = false;
            position    = GetPosition(columnNr, level, 0);
            width       = GetWidth(columnNr, level, 0);
            s           = column.ToString();

            if (s.Length != 0)
            {
                linePrinted = true;

                if (FParameters.Get("LineAbove", columnNr, level, eParameterFit.eAllColumnFit).ToBool() == true)
                {
                    FPrinter.DrawLine(position, position + width, eLinePosition.eAbove, eFont.eDefaultFont);
                }

                if (FWrapColumn)
                {
                    FPrinter.PrintStringWrap(s, eFont.eDefaultFont, position, width, GetAlignment(columnNr, level, eAlignment.eRight));
                }
                else
                {
                    FPrinter.PrintString(s, eFont.eDefaultFont, position, width, GetAlignment(columnNr, level, eAlignment.eRight));
                }

                if (FParameters.Get("LineBelow", columnNr, level, eParameterFit.eAllColumnFit).ToBool() == true)
                {
                    FPrinter.DrawLine(position, position + width, eLinePosition.eBelow, eFont.eDefaultFont);
                }

                FPrinter.LineFeed(eFont.eDefaultFont);
            }

            return(linePrinted);
        }
示例#6
0
        public override int Execute(IDbConnection connection, IDbTransaction transaction)
        {
            FParameters.Clear();
            PreExecute();
            FSqlStatement = PrepareStatement();
            int OResult = 0;

            using (IDbCommand OCommand = connection.CreateCommand()) {
                OCommand.Transaction = transaction;
                OCommand.CommandText = FSqlStatement;
                foreach (IBaseParam OParam in FParameters)
                {
                    OParam.AddParameter(OCommand);
                }
                if (Provider.Current is SqlServerProvider && FFetchPrimaryKeyValueAfterInsert)
                {
                    /* TODO: The responsibility of returning the inserted PK value should be implemented in the provider instead */
                    using (IDataReader OReader = OCommand.ExecuteReader()) {
                        if (OReader.Read())
                        {
                            FInsertedPKValue = OReader.GetValue(0);
                            OResult          = OReader.GetInt32(1);
                        }
                    }
                    using (IDbCommand OAffectedCommand = connection.CreateCommand()) {
                        OAffectedCommand.Transaction = transaction;
                        OAffectedCommand.CommandText = "";
                    }
                }
                else
                {
                    OResult = OCommand.ExecuteNonQuery();
                }
            }
            PostExecute(OResult);
            return(OResult);
        }
示例#7
0
        /// <summary>
        /// multiline inputBox
        /// </summary>
        /// <param name="container"></param>
        /// <param name="parametersList"></param>
        /// <param name="displayAll"></param>
        /// <returns></returns>
        public async Task showInputBox(Grid container, FParameters parametersList, bool displayAll = false)
        {
            if (parametersList == null)
            {
                return;
            }
            this._parameterList = parametersList;

            initDialog(container);
            drawBorder();

            string title = parametersList.Title;

            drawFormTitle(title);
            foreach (FParameter param in parametersList)
            {
                string value = "";
                value = param.Name;
                if ((param.UserInput) || (displayAll))
                {
                    drawFieldInput(param.Name, param.Value + "", param.Label, param.UserInput);
                }
            }

            drawFormButtons();


            _inputBoxBorder.Child = _form;
            await WaitDialog();

            int i = 0;

            foreach (TextBox txt in txtList)
            {
                _parameterList.Parameters[i++].Value = txt.Text;
            }
        }
示例#8
0
        /// <summary>
        /// prints the captions of the columns;
        /// prepare the footer lines for long captions;
        /// is called by PrintPageHeader
        ///
        /// </summary>
        /// <returns>void</returns>
        protected override void PrintColumnCaptions()
        {
            int    columnNr;
            String Caption;

            System.Int32 NumberFooterLines;
            System.Int32 NumberFootNotes;
            float        YPosStartCaptions;
            float        LowestYPosCaptions;
            float        FooterXPos;
            bool         NeedCaptionInFooter;
            String       CaptionParameter;
            float        StringWidth;
            Int32        oldCurrentSubReport;
            eAlignment   CaptionAlignment;

            oldCurrentSubReport = FParameters.Get("CurrentSubReport").ToInt();
            FParameters.Add("CurrentSubReport", -1);
            FNumberColumns = -1;

            for (columnNr = 0; columnNr <= Convert.ToInt32(Get("MaxDisplayColumns")) - 1; columnNr += 1)
            {
                if (Get("param_calculation", columnNr) != "")
                {
                    FNumberColumns = columnNr + 1;
                }
            }

            YPosStartCaptions  = FPrinter.CurrentYPos;
            LowestYPosCaptions = FPrinter.CurrentYPos;
            NumberFooterLines  = 0;
            NumberFootNotes    = 0;
            FooterXPos         = FPrinter.LeftMargin;

            for (columnNr = 0; columnNr <= FNumberColumns - 1; columnNr += 1)
            {
                // go back to top of the caption rows.
                FPrinter.CurrentYPos = YPosStartCaptions;
                NeedCaptionInFooter  = false;

                // should we use the normal or the short version of the caption?
                // if a short version exists, it will be used, and the long version will be printed in the footer of the page
                CaptionParameter = "ColumnCaption";

                if (FParameters.Exists("ColumnShortCaption", columnNr))
                {
                    CaptionParameter    = "ColumnShortCaption";
                    NeedCaptionInFooter = true;
                }

                CaptionAlignment = eAlignment.eCenter;

                if (Get("ColumnAlign", columnNr) == "left")
                {
                    CaptionAlignment = eAlignment.eLeft;
                }

                Caption = Get(CaptionParameter, columnNr);

                if ((!FPrinter.PrintStringAndFits(Caption, eFont.eDefaultBoldFont, GetPosition(columnNr, -1, 0),
                                                  GetWidth(columnNr, -1, 0), CaptionAlignment)))
                {
                    // (Columns[columnNr] as RectangleF).Left
                    // (Columns[columnNr] as RectangleF).Width
                    // if the text is still too long, add a line to the footer
                    NeedCaptionInFooter = true;
                }

                FPrinter.LineFeed(eFont.eDefaultFont);
                Caption = Get(CaptionParameter + '2', columnNr);

                if (Caption.Length > 0)
                {
                    if ((!FPrinter.PrintStringAndFits(Caption, eFont.eDefaultFont,
                                                      GetPosition(columnNr, -1, 0), GetWidth(columnNr, -1, 0), eAlignment.eCenter)))
                    {
                        // (Columns[columnNr] as RectangleF).Left
                        // (Columns[columnNr] as RectangleF).Width
                        // if the text is still too long, add a line to the footer
                        NeedCaptionInFooter = true;
                    }

                    FPrinter.LineFeed(eFont.eDefaultFont);
                }

                // 3rd header line
                Caption = Get(CaptionParameter + "3", columnNr);

                if (Caption.Length > 0)
                {
                    if ((!FPrinter.PrintStringAndFits(Caption, eFont.eDefaultFont,
                                                      GetPosition(columnNr, -1, 0),
                                                      GetWidth(columnNr, -1, 0),
                                                      eAlignment.eCenter)))
                    {
                        // (Columns[columnNr] as RectangleF).Left
                        // (Columns[columnNr] as RectangleF).Width
                        // if the text is still too long, add a line to the footer
                        NeedCaptionInFooter = true;
                    }

                    FPrinter.LineFeed(eFont.eDefaultFont);
                }

                if (NeedCaptionInFooter)
                {
                    NumberFootNotes = NumberFootNotes + 1;

                    // save current lowest point
                    if (FPrinter.CurrentYPos > LowestYPosCaptions)
                    {
                        LowestYPosCaptions = FPrinter.CurrentYPos;
                    }

                    // go back into the first line of the caption
                    FPrinter.CurrentYPos = YPosStartCaptions;
                    FPrinter.PrintString("(" + NumberFootNotes.ToString() + ")",
                                         eFont.eSmallPrintFont,
                                         GetPosition(columnNr, -1, 0),
                                         GetWidth(columnNr, -1, 0),
                                         eAlignment.eRight);

                    // (Columns[columnNr] as RectangleF).Left
                    // (Columns[columnNr] as RectangleF).Width
                    Caption = Convert.ToString(NumberFootNotes) + ": " +
                              Get("ColumnCaption", columnNr) + " " +
                              Get("ColumnCaption2", columnNr) + " " +
                              Get("ColumnCaption3", columnNr);
                    FParameters.Add("LongCaption", new TVariant(Caption), columnNr);

                    // simulate the printing of the footer, to know how many rows are needed in the footer
                    StringWidth = FPrinter.GetWidthString(Caption, eFont.eSmallPrintFont);

                    if (!FPrinter.ValidXPos(FooterXPos + StringWidth))
                    {
                        FooterXPos        = FPrinter.LeftMargin;
                        NumberFooterLines = NumberFooterLines + 1;
                    }

                    FooterXPos = FooterXPos + StringWidth + FPrinter.GetWidthString("a", eFont.eSmallPrintFont) * 7;
                }

                // store the highest caption
                if (FPrinter.CurrentYPos > LowestYPosCaptions)
                {
                    LowestYPosCaptions = FPrinter.CurrentYPos;
                }
            }

            // feed forward to the lowest position after the captions
            FPrinter.CurrentYPos = LowestYPosCaptions;

            // if the line has not just begun, then add one more line
            if (FooterXPos != FPrinter.LeftMargin)
            {
                NumberFooterLines = NumberFooterLines + 1;
            }

            FPrinter.SetPageFooterSpace(NumberFooterLines, eFont.eSmallPrintFont);
            FParameters.Add("CurrentSubReport", oldCurrentSubReport);
        }