Exemplo n.º 1
0
        public void MergeFrom(GrpcJsonTranscoder other)
        {
            if (other == null)
            {
                return;
            }
            services_.Add(other.services_);
            if (other.printOptions_ != null)
            {
                if (printOptions_ == null)
                {
                    printOptions_ = new global::Envoy.Config.Filter.Http.Transcoder.V2.GrpcJsonTranscoder.Types.PrintOptions();
                }
                PrintOptions.MergeFrom(other.PrintOptions);
            }
            if (other.MatchIncomingRequestRoute != false)
            {
                MatchIncomingRequestRoute = other.MatchIncomingRequestRoute;
            }
            switch (other.DescriptorSetCase)
            {
            case DescriptorSetOneofCase.ProtoDescriptor:
                ProtoDescriptor = other.ProtoDescriptor;
                break;

            case DescriptorSetOneofCase.ProtoDescriptorBin:
                ProtoDescriptorBin = other.ProtoDescriptorBin;
                break;
            }

            _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
        }
Exemplo n.º 2
0
        public void PrintLargeFiles()
        {
            // ExStart:PrintLargeFiles
            // ExFor: PrintOptions
            // ExFor: PrintOptions.#ctor
            // ExFor: NoPrinterInstalledException
            // ExFor: NoPrinterInstalledException.#ctor(SerializationInfo,StreamingContext)
            // ExSummary: Shows how to use print options.
            try
            {
                var project = new Project(DataDir + "Project2.mpp");
                var options = new PrintOptions
                {
                    Timescale = Timescale.ThirdsOfMonths
                };
                if (project.GetPageCount(Timescale.ThirdsOfMonths) <= 280)
                {
                    project.Print(options);
                }
            }
            catch (NoPrinterInstalledException ex)
            {
                Console.WriteLine(ex.Message);
            }

            // ExEnd: PrintLargeFiles
            catch (NotSupportedException ex)
            {
                Console.WriteLine(
                    ex.Message
                    + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
            }
        }
Exemplo n.º 3
0
    private void PrintFileMenuItem_Click(object sender, EventArgs e)
    {
        if (this.document == null)
        {
            return;
        }

        PrintDialog printDialog = new PrintDialog()
        {
            AllowSomePages = true
        };

        if (printDialog.ShowDialog() == DialogResult.OK)
        {
            PrinterSettings printerSettings = printDialog.PrinterSettings;
            PrintOptions    printOptions    = new PrintOptions();

            // Set PrintOptions properties based on PrinterSettings properties.
            printOptions.CopyCount = printerSettings.Copies;
            printOptions.FromPage  = printerSettings.FromPage - 1;
            printOptions.ToPage    = printerSettings.ToPage == 0 ? int.MaxValue : printerSettings.ToPage - 1;

            this.document.Print(printerSettings.PrinterName, printOptions);
        }
    }
Exemplo n.º 4
0
 protected override CommonPrimitiveFormatterOptions GetPrimitiveOptions(PrintOptions printOptions) =>
 new CommonPrimitiveFormatterOptions(
     numberRadix: printOptions.NumberRadix,
     includeCodePoints: _includeCodePoints,
     escapeNonPrintableCharacters: printOptions.EscapeNonPrintableCharacters,
     quoteStringsAndCharacters: _quoteStringsAndCharacters,
     cultureInfo: _cultureInfo);
Exemplo n.º 5
0
        public void LargeGraph()
        {
            var    list = new LinkedList <object>();
            object obj  = list;

            for (int i = 0; i < 10000; i++)
            {
                var node    = list.AddFirst(i);
                var newList = new LinkedList <object>();
                list.AddAfter(node, newList);
                list = newList;
            }

            string output = "LinkedList<object>(2) { 0, LinkedList<object>(2) { 1, LinkedList<object>(2) { 2, LinkedList<object>(2) {";

            for (int i = 100; i > 4; i--)
            {
                var printOptions = new PrintOptions
                {
                    MaximumOutputLength = i,
                    MemberDisplayFormat = MemberDisplayFormat.SingleLine,
                };

                var actual   = s_formatter.FormatObject(obj, printOptions);
                var expected = output.Substring(0, i) + "...";
                Assert.Equal(expected, actual);
            }
        }
Exemplo n.º 6
0
 public void StartPrint(string docName = "", PrintOptions options = PrintOptions.Default)
 {
     if (!_doc.StartPrint(docName, (PrintOptionConstants)options))
     {
         throw new BpacException("Unable to start printing");
     }
 }
        public void ValidMaximumOutputLength()
        {
            var options = new PrintOptions();

            options.MaximumOutputLength = 1;
            Assert.Equal("1...", s_formatter.FormatObject(123456, options));

            options.MaximumOutputLength = 2;
            Assert.Equal("12...", s_formatter.FormatObject(123456, options));

            options.MaximumOutputLength = 3;
            Assert.Equal("123...", s_formatter.FormatObject(123456, options));

            options.MaximumOutputLength = 4;
            Assert.Equal("1234...", s_formatter.FormatObject(123456, options));

            options.MaximumOutputLength = 5;
            Assert.Equal("12345...", s_formatter.FormatObject(123456, options));

            options.MaximumOutputLength = 6;
            Assert.Equal("123456", s_formatter.FormatObject(123456, options));

            options.MaximumOutputLength = 7;
            Assert.Equal("123456", s_formatter.FormatObject(123456, options));
        }
        public static void Run()
        {
            // ExStart:PrintPrintOptionsAndPrinterSettings

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PrintingAndExporting();

            // Read the input Project file
            Project project = new Project(dataDir + "ST_AV_AF_DEV_AFT_EMP.mpp");

            PrintOptions options = new PrintOptions();

            options.Timescale = Timescale.Months;

            // Print first ten pages
            PrinterSettings printerSettings = new PrinterSettings();

            printerSettings.PrintRange = PrintRange.SomePages;
            printerSettings.FromPage   = 1;
            printerSettings.ToPage     = 10;

            System.Drawing.Printing.PageSettings pageSettings = printerSettings.DefaultPageSettings;
            pageSettings.PaperSize = new PaperSize(dataDir + "Custom Size", 1000, 700);
            project.Print(printerSettings, options);
            // ExEnd:PrintPrintOptionsAndPrinterSettings
        }
        public override void Apply([NotNull] T ruleContext)
        {
            // Execute action
            Assert.ArgumentNotNull(ruleContext, "ruleContext");
            Item item = ruleContext.Item;

            Logger.LogMessage("Workflow print to indesign started:" + item.Name + "_" + item.Language + ".pdf");
            //Logger.LogMessage("Workflow parameters:" + ruleContext.Parameters.Keys.ToString());

            if (this.ProjectId != ID.Null)
            {
                try
                {
                    string @string = StringUtil.GetString(new string[]
                    {
                        this.FileName,
                        this.ProjectId.ToString() + DateTime.Now.Ticks
                    });
                    PrintOptions printOptions = new PrintOptions
                    {
                        PrintExportType = PrintExportType.Pdf,
                        ResultFileName  = FileName + item.Name + "_" + item.Language + ".pdf",
                        UseHighRes      = false,
                        Parameters      = ruleContext.Parameters
                    };
                    PrintManager printManager = new PrintManager(item.Database, item.Language);
                    printManager.PrintAsync(this.ProjectId.ToString(), printOptions);
                }
                catch (Exception ex)
                {
                    Logger.LogMessage(ex.Message);
                }
            }
        }
Exemplo n.º 10
0
        protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            PrintOptions Options = new PrintOptions();

            Options.Indirect = true;
            Options.Fit      = true;

            Site SiteMaster = this.Master as Site;

            if (SiteMaster != null)
            {
                SiteMaster.printOptions = Options;

                ((Site)this.Master).OnClearFields += new EventHandler(ClearFields);
            }
            else
            {
                SiteNewPage SiteNewPageMaster = this.Master as SiteNewPage;
                if (SiteNewPageMaster != null)
                {
                    SiteNewPageMaster.printOptions = Options;
                }
            }

            string       GRN = Request.QueryString["GRN"];
            ITroposQuery grdORDERLINERECEIPTS_Query = new Populate_grdORDERLINERECEIPTS(UserContext, GRN);
            DataTable    grd_data_table             = Helpers.TroposQuery(grdORDERLINERECEIPTS_Query, UserContext);

            grdORDERLINERECEIPTS.DataSource = grd_data_table;
            grdORDERLINERECEIPTS.DataBind();
        }
 internal override BuilderOptions GetInternalBuilderOptions(PrintOptions printOptions) =>
     new BuilderOptions(
         indentation: "  ",
         newLine: Environment.NewLine,
         ellipsis: printOptions.Ellipsis,
         maximumLineLength: _maximumLineLength,
         maximumOutputLength: printOptions.MaximumOutputLength);
 protected override CommonPrimitiveFormatterOptions GetPrimitiveOptions(PrintOptions printOptions) =>
     new CommonPrimitiveFormatterOptions(
         numberRadix: printOptions.NumberRadix, 
         includeCodePoints: false,
         escapeNonPrintableCharacters: printOptions.EscapeNonPrintableCharacters, 
         quoteStringsAndCharacters: _quoteStringsAndCharacters,
         cultureInfo: _cultureInfo);
Exemplo n.º 13
0
 protected static void DrawDebugRect(PrintOptions options, XGraphics gfx, XRect bounds)
 {
     if (options.Debug)
     {
         gfx.DrawRectangle(XPens.Red, bounds);
     }
 }
        public static void Run()
        {
            //ExStart:PrintPrintOptionsAndPrinterSettings
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

            // Read the input Project file
            Project project = new Project(dataDir + "Project2.mpp");

            PrintOptions options = new PrintOptions();

            options.Timescale = Timescale.Months;

            // Print first two pages
            PrinterSettings printerSettings = new PrinterSettings();

            printerSettings.PrintRange = PrintRange.SomePages;
            printerSettings.FromPage   = 1;
            printerSettings.ToPage     = 2;

            System.Drawing.Printing.PageSettings pageSettings = printerSettings.DefaultPageSettings;
            pageSettings.PaperSize = new PaperSize(dataDir + "Custom Size", 1000, 700);
            project.Print(printerSettings, options);
            //ExEnd:PrintPrintOptionsAndPrinterSettings
        }
        internal override string ForTable(PrintOptions printOptions = null)
        {
            string str = revenueStats.ForTable(printOptions);

            str += expenseStats.ForTable(printOptions);
            return(str);
        }
        protected new void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            PrintOptions Options = new PrintOptions();

            Options.Indirect = true;
            Options.Fit      = true;

            Site SiteMaster = this.Master as Site;

            if (SiteMaster != null)
            {
                SiteMaster.printOptions = Options;

                ((Site)this.Master).OnClearFields += new EventHandler(ClearFields);
            }
            else
            {
                SiteNewPage SiteNewPageMaster = this.Master as SiteNewPage;
                if (SiteNewPageMaster != null)
                {
                    SiteNewPageMaster.printOptions = Options;
                }
            }

            string       RejectNoteNo = Request.QueryString["RejectNote"];
            ITroposQuery grdREJECTNOTEINFORMATION_Query = new Populate_grdREJECTNOTEINFORMATION(UserContext, RejectNoteNo);
            DataTable    grd_data_table = Helpers.TroposQuery(grdREJECTNOTEINFORMATION_Query, UserContext);

            grdREJECTNOTEINFORMATION.DataSource = grd_data_table;
            grdREJECTNOTEINFORMATION.DataBind();
        }
        private PrintOptions LoadPrintConfiguration(TomlTable configTable)
        {
            PrintOptions options = new PrintOptions();

            if (configTable != null && configTable.ContainsKey("PrintOptions"))
            {
                TomlTable settings = configTable.Get <TomlTable>("PrintOptions");

                if (settings.ContainsKey("Orientation"))
                {
                    options.Orientation = (FilmOrientation)settings.Get <TomlInt>("Orientation").Value;
                }
                if (settings.ContainsKey("Size"))
                {
                    options.FilmSize = (FilmSize)settings.Get <TomlInt>("Size").Value;
                }
                if (settings.ContainsKey("Magnification"))
                {
                    options.MagnificationType = (MagnificationType)settings.Get <TomlInt>("Magnification").Value;
                }
                if (settings.ContainsKey("Medium"))
                {
                    options.MediumType = (MediumType)settings.Get <TomlInt>("Medium").Value;
                }
            }

            return(options);
        }
Exemplo n.º 18
0
        public void ValidMemberDisplayFormat()
        {
            var options = new PrintOptions();

            options.MemberDisplayFormat = MemberDisplayFormat.Hidden;
            Assert.Equal("PrintOptions", s_formatter.FormatObject(options, options));

            options.MemberDisplayFormat = MemberDisplayFormat.SingleLine;
            Assert.Equal(
                "PrintOptions { Ellipsis=\"...\", EscapeNonPrintableCharacters=true, MaximumOutputLength=1024, MemberDisplayFormat=SingleLine, NumberRadix=10 }",
                s_formatter.FormatObject(options, options)
                );

            options.MemberDisplayFormat = MemberDisplayFormat.SeparateLines;
            Assert.Equal(
                @"PrintOptions {
  Ellipsis: ""..."",
  EscapeNonPrintableCharacters: true,
  MaximumOutputLength: 1024,
  MemberDisplayFormat: SeparateLines,
  NumberRadix: 10,
  _maximumOutputLength: 1024,
  _memberDisplayFormat: SeparateLines,
  _numberRadix: 10
}
",
                s_formatter.FormatObject(options, options)
                );
        }
Exemplo n.º 19
0
        public static void Print_DataGridView(DataGridView dgv1)
        {
            PrintPreviewDialog ppvw;

            try
            {
                // Getting DataGridView object to print
                dgv = dgv1;

                // Getting all Coulmns Names in the DataGridView
                AvailableColumns.Clear();
                foreach (DataGridViewColumn c in dgv.Columns)
                {
                    if (!c.Visible)
                    {
                        continue;
                    }
                    AvailableColumns.Add(c.HeaderText);
                }

                // Showing the PrintOption Form
                PrintOptions dlg = new PrintOptions(AvailableColumns);
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                PrintTitle      = dlg.PrintTitle;
                PrintAllRows    = dlg.PrintAllRows;
                FitToPageWidth  = dlg.FitToPageWidth;
                SelectedColumns = dlg.GetSelectedColumns();

                RowsPerPage = 0;

                ppvw          = new PrintPreviewDialog();
                ppvw.Document = printDoc;

                // Showing the Print Preview Page
                printDoc.BeginPrint += new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint);
                printDoc.PrintPage  += new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage);
                if (ppvw.ShowDialog() != DialogResult.OK)
                {
                    printDoc.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint);
                    printDoc.PrintPage  -= new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage);
                    return;
                }

                // Printing the Documnet
                printDoc.Print();
                printDoc.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint);
                printDoc.PrintPage  -= new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
            }
        }
Exemplo n.º 20
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (descriptorSetCase_ == DescriptorSetOneofCase.ProtoDescriptor)
            {
                hash ^= ProtoDescriptor.GetHashCode();
            }
            if (descriptorSetCase_ == DescriptorSetOneofCase.ProtoDescriptorBin)
            {
                hash ^= ProtoDescriptorBin.GetHashCode();
            }
            hash ^= services_.GetHashCode();
            if (printOptions_ != null)
            {
                hash ^= PrintOptions.GetHashCode();
            }
            if (MatchIncomingRequestRoute != false)
            {
                hash ^= MatchIncomingRequestRoute.GetHashCode();
            }
            hash ^= (int)descriptorSetCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 21
0
 protected override BuilderOptions GetInternalBuilderOptions(PrintOptions printOptions) =>
 new BuilderOptions(
     indentation: "  ",
     newLine: Environment.NewLine,
     ellipsis: printOptions.Ellipsis,
     maximumLineLength: _maximumLineLength,
     maximumOutputLength: printOptions.MaximumOutputLength);
Exemplo n.º 22
0
        /// <summary>
        /// Gets the qr image file path.
        /// </summary>
        /// <param name="contentItem">The content item.</param>
        /// <param name="printOptions">The print options.</param>
        /// <returns>
        /// The qr image file path.
        /// </returns>
        private string GetQrImageFilePath(Item contentItem, PrintOptions printOptions)
        {
            string fileName;

            fileName = contentItem["ExternalID"];

            return(Path.Combine(printOptions.CacheFolder, fileName + ".png"));
        }
Exemplo n.º 23
0
        public static void Output(string message, YogaNode node, PrintOptions options = PrintOptions.Layout | PrintOptions.Style | PrintOptions.Children)
        {
            var print = new YogaNodePrint(options);

            print.Output(node);
            Logger.Log(LogLevel.Debug, "\n" + message);
            Logger.Log(LogLevel.Debug, print.ToString());
        }
Exemplo n.º 24
0
 public ScriptEvaluator()
 {
     objectFormatter = CSharpObjectFormatter.Instance;
     printOptions    = new PrintOptions {
         MaximumOutputLength = 114514, EscapeNonPrintableCharacters = true
     };
     parseOptions = new CSharpParseOptions(kind: SourceCodeKind.Script, languageVersion: LanguageVersion.Latest);
 }
Exemplo n.º 25
0
        public async Task Print(PrintOptions options)
        {
            if (module is null)
            {
                await ImportModule();
            }

            await module.InvokeVoidAsync("print", new PrintOptionsAdapter(options));
        }
Exemplo n.º 26
0
        protected override async void OnInitialActivate()
        {
            base.OnInitialActivate();
            ServerConfigViewModel.Init(this);
            PrintPreviewViewModel.Parent = this;
            await PrintPreviewViewModel.AddSampleImage();

            PrintOptions = configurationService.GetConfiguration <PrintOptions>("PrintOptions");
            await messenger.SubscribeAsync(this, "Config", ReloadPrintOptions);
        }
Exemplo n.º 27
0
        internal string ForTable(PrintOptions printOptions)
        {
            string str = string.Empty;

            str += flightStats.ForTable(printOptions);
            str += passengerStats.ForTable(printOptions);
            str += fuelStats.ForTable(printOptions);
            str += luggageStats.ForTable(printOptions);
            return(str);
        }
Exemplo n.º 28
0
        public string Print(PrintOptions ops)
        {
            string r = Phase.ToString();

            if (Qualifier != ValueQualifier.None && ops.ShowQualifier())
            {
                r = String.Format("{0} ({1})", r, Qualifier);
            }
            return(r);
        }
Exemplo n.º 29
0
        public virtual string Print(PrintOptions ops)
        {
            StringBuilder s = new StringBuilder();

            s.Append(Value);
            if (ops.ShowQualifier())
            {
                s.Append(TAB).Append(Qualifier);
            }
            return(s.ToString());
        }
Exemplo n.º 30
0
        internal override string ForChart(PrintOptions printOptions = null)
        {
            string str = string.Empty;

            for (int day = printOptions.FirstDay; day <= printOptions.LastDay; day++)
            {
                str += day > printOptions.FirstDay ? "," : string.Empty;
                str += $"\"{day}\":{{{nSchedFlights.ForChart(day)},{nOntimeDeparture.ForChart(day)},{nDelayedDeparture.ForChart(day)},{nCancelled.ForChart(day)}}}";
            }
            return(str);
        }
 /// <summary>
 /// Prints the specified item id.
 /// </summary>
 /// <param name="itemId">The item id.</param>
 /// <param name="printOptions">The print options.</param>
 /// <returns></returns>
 public string Print(string itemId, PrintOptions printOptions)
 {
     using (new LanguageSwitcher(this.language))
     {
         Item printItem = this.database.GetItem(ID.Parse(itemId));
         if (printItem == null)
             return (string)null;
         else
             return this.RunPipeline("ePubPrint", new PrintPipelineArgs(printItem, printOptions));
     }
 }
Exemplo n.º 32
0
        public void ValidEscapeNonPrintableCharacters()
        {
            var options = new PrintOptions();

            options.EscapeNonPrintableCharacters = true;
            Assert.Equal(@"""\t""", s_formatter.FormatObject("\t", options));
            Assert.Equal(@"'\t'", s_formatter.FormatObject('\t', options));

            options.EscapeNonPrintableCharacters = false;
            Assert.Equal("\"\t\"", s_formatter.FormatObject("\t", options));
            Assert.Equal("'\t'", s_formatter.FormatObject('\t', options));
        }
Exemplo n.º 33
0
        private string CanceledFor(PrintOptions printOptions, bool oddRow)
        {
            string str = $"<tr{(oddRow ? " class=\"oddRow\"" : string.Empty)}><td>{i18n.Get("TBFlash.AirportStats.AirlineCompanyStats.canceledFor")}</td>\n";

            if (printOptions.IncludeLifetime)
            {
                str += CanceledForContent(0, 0);
            }
            str += CanceledForContent(printOptions.FirstDay, printOptions.LastDay);
            str += "</tr>";
            return(str);
        }
        public static void Run()
        {
            // ExStart:PrintLargeFiles
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

            // Read the input Project file
            Project project = new Project(dataDir + "Project2.mpp");
 
            PrintOptions options = new PrintOptions();
            options.Timescale = Timescale.ThirdsOfMonths;
            if (project.GetPageCount(Timescale.ThirdsOfMonths) <= 280)
                project.Print(options);
            // ExEnd:PrintLargeFiles
        }
Exemplo n.º 35
0
 public static void PrintStatistic(double[] numbers, PrintOptions option)
 {
     switch (option)
     {
         case PrintOptions.Min:
             double minStatistic = GetMinStatistic(numbers);
             Console.WriteLine("Manimum element in the statistic is {0}!", minStatistic);
             break;
         case PrintOptions.Max:
             double maxStatistic = GetMaxStatistic(numbers);
             Console.WriteLine("Maximum element in the statistic is {0}!", maxStatistic);
             break;
         case PrintOptions.Avarage:
             double avarageStatistic = GetAvarageStatistic(numbers);
             Console.WriteLine("Avarage of all elements in the statistic is {0}!", avarageStatistic);
             break;
         default:
             ///throw new ArgumentException("Invalid print option!");
             break;
     }
 }
        public static void Run()
        {
            // ExStart:PrintPrintOptionsAndPrinterSettings
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

            // Read the input Project file
            Project project = new Project(dataDir + "Project2.mpp");

            PrintOptions options = new PrintOptions();
            options.Timescale = Timescale.Months;

            // Print first two pages
            PrinterSettings printerSettings = new PrinterSettings();
            printerSettings.PrintRange = PrintRange.SomePages;
            printerSettings.FromPage = 1;
            printerSettings.ToPage = 2;

            System.Drawing.Printing.PageSettings pageSettings = printerSettings.DefaultPageSettings;
            pageSettings.PaperSize = new PaperSize(dataDir + "Custom Size", 1000, 700);
            project.Print(printerSettings, options);
            // ExEnd:PrintPrintOptionsAndPrinterSettings
        }
    protected void btnPrint_Click(object sender, EventArgs e)
    {
      Item projectItem = Sitecore.Context.Database.GetItem(this.projectPath);

      Sitecore.Security.Accounts.User user = Sitecore.Context.User;
      Sitecore.Security.UserProfile profile = user.Profile;

      if (projectItem != null)
      {
          string fileName = string.Format("{0}_{1}", projectItem.Name, DateTime.Now.Ticks.ToString());

          PrintOptions printOptions = new PrintOptions
          {
              PrintExportType = PrintExportType.Pdf,
              ResultFileName = fileName,
              UseHighRes = false
          };

          Database masterBase = Factory.GetDatabase("master");

          printOptions.Parameters.Add("articles", profile.GetCustomProperty("Favorites"));

          PrintManager printManager = new PrintManager(masterBase, Sitecore.Context.Language);
          string result = printManager.Print(projectItem.ID.ToString(), printOptions);

          if (!string.IsNullOrEmpty(result) && File.Exists(result))
          {
              var file = new FileInfo(result);
              Response.ContentType = "application/pdf";
              Response.AppendHeader("content-disposition", string.Format("attachment; filename={0}", file.Name));
              Response.AppendHeader("Content-Length", file.Length.ToString());
              Response.TransmitFile(file.FullName);
              Response.Flush();
              Response.End();
          }
      }
    }
Exemplo n.º 38
0
        private void Listazas()
        {
            //if (VanDatum)
            //{
                FakUserInterface.SetUserSzamitasokKellSzamitasDatum(true);
                FakUserInterface.SetUserSzamitasokDatumHatarok(Convert.ToDateTime(Datum1), Convert.ToDateTime(Datum2));
            //}
            //else
            //{
            //    Datum1 = FakUserInterface.DatumToString(DateTime.Today);
            //    Datum2 = Datum1;
            //}
            prop = report.PrintOptions;
            bool portop = true;
            if (listae && Listainfok.Oszlopinfok.Mezoinfok.Count > 7 || !listae && 1 + Listainfok.Matrixpontinfok.Mezoinfok.Count * (Listainfok.Matrixpontinfok.OszlopokSzama + 1) > 6)
                portop = false;
            if (portop)
                prop.PaperOrientation = PaperOrientation.Portrait;
            else
                prop.PaperOrientation = PaperOrientation.Landscape;
            foreach (DataTable dt in dataset.Tables)
                dt.Rows.Clear();
            dr = null;
            for (int i = 1; i < ig; i++)
            {
                DataView view = (DataView)osszesview[i];
                DataTable table = view.Table;
                if (view.Count != 0)
                {
                    egysor = "";
                    bool first = true;
                    int count = 1;
                    for (int j = 0; j < view.Count; j++)
                    {
                        if (j != 0)
                            egysor += newline[0].ToString();
                        DataRow row = view[j].Row;
                        for (int k = 2; k < table.Columns.Count; k++)
                        {
                            if (i != 1)
                            {
                                if (first)
                                {
                                    egysor += count.ToString();
                                    count++;
                                    first = false;
                                }
                            }
                            if (row[k].ToString() != "")
                            {
                                if (egysor != "")
                                    egysor += " ";
                                egysor += row[k].ToString();
                            }
                            if (i != -1 && table.Columns[k].ColumnName == "ESVAGY" && row[k].ToString() == "")
                                first = true;
                        }
                    }
                    switch (i)
                    {
                        case 1:
                            parfeltetel = egysor;
                            break;
                        case 2:
                            parsormeghatarozas = egysor;
                            break;
                        case 3:
                            paroszlopmeghatarozas = egysor;
                            break;
                    }
                }
            }
            elsotabinfo = Listainfok.ElsoTabinfo;
            DataTable dt1 = dataset.DataTable2;
            dr = dt1.NewRow();
            fotabla = elsotabinfo.DataView;
            OsszesBeallitandoId = Listainfok.OsszesBeallitandoId;
            OsszesBeallitottIdErtek = Listainfok.OsszesBeallitottIdErtek;
            tabinfok = Listainfok.Tablainfok;
            int tablainfoindex = Listainfok.Tablainfok.IndexOf(elsotabinfo);
            string tablanev = elsotabinfo.TablaTag.Azonositok.Szoveg;
            elsotabinfo.Adattabla.Rows.Clear();
            string selstring = elsotabinfo.GetTablainfoSelect(OsszesBeallitottIdErtek);
            string orderstring = elsotabinfo.Sort;
            ValtozasBeallit();
            elsotabinfo.DataView.Sort = orderstring;
            FakUserInterface.Select(fotabla.Table, FakUserInterface.AktualCegconn, fotabla.Table.TableName, selstring, "", false);
            elsotabinfo.Tartalmaktolt();
            if (!listae)
            {
                SorokSzama = Listainfok.Matrixpontinfok.SorokSzama;
                OszlopokSzama = Listainfok.Matrixpontinfok.OszlopokSzama;
            }
            SaveFilterek = new string[tabinfok.Count];
            SaveViewIndexek = new int[tabinfok.Count];
            sorokszama = new int[tabinfok.Count];
            int focount = fotabla.Table.Rows.Count;
            bool folytassuk = focount != 0;
            int rekszam = focount;
            int feldrekszam = 0;
            int fofilcount = elsotabinfo.RowFilterek.Count;
            int olvasdb = 0;
            int tabinfocount = tabinfok.Count - 1;
            if (tabinfocount == 0)
                tabinfocount++;
            if (fofilcount > 0)
            {
                string savfilt = "";
                elsotabinfo.RowFilterIndex = -1;
                int kulsociklusdb = 0;
                do
                {
                    //Datumbeallitasok();
                    //if (elsotabinfo.SpecDatumNevekArray.Count != 0)
                    //    elsotabinfo.DatumString=
                    for (int i = 0; i < fofilcount; i++)
                    {
                        elsotabinfo.SetRowFilter();
                        if (savfilt != elsotabinfo.DataView.RowFilter)
                        {
                            olvasdb += elsotabinfo.DataView.Count * tabinfocount;
                            feldrekszam += elsotabinfo.DataView.Count;
                            savfilt = elsotabinfo.DataView.RowFilter;
                        }
                    }
                    elsotabinfo.RowFilterIndex = -1;
                    kulsociklusdb++;
                } while (kulsociklusdb < elsotabinfo.SpecDatumNevekArray.Count);
                olvasdb += 1;
            }
            else
            {
                feldrekszam = rekszam;
                olvasdb = focount * tabinfocount;
            }
            if (!folytassuk)
                MessageBox.Show(tablanev + " beolvasott rekordszáma: 0\nA feltételek megfogalmazásában esetleg ellentmondás van!");
            else if (this.Name == "Altlistazoalap")
            {
                string figy = "";
                if (rekszam < feldrekszam)
                    figy = "\nA feltételek megfogalmazásában redundacia van!";
                olvasdb = olvasdb * Datumtomb.Count;
                feldrekszam = feldrekszam * Datumtomb.Count;
                folytassuk = MessageBox.Show(tablanev + " beolvasott rekordszáma:" + rekszam.ToString() + "\nFeldolgozott rekordok:" + feldrekszam.ToString() + figy + "\nVárható lemezműveletek száma:" + olvasdb.ToString() + "\nFolytassuk?", "", FakPlusz.MessageBox.MessageBoxButtons.IgenNem) == MessageBox.DialogResult.Igen;
            }
            if (folytassuk)
            {
                dataset.DataTable3.Rows.Clear();
                sorrendtabinfo = null;
                if (Listainfok.Sorrendinfok.Mezoinfok.Count != 0)
                    sorrendtabinfo = (Tablainfo[])Listainfok.Sorrendinfok.Mezoinfok.Tablainfok.ToArray(typeof(Tablainfo));
                if (Listainfok.Oszlopinfok.Mezoinfok.Count != 0)
                    oszloptabinfok = (Tablainfo[])Listainfok.Oszlopinfok.Mezoinfok.Tablainfok.ToArray(typeof(Tablainfo));
                if (Listainfok.Matrixpontinfok.Mezoinfok.Count != 0)
                    matrixponttabinfok = (Tablainfo[])Listainfok.Matrixpontinfok.Mezoinfok.Tablainfok.ToArray(typeof(Tablainfo));
                egysor = "";
                uresek = new bool[tabinfok.Count];
                ures = false;
                for (int j = 0; j < tabinfok.Count; j++)
                    uresek[j] = false;
                firsttime = true;
                dt = dataset.DataTable2;
                elsotabinfo.DataView.RowFilter = "";
                elsotabinfo.SetRowFilter();
                string savfilt = elsotabinfo.DataView.RowFilter;
                SaveFilterek[tabinfok.IndexOf(elsotabinfo)] = savfilt;
                int datumtombcount = 0;
                do
                {
                    if (Datumtomb.Count != 0)
                    {
                        string[] datumok = (string[])Datumtomb[datumtombcount];
                        string elem1 = datumok[0];
                        string elem2 = datumok[1];
                        DateTime[] datetimeok = new DateTime[] { Convert.ToDateTime(datumok[0]), Convert.ToDateTime(datumok[1]) };
                        DateTime ujdatum;
                        if (mindatum.CompareTo(elem1) > 0)
                            ujdatum = Convert.ToDateTime(mindatum);
                        else
                            ujdatum = Convert.ToDateTime(elem1);
                        FakUserInterface.Cegadatok(ujdatum);

                        Datumtoligfeltetel = "(DATUMTOL IS NULL AND (DATUMIG IS NULL OR DATUMIG >= '" + elem1
                            + "') OR DATUMTOL IS NOT NULL AND DATUMTOL <= '" + elem2
                            + "' AND (DATUMIG IS NULL OR DATUMIG >= '" + elem1 + "')) ";
                        Kezdetefeltetel = "(KEZDETE IS NULL OR KEZDETE <= '" + elem2
                            + "') AND (VEGE IS NULL  OR VEGE >= '" + elem1 + "') ";
                        foreach (Tablainfo egyinfo in tabinfok)
                        {
                            string datumstring = "";
                            if (egyinfo.TablaColumns.IndexOf("DATUMTOL") != -1)
                                egyinfo.DatumString = Datumtoligfeltetel;

                            else if (egyinfo.TablaColumns.IndexOf("KEZDETE") != -1)
                                egyinfo.DatumString = Kezdetefeltetel;
                            else if (egyinfo.SpecDatumNevekArray.Count != 0)
                            {
                                for (int i = 0; i < egyinfo.SpecDatumNevek.Length; i++)
                                {
                                    if (egyinfo.SpecDatumNevSzerepel[i] || egyinfo == elsotabinfo)
                                    {
                                        if (datumstring == "")
                                            datumstring += "(";
                                        else
                                            datumstring += " OR ";
                                        string nev = egyinfo.SpecDatumNevek[i];
                                        datumstring += nev + " <= '" + elem2 + "' AND " + nev + " >= '" + elem1 + "'";
                                    }
                                }
                                if (datumstring != "")
                                    datumstring += ")";
                                egyinfo.DatumString = datumstring;
                            }
                            if (egyinfo == elsotabinfo)
                            {
                                selstring = elsotabinfo.GetTablainfoSelect(OsszesBeallitottIdErtek);
                                FakUserInterface.Select(fotabla.Table, FakUserInterface.AktualCegconn, fotabla.Table.TableName, selstring, "", false);
                                elsotabinfo.Tartalmaktolt();
                            }
                            //if (egyinfo != ElsoTabinfo)
                            //{
                            //    egyinfo.BeallitandoIdkArray(elsotabinfoid, ElsoTabinfo, Tablainfok, OsszesBeallitandoId, OsszesBeallitottIdErtek);
                            //}
                        }
                    }

                    do
                    {
                        elsotabinfo.RowFilterIndex = -1;
                        elsotabinfo.DataView.RowFilter = "";
                        elsotabinfo.SetRowFilter();
                        savfilt = elsotabinfo.DataView.RowFilter;
                        SaveFilterek[tabinfok.IndexOf(elsotabinfo)] = savfilt;

                        for (int i = 0; i < fotabla.Count; i++)
                        {
                            elsotabinfo.ViewSorindex = i;
                            SaveViewIndexek[0] = elsotabinfo.ViewSorindex;
                            dr = fotabla[i].Row;
                            elsotabinfo.Tartalmaktolt(i);
                            elsotabinfo.IdErtekBeallitasok(dr, OsszesBeallitottIdErtek);
                            ures = TobbiTabinfoSelect();
                            if (!ures)
                            {
                                if (firsttime)
                                    ReportHeaderOsszeallit();
                                do
                                {
                                    sorrendvaltozasszint = SorrendValtozasok();
                                    kellcsakosszegsorba = false;
                                    if (sorrendvaltozasszint != -1)
                                    {
                                        int tol = Listainfok.Sorrendinfok.Mezoinfok.Count - 1;
                                        if (listae)
                                            count = Listainfok.Oszlopinfok.Mezoinfok.Count - 1;
                                        else
                                            count = (Listainfok.Matrixpontinfok.OszlopokSzama + 1) * Listainfok.Matrixpontinfok.Mezoinfok.Count;

                                        if (listae && (Listainfok.Oszlopinfok.Osszegzendok.Count != 0 || Listainfok.Oszlopinfok.Atlagolandok.Count!=0) || !listae)
                                        {
                                            do
                                            {
                                                dr = dt.NewRow();
                                                s = Listainfok.Sorrendinfok.Mezoinfok[tol].ElozoSorrendTartalom;
                                                if (s != "")
                                                {
                                                    if (listae || tol != Listainfok.Sorrendinfok.Mezoinfok.Count - 1)
                                                        s += " összesen:";
                                                    dr[0] = s;
                                                    dt.Rows.Add(dr);
                                                    if (listae)
                                                        Listainfok.Oszlopinfok.OsszegsorOsszeallit(tol, dt);
                                                    else
                                                        Listainfok.Matrixpontinfok.OsszegsorOsszeallit(tol, dt);
                                                    if (!listae)
                                                    {
                                                        dr = dt.NewRow();
                                                        for (int j = 0; j <= count; j++)
                                                            dr[j] = "__________";
                                                        dt.Rows.Add(dr);
                                                    }
                                                }
                                                tol = tol - 1;
                                            } while (sorrendvaltozasszint <= tol);
                                        }
                                        if (listae)
                                        {
                                            dr = dt.NewRow();
                                            for (int j = 0; j <= count; j++)
                                                dr[j] = "__________";
                                            dt.Rows.Add(dr);
                                        }
                                    }
                                    foreach (Mezoinfo info in Listainfok.Sorrendinfok.Mezoinfok)
                                    {
                                        string tart = info.ColumnInfo.Tablainfo.GetSorrendtartalom(info);
                                        if (tart != "")
                                        {
                                            kellcsakosszegsorba = true;
                                            if (listae)
                                            {
                                                dr = dt.NewRow();
                                                dr[0] = tart;
                                                dt.Rows.Add(dr);
                                            }
                                        }
                                    }
                                    if (listae)
                                    {
                                        foreach (Tablainfo egytabinfo in oszloptabinfok)
                                        {
                                            if (egytabinfo.ViewSorindex != -1)
                                                egytabinfo.Tartalmaktolt(egytabinfo.ViewSorindex);
                                        }
                                        if (egysor != "")
                                            egysor += newline[0];
                                        dr = dt.NewRow();
                                        for (int j = 0; j < dt.Columns.Count; j++)
                                        {
                                            if (j < Listainfok.Oszlopinfok.Mezoinfok.Count)
                                            {
                                                Mezoinfo info = Listainfok.Oszlopinfok.Mezoinfok[j];
                                                string tart = "";
                                                if (!info.CsakOsszegsorba || kellcsakosszegsorba)
                                                    tart = info.ColumnInfo.Tablainfo.GetOszlopTartalom(info);
                                                if (!info.CsakOsszegsorba)
                                                {
                                                    split = tart.Split(vesszo);
                                                    if (split.Length == 2)
                                                    {
                                                        if (split[1].Length > 2)
                                                        {
                                                            split[1] = split[1].Substring(0, 2);
                                                            tart = split[0] + "," + split[1];
                                                        }
                                                    }
                                                    dr[j] = tart;
                                                }
                                                else
                                                    dr[j] = "";
                                                if (info.Osszegzendo || info.Atlagolando)
                                                    Listainfok.Oszlopinfok.Osszegfeladasok(info);
                                            }
                                            else
                                                dr[j] = "";
                                        }
                                        dt.Rows.Add(dr);
                                        ures = TobbiTabinfoKovsor();
                                    }
                                    else
                                    {
                                        for (int j = 0; j < tabinfok.Count; j++)
                                        {
                                            tabinfok[j].ViewSorindex = SaveViewIndexek[j];
                                            tabinfok[j].IdErtekBeallitasok(tabinfok[j].AktualViewRow, OsszesBeallitottIdErtek);
                                        }
                                        for (int j = 0; j < SorokSzama; j++)
                                        {
 //                                           elsotabinfo.DataView.RowFilter = "";
                                            elsotabinfo.ViewSorindex = i;
                                            ures = ElsoTabinfoSorVizsg(j);
                                            if (!ures)
                                            {
                                                ures = TobbiSorTabinfoSelect(j);
                                                bool elso = true;
                                                if (!ures)
                                                {
                                                    do
                                                    {
                                                        if (!elso)
                                                        {
                                                            Tablainfo tabinfo;
                                                            for (int l = 0; l < Listainfok.Matrixpontinfok.Mezoinfok.Tablainfok.Count; l++)
                                                            {
                                                                tabinfo = Listainfok.Matrixpontinfok.Mezoinfok.Tablainfok[l];
                                                                int id = tabinfok.IndexOf(tabinfo);
                                                                tabinfo.ViewSorindex = SaveViewIndexek[id] + 1;
                                                                tabinfo.Tartalmaktolt(tabinfo.ViewSorindex);
                                                                tabinfo.IdErtekBeallitasok(tabinfo.AktualViewRow, OsszesBeallitottIdErtek);
                                                                SaveViewIndexek[id] = tabinfo.ViewSorindex;
                                                            }
                                                            ures = true;
                                                            for (int l = 0; l < Listainfok.Matrixpontinfok.Mezoinfok.Tablainfok.Count; l++)
                                                            {
                                                                tabinfo = Listainfok.Matrixpontinfok.Mezoinfok.Tablainfok[l];
                                                                if (tabinfo.ViewSorindex != -1)
                                                                    ures = false;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            for (int l = 0; l < Listainfok.Matrixpontinfok.Mezoinfok.Tablainfok.Count; l++)
                                                            {
                                                                Tablainfo tabinfo = Listainfok.Matrixpontinfok.Mezoinfok.Tablainfok[l];
                                                                int id = tabinfok.IndexOf(tabinfo);
                                                                SaveViewIndexek[id] = tabinfo.ViewSorindex;
                                                            }
                                                            elso = false;
                                                        }
                                                        if (!ures)
                                                        {
                                                            for (int k = 0; k < OszlopokSzama; k++)
                                                            {
 //                                                               elsotabinfo.DataView.RowFilter = "";
                                                                if (i > elsotabinfo.DataView.Count - 1)
                                                                    elsotabinfo.ViewSorindex = elsotabinfo.DataView.Count - 1;
                                                                else
                                                                    elsotabinfo.ViewSorindex = i;
                                                                ures = ElsoTabinfoOszlopVizsg(k);
                                                                if (!ures)
                                                                {
                                                                    ures = TobbiOszlopTabinfoSelect(k);
                                                                    if (!ures)
                                                                    {
                                                                        Listainfok.Matrixpontinfok.Osszegfeladasok(j, k);
                                                                        Listainfok.Matrixpontinfok.Osszegfeladasok(j, OszlopokSzama);
                                                                        Listainfok.Matrixpontinfok.Osszegfeladasok(SorokSzama, k);
                                                                        Listainfok.Matrixpontinfok.Osszegfeladasok(SorokSzama, OszlopokSzama);
                                                                    }
                                                                }
                                                            }
                                                            for (int k = 0; k < tabinfok.Count; k++)
                                                                tabinfok[k].ViewSorindex = SaveViewIndexek[k];
                                                        }
                                                    } while (!ures);
                                                }
                                            }
                                            for (int k = 0; k < tabinfok.Count; k++)
                                            {
                                                tabinfok[k].ViewSorindex = SaveViewIndexek[k];
                                                tabinfok[k].DataView.RowFilter = SaveFilterek[k];
                                            }
                                        }
                                        for (int k = 0; k < tabinfok.Count; k++)
                                        {
                                            tabinfok[k].ViewSorindex = SaveViewIndexek[k];
                                            tabinfok[k].DataView.RowFilter = SaveFilterek[k];
                                        }
                                        ures = true;
                                    }
                                } while (!ures);
                            }
                        }
                    } while (elsotabinfo.SetRowFilter());
                    datumtombcount++ ;
                } while (datumtombcount < Datumtomb.Count);

                    if (listae)
                        count = Listainfok.Oszlopinfok.Mezoinfok.Count - 1;
                    else
                        count = (Listainfok.Matrixpontinfok.OszlopokSzama + 1) * Listainfok.Matrixpontinfok.Mezoinfok.Count;

                    if (sorrendtabinfo != null)
                    {
                        int tol = Listainfok.Sorrendinfok.Mezoinfok.Count - 1;
                        if (listae && (Listainfok.Oszlopinfok.Osszegzendok.Count != 0 || Listainfok.Oszlopinfok.Atlagolandok.Count!=0 )|| !listae)
                        {
                            do
                            {
                                dr = dt.NewRow();
                                string s;
                                if (listae)
                                    s = Listainfok.Sorrendinfok.Mezoinfok[tol].ElozoSorrendTartalom;
                                else
                                    s = Listainfok.Matrixpontinfok.Sorrendszovegek[tol];
                                if (listae || tol != Listainfok.Sorrendinfok.Mezoinfok.Count - 1)
                                    s += " összesen:";
                                dr[0] = s;
                                dt.Rows.Add(dr);
                                if (listae)
                                    Listainfok.Oszlopinfok.OsszegsorOsszeallit(tol, dt);
                                else
                                    Listainfok.Matrixpontinfok.OsszegsorOsszeallit(tol, dt);

                                tol = tol - 1;
                                if (!listae)
                                {
                                    dr = dt.NewRow();
                                    for (int j = 0; j <= count; j++)
                                        dr[j] = "__________";
                                    dt.Rows.Add(dr);
                                }
                            } while (tol >= 0);
                        }
                        if (Listainfok.Oszlopinfok.Osszegzendok.Count != 0 || Listainfok.Oszlopinfok.Atlagolandok.Count!=0)
                        {
                            dr = dt.NewRow();
                            for (int j = 0; j <= count; j++)
                                dr[j] = "__________";
                            dt.Rows.Add(dr);
                            dr = dt.NewRow();
                            dr[0] = "Végösszesen:";
                            dt.Rows.Add(dr);
                            Listainfok.Oszlopinfok.OsszegsorOsszeallit(Listainfok.Sorrendinfok.Mezoinfok.Count, dt);
                        }
                    }
                    if (!listae)
                    {
                        if (sorrendtabinfo != null)
                        {
                            dr = dt.NewRow();
                            dr[0] = "Végösszesen:";
                            dt.Rows.Add(dr);
                        }
                        Listainfok.Matrixpontinfok.OsszegsorOsszeallit(Listainfok.Matrixpontinfok.SorrendmezokSzama, dt);
                    }
                //    datumtombcount++ ;
                //} while (datumtombcount < Datumtomb.Count);

                report.SetDataSource(dataset);
                string szov = "";
                report.SetParameterValue("cegnev", FakUserInterface.AktualCegnev);
                report.SetParameterValue("megnevezes", Tabinfo.Szoveg);
                report.SetParameterValue("feltetel", parfeltetel);
                if (parfeltetel != "")
                    szov = "Feltétel:";
                else
                    szov = "";
                report.SetParameterValue("feltszov", szov);
                if (paroszlopmeghatarozas != "")
                    szov = "Oszlopmeghatározások:";
                else
                    szov = "";
                report.SetParameterValue("oszlopmeghszov", szov);
                report.SetParameterValue("oszlopmeghatarozas", paroszlopmeghatarozas);
                if (parsormeghatarozas != "")
                    szov = "Sormeghatározások:";
                else
                    szov = "";
                report.SetParameterValue("sormeghszov", szov);
                report.SetParameterValue("sormeghatarozas", parsormeghatarozas);
                if (Datum2 == "")
                    report.SetParameterValue("datum", Datum1);
                else
                    report.SetParameterValue("datum", Datum1 + " - " + Datum2);
                if (listae)
                {
                    for (int i = 0; i < Listainfok.Oszlopinfok.Mezoinfok.Count; i++)
                    {
                        Mezoinfo info = Listainfok.Oszlopinfok.Mezoinfok[i];
                        if (!info.ColumnInfo.Comboe && info.ColumnInfo.Numeric(info.ColumnInfo.DataType))
                        {
                            report.Section2.ReportObjects[i].ObjectFormat.HorizontalAlignment = Alignment.RightAlign;
                            report.Section3.ReportObjects[i].ObjectFormat.HorizontalAlignment = Alignment.RightAlign;
                        }
                        else
                        {
                            report.Section2.ReportObjects[i].ObjectFormat.HorizontalAlignment = Alignment.LeftAlign;
                            report.Section3.ReportObjects[i].ObjectFormat.HorizontalAlignment = Alignment.LeftAlign;
                        }
                    }
                }
                crystalReportViewer1.ReportSource = report;
                crystalReportViewer1.Enabled = false;
                crystalReportViewer1.Enabled = true;
            }
            else
                tabControl1.SelectedIndex = 0;
        }
Exemplo n.º 39
0
 public bool IsOptionSet(PrintOptions option)
 {
     return (option & Options) == option;
 }
Exemplo n.º 40
0
 public BooPrinterVisitor(TextWriter writer, PrintOptions options)
     : this(writer)
 {
     this.Options = options;
 }
Exemplo n.º 41
0
 public static bool IsSet(PrintOptions value, PrintOptions flag)
 {
     return (value & flag) == flag;
 }
Exemplo n.º 42
0
        private static int TotalWidth; // Summation of Columns widths

        #endregion Fields

        #region Methods

        public static void Print_DataGridView(DataGridView dgv1, string title, bool Landscape, string subTitle)
        {
            PrintPreviewDialog ppvw;
            try
            {
                // Getting DataGridView object to print
                dgv = dgv1;
                dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
                // Getting all Coulmns Names in the DataGridView
                AvailableColumns.Clear();
                foreach (DataGridViewColumn c in dgv.Columns)
                {
                    if (!c.Visible) continue;
                    AvailableColumns.Add(c.HeaderText);
                }

                // Showing the PrintOption Form
                PrintOptions dlg = new PrintOptions(AvailableColumns);
                if (dlg.ShowDialog() != DialogResult.OK) return;

                PrintTitle = title;
                m_subtitle = subTitle;
                //PrintAllRows = dlg.PrintAllRows;
                //SelectedColumns = dlg.GetSelectedColumns();
                printDoc.PrinterSettings.PrinterName = dlg.printName;

                printDoc.DefaultPageSettings.Margins.Left = 40;
                printDoc.DefaultPageSettings.Margins.Right = 40;
                printDoc.DefaultPageSettings.Margins.Top = 40;
                printDoc.DefaultPageSettings.Margins.Bottom = 80;

                TotalWidth = 0;
                foreach (DataGridViewColumn GridCol in dgv.Columns)
                {
                    if (!GridCol.Visible) continue;
                    //if (!PrintDGV.SelectedColumns.Contains(GridCol.HeaderText)) continue;
                    TotalWidth += GridCol.Width;
                }
                if (TotalWidth >= printDoc.DefaultPageSettings.Bounds.Width)
                    printDoc.DefaultPageSettings.Landscape = true;
                else
                    printDoc.DefaultPageSettings.Landscape = false;

                RowsPerPage = 0;

                ppvw = new PrintPreviewDialog();
                ppvw.Document = printDoc;

                // Showing the Print Preview Page
                printDoc.BeginPrint +=new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint);
                printDoc.PrintPage +=new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage);
                //if (ppvw.ShowDialog() != DialogResult.OK)
                //{
                //    printDoc.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint);
                //    printDoc.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage);
                //    return;
                //}

                // Printing the Documnet
                printDoc.Print();
                printDoc.BeginPrint -= new System.Drawing.Printing.PrintEventHandler(PrintDoc_BeginPrint);
                printDoc.PrintPage -= new System.Drawing.Printing.PrintPageEventHandler(PrintDoc_PrintPage);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                BathClass.set_dgv_fit(dgv);
            }
        }
 public PrintContext(Item publishItem, PrintOptions settings)
 {
     this.StartItem = publishItem;
     this.Settings = settings;
 }
    /// <summary>
    /// Gets the qr image file path.
    /// </summary>
    /// <param name="contentItem">The content item.</param>
    /// <param name="printOptions">The print options.</param>
    /// <returns>
    /// The qr image file path.
    /// </returns>
    private string GetQrImageFilePath(Item contentItem, PrintOptions printOptions)
    {
      string fileName;

        fileName = contentItem["ExternalID"];

      return Path.Combine(printOptions.CacheFolder, fileName + ".png");
    }
 /// <summary>
 /// Initializes a new instance of the <see cref="PrintPipelineArgs"/> class.
 /// </summary>
 /// <param name="printItem">The print item.</param>
 /// <param name="printOptions">The print options.</param>
 public PrintPipelineArgs(Item printItem, PrintOptions printOptions)
 {
     this.ProcessorItem = (ProcessorItem)printItem;
     this.printOptions = printOptions;
 }
Exemplo n.º 46
0
 internal void ImportPrintOptions(PrintOptions po)
 {
     if (po.HorizontalCentered != null) this.PrintHorizontalCentered = po.HorizontalCentered.Value;
     if (po.VerticalCentered != null) this.PrintVerticalCentered = po.VerticalCentered.Value;
     if (po.Headings != null) this.PrintHeadings = po.Headings.Value;
     if (po.GridLines != null) this.PrintGridLines = po.GridLines.Value;
     if (po.GridLinesSet != null) this.PrintGridLinesSet = po.GridLinesSet.Value;
 }
Exemplo n.º 47
0
        internal PrintOptions ExportPrintOptions()
        {
            PrintOptions po = new PrintOptions();
            if (this.PrintHorizontalCentered) po.HorizontalCentered = true;
            if (this.PrintVerticalCentered) po.VerticalCentered = true;
            if (this.PrintHeadings) po.Headings = true;
            if (this.PrintGridLines) po.GridLines = true;
            if (!this.PrintGridLinesSet) po.GridLinesSet = false;

            return po;
        }
        /// <summary>
        /// Gets the print options.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="projectId">The project id.</param>
        /// <returns></returns>
        private static PrintOptions GetPrintOptions(string id, string projectId = null)
        {
            Assert.ArgumentNotNullOrEmpty(id, "id");
            if (string.IsNullOrEmpty(projectId))
            {
                projectId = defaultProjectId;
            }

            var item = DB.GetItem(id);
            var fileNameFormat = "{0}_{1}_{2}{3}";

            var parameters = new SafeDictionary<string, object> { { "ContentItem", id } };

            var printOptions = new PrintOptions
            {
                PrintExportType = PrintExportType.Pdf,
                UseHighRes = true,
                Parameters = parameters,
                ResultFolder = @"\\\\JCSHP10DEV14\\Public\\APSPublishing\\PublishFolder\\"
            };
            if (item != null)
            {
                printOptions.ResultFileName = String.Format(fileNameFormat, item.Name.Replace(" ", "_"), DB.GetItem(projectId).Name, DateTime.Now.Ticks, printOptions.ResultExtension);
            }
            return printOptions;
        } 
        /// <summary>
        /// Prints the pitch book.
        /// </summary>
        /// <param name="biographyIds">The biographyIds.</param>
        /// <param name="projectId">The project id.</param>
        /// <param name="username">The username.</param>
        /// <returns></returns>
        public static string PrintPitchBook(string projectId, string biographyIds = null, string articleIds = null, string serviceIds = null, string relatedContentIds = null, string username = null, string resultFileName = null, string publishingFolder = null)
        {
            if (string.IsNullOrEmpty(projectId))
            {
                projectId = defaultProjectId;
            }

            var db = Sitecore.Context.ContentDatabase ??
                     Sitecore.Context.Database;

            var manager = new Sitecore.PrintStudio.PublishingEngine.PrintManager(db, Sitecore.Context.Language);

            var parameters = new SafeDictionary<string, object>();

            if (!string.IsNullOrEmpty(biographyIds))
            {
                parameters.Add("BiographyIds", biographyIds);
            }

            if (!string.IsNullOrEmpty(username))
            {
                parameters.Add("Weil_Username", username);
            }

            if (!string.IsNullOrEmpty(articleIds))
            {
                parameters.Add("ArticleIds", articleIds);
            }

            if (!string.IsNullOrEmpty(serviceIds))
            {
                parameters.Add("ServiceIds", serviceIds);
            }

            if (!string.IsNullOrEmpty(relatedContentIds))
            {
                parameters.Add("relatedContentIds", relatedContentIds);
            }

            var printOptions = new PrintOptions
            {
                PrintExportType = PrintExportType.Pdf,
                UseHighRes = true,
                Parameters = parameters,
                ResultFolder = publishingFolder ?? PublisherFolder
            };
            if (string.IsNullOrEmpty(resultFileName))
            {
                printOptions.ResultFileName = String.Format(fileNameFormat, "PitchBook", db.GetItem(projectId).Name.Replace(" ", "_"), DateTime.Now.Ticks, printOptions.ResultExtension, username);
            }
            else
            {
                printOptions.ResultFileName = resultFileName;
            }
            return manager.Print(projectId, printOptions);
        }