public static bool CalculateReport(MetaFile meta, PrintOut printdriver, IWin32Window winowner) { CalcReportProgress nprogres = new CalcReportProgress(); nprogres.driver = printdriver; nprogres.meta = meta; nprogres.ErrorMessage = ""; nprogres.threadcalc = new Thread(new ThreadStart(nprogres.Start)); nprogres.threadcalc.Start(); if (nprogres.threadcalc.Join(4000)) { if (nprogres.ErrorMessage.Length > 0) { throw new Exception(nprogres.ErrorMessage); } return(meta.Finished); } // Else create form and show it ReportProgressForm ndia = new ReportProgressForm(); try { nprogres.ndia = ndia; ndia.multithread = true; ndia.metafile = meta; MetaFileWorkProgress workevent = new MetaFileWorkProgress(ndia.WorkProgress); meta.OnWorkProgress += workevent; try { ndia.ShowDialog(winowner); } finally { meta.OnWorkProgress -= workevent; } } finally { Monitor.Enter(nprogres.flag); try { nprogres.ndia = null; ndia.Dispose(); } finally { Monitor.Exit(nprogres.flag); } } if (!nprogres.threadcalc.Join(1000)) { nprogres.threadcalc.Abort(); } nprogres.threadcalc = null; if (nprogres.ErrorMessage.Length > 0) { throw new Exception(nprogres.ErrorMessage); } return(meta.Finished); }
override protected void DoPrint(PrintOut adriver, int aposx, int aposy, int newwidth, int newheight, MetaFile metafile, Point MaxExtent, ref bool PartialPrint) { base.DoPrint(adriver, aposx, aposy, newwidth, newheight, metafile, MaxExtent, ref PartialPrint); MetaObjectDraw metaobj = new MetaObjectDraw(); metaobj.MetaType = MetaObjectType.Draw; metaobj.Top = aposy; metaobj.Left = aposx; metaobj.Width = PrintWidth; metaobj.Height = PrintHeight; metaobj.DrawStyle = Shape; metaobj.BrushStyle = (int)BrushStyle; metaobj.PenStyle = (int)PenStyle; metaobj.PenWidth = PenWidth; metaobj.PenColor = PenColor; if (BrushColorExpression.Length > 0) { try { metaobj.BrushColor = Report.Evaluator.EvaluateText(BrushColorExpression); } catch { metaobj.BrushColor = BrushColor; } } else { metaobj.BrushColor = BrushColor; } metafile.Pages[metafile.CurrentPage].Objects.Add(metaobj); }
/// <summary> /// This procedure will return the current size of the printed item /// </summary> /// <param name="adriver">Report processing driver</param> /// <param name="MaxExtent">Maximum extension</param> /// <returns></returns> public virtual Point GetExtension(PrintOut adriver, Point MaxExtent, bool ForcePartial) { Point aresult = new Point(); aresult.X = Width; aresult.Y = Height; LastExtent = aresult; return(aresult); }
override public Point GetExtension(PrintOut adriver, Point MaxExtent, bool ForcePartial) { TextObjectStruct atext; atext = GetTextObject(); Point aresult = base.GetExtension(adriver, MaxExtent, ForcePartial); aresult = adriver.TextExtent(atext, aresult); LastExtent = aresult; return(aresult); }
override public Point GetExtension(PrintOut adriver, Point MaxExtent, bool ForcePartial) { Point aresult = base.GetExtension(adriver, MaxExtent, ForcePartial); if (Shape == ShapeType.HorzLine) { aresult.Y = PenWidth; } LastExtent = aresult; return(aresult); }
public static void CalculateReport(MetaFile meta, PrintOut driver) { using (ReportProgressForm nform = new ReportProgressForm()) { nform.intdriver = driver; nform.intmeta = meta; nform.timer1.Enabled = true; nform.ShowDialog(); } }
/// <summary> /// This procedure will print the item into the MetaFile /// </summary> /// <param name="adriver">Report processing driver</param> /// <param name="aposx">Horizontal position in twips</param> /// <param name="aposy">Vertical position in twips</param> /// <param name="newwidth">Width of the bounding box in twips</param> /// <param name="newheight">Height of the bounding box in twips</param> /// <param name="metafile">Destination MetaFile</param> /// <param name="MaxExtent">Maximum extension</param> /// <param name="PartialPrint">Returns true if some text will expand multiple pages</param> public void Print(PrintOut adriver, int aposx, int aposy, int newwidth, int newheight, MetaFile metafile, Point MaxExtent, ref bool PartialPrint) { if (!EvaluatePrintCondition()) { return; } ExecuteBeforePrint(); DoPrint(adriver, aposx, aposy, newwidth, newheight, metafile, MaxExtent, ref PartialPrint); ExecuteAfterPrint(); }
/// <summary> /// This procedure will return the current size of the printed item /// </summary> /// <param name="adriver">Report processing driver</param> /// <param name="MaxExtent">Maximum extension</param> /// <returns></returns> public override Point GetExtension(PrintOut adriver, Point MaxExtent, bool ForcePartial) { Point aresult = new Point(); if (Align != PrintItemAlign.LeftRight) { aresult.X = Width; } if (Align != PrintItemAlign.TopBottom) { aresult.Y = Height; } LastExtent = aresult; return(aresult); }
override protected void DoPrint(PrintOut adriver, int aposx, int aposy, int newwidth, int newheight, MetaFile metafile, Point MaxExtent, ref bool PartialPrint) { base.DoPrint(adriver, aposx, aposy, newwidth, newheight, metafile, MaxExtent, ref PartialPrint); MemoryStream FMStream = GetStream(); if (FMStream == null) { return; } if (FMStream.Length == 0) { return; } MetaObjectImage metaobj = new MetaObjectImage(); metaobj.MetaType = MetaObjectType.Image; metaobj.Top = aposy; metaobj.Left = aposx; metaobj.Width = PrintWidth; metaobj.Height = PrintHeight; metaobj.CopyMode = 20; metaobj.DrawImageStyle = DrawStyle; metaobj.DPIRes = dpires; metaobj.PreviewOnly = false; if (OldStreamPos >= 0) { metaobj.StreamPos = OldStreamPos; metaobj.SharedImage = true; } else { metaobj.StreamPos = metafile.Pages[metafile.CurrentPage].AddStream(FMStream, SharedImage != SharedImageType.None); if (SharedImage != SharedImageType.None) { OldStreamPos = metaobj.StreamPos; } metaobj.SharedImage = SharedImage != SharedImageType.None; } metaobj.StreamSize = FMStream.Length; metafile.Pages[metafile.CurrentPage].Objects.Add(metaobj); }
protected override void DoPrint(PrintOut adriver, int aposx, int aposy, int newwidth, int newheight, MetaFile metafile, Point MaxExtent, ref bool PartialPrint) { base.DoPrint(adriver, aposx, aposy, newwidth, newheight, metafile, MaxExtent, ref PartialPrint); FSeries.PrintWidth = PrintWidth; FSeries.PrintHeight = PrintHeight; if (FSeries.SeriesItems.Count == 0) { return; } if (Report.ChartingDriver != null) { Report.ChartingDriver.DrawChart(FSeries, metafile, aposx, aposy, this); } else { adriver.DrawChart(FSeries, metafile, aposx, aposy, this); } }
override public Point GetExtension(PrintOut adriver, Point MaxExtent, bool ForcePartial) { TextObjectStruct atext; atext = GetTextObject(); // Items printed only one time, have no extension if (PrintOnlyOne) { if (FOldString == atext.Text) { return(new Point(0, 0)); } } int aposition; bool IsPartial; IsPartial = false; Point aresult = base.GetExtension(adriver, MaxExtent, ForcePartial); if ((MultiPage) || ForcePartial) { MaxExtent.X = aresult.X; aposition = MetaFile.CalcTextExtent(adriver, MaxExtent, atext); if (aposition < atext.Text.Length) { IsPartial = true; } atext.Text = atext.Text.Substring(0, aposition); aresult = adriver.TextExtent(atext, aresult); if (IsPartial) { aresult.Y = MaxExtent.Y; } } else { aresult = adriver.TextExtent(atext, aresult); } LastExtent = aresult; return(aresult); }
static void Main(string[] args) { TestData testData = new TestData(); PrintOut printOut = new PrintOut(); Process process = new Process(); List <Inventory> InventoryList = testData.GetInventories(); List <Inventory> InventoryListUpdated = new List <Inventory>(); printOut.DisplayHeadings("Test data input:-"); printOut.DisplayList(InventoryList); printOut.DisplayHeadings("Test data output:- "); InventoryListUpdated = process.GetInventories(InventoryList); printOut.DisplayList(InventoryListUpdated); Console.ReadLine(); }
override protected void DoPrint(PrintOut adriver, int aposx, int aposy, int newwidth, int newheight, MetaFile metafile, Point MaxExtent, ref bool PartialPrint) { int aalign; base.DoPrint(adriver, aposx, aposy, newwidth, newheight, metafile, MaxExtent, ref PartialPrint); MetaPage apage = metafile.Pages[metafile.CurrentPage]; MetaObjectText metaobj = new MetaObjectText(); metaobj.TextP = apage.AddString(Text); metaobj.TextS = Text.Length; metaobj.LFontNameP = apage.AddString(LFontName); metaobj.LFontNameS = LFontName.Length; metaobj.WFontNameP = apage.AddString(WFontName); metaobj.WFontNameS = WFontName.Length; metaobj.FontSize = FontSize; metaobj.BackColor = BackColor; metaobj.FontRotation = FontRotation; metaobj.FontStyle = (short)FontStyle; metaobj.FontColor = FontColor; metaobj.Type1Font = Type1Font; metaobj.CutText = CutText; metaobj.Transparent = Transparent; metaobj.WordWrap = WordWrap; metaobj.Top = aposy; metaobj.Left = aposx; metaobj.Width = PrintWidth; metaobj.Height = PrintHeight; metaobj.RightToLeft = RightToLeft; metaobj.PrintStep = PrintStep; aalign = PrintAlignment | VPrintAlignment; if (SingleLine) { aalign = aalign | MetaFile.AlignmentFlags_SingleLine; } metaobj.Alignment = aalign; apage.Objects.Add(metaobj); }
/// <summary> /// This procedure will print the item into the MetaFile, internal implementation /// </summary> /// <param name="adriver">Report processing driver</param> /// <param name="aposx">Horizontal position in twips</param> /// <param name="aposy">Vertical position in twips</param> /// <param name="newwidth">Width of the bounding box in twips</param> /// <param name="newheight">Height of the bounding box in twips</param> /// <param name="metafile">Destination MetaFile</param> /// <param name="MaxExtent">Maximum extension</param> /// <param name="PartialPrint">Returns true if some text will expand multiple pages</param> protected virtual void DoPrint(PrintOut adriver, int aposx, int aposy, int newwidth, int newheight, MetaFile metafile, Point MaxExtent, ref bool PartialPrint) { if (newwidth >= 0) { PrintWidth = newwidth; } else { PrintWidth = Width; } if (newheight >= 0) { PrintHeight = newheight; } else { PrintHeight = Height; } PartialPrint = false; }
override public Point GetExtension(PrintOut adriver, Point MaxExtent, bool ForcePartial) { MemoryStream FMStream; Point aresult = base.GetExtension(adriver, MaxExtent, ForcePartial); if ((DrawStyle == ImageDrawStyleType.Crop) || (DrawStyle == ImageDrawStyleType.Tile) || (DrawStyle == ImageDrawStyleType.Tiledpi) || (DrawStyle == ImageDrawStyleType.Stretch)) { return(aresult); } ; FMStream = GetStream(); if (FMStream == null) { return(aresult); } aresult = adriver.GraphicExtent(FMStream, aresult, dpires); LastExtent = aresult; return(aresult); }
override protected void DoPrint(PrintOut adriver, int aposx, int aposy, int newwidth, int newheight, MetaFile metafile, Point MaxExtent, ref bool PartialPrint) { string data; base.DoPrint(adriver, aposx, aposy, newwidth, newheight, metafile, MaxExtent, ref PartialPrint); CurrentText = GetText(); try { if (BarType == BarcodeType.CodeQR) { #if PocketPC throw new Exception("QRCode not implemented in PocketPC"); #else QRCodeEncoder nenc = new QRCodeEncoder(); nenc.QRCodeForegroundColor = GraphicUtils.ColorFromInteger(BColor); nenc.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.ALPHA_NUMERIC; nenc.QRCodeVersion = System.Convert.ToInt32(Ratio); nenc.EncodeInMetafile(metafile, aposx, aposy, this.Modul, CurrentText, System.Text.Encoding.UTF8); #endif } else { data = CalculateBarcode(); // draw the barcode DoLines(data, aposx, aposy, metafile); } } catch (Exception E) { throw new ReportException(E.Message + ":" + Translator.TranslateStr(573), this, "Barcode"); } }
public void UseAbility() { PrintOut.ConsoleOut("Заморозка"); }
/// <summary> /// Prints the full section in a specific position of the page, the section will iterate the /// child components, printing each one /// </summary> /// <param name="adriver"></param> /// <param name="aposx"></param> /// <param name="aposy"></param> /// <param name="newwidth"></param> /// <param name="newheight"></param> /// <param name="metafile"></param> /// <param name="MaxExtent"></param> /// <param name="PartialPrint"></param> override protected void DoPrint(PrintOut adriver, int aposx, int aposy, int newwidth, int newheight, MetaFile metafile, Point MaxExtent, ref bool PartialPrint) { int i; PrintPosItem compo; int newposx, newposy; bool intPartialPrint; bool DoPartialPrint; MemoryStream astream; ExpressionItem compe = null; base.DoPrint(adriver, aposx, aposy, newwidth, newheight, metafile, MaxExtent, ref PartialPrint); // Draw the background if needed if (BackStyle != BackStyleType.Design) { astream = GetStream(); if (astream == null) { return; } if (astream.Length > 0) { MetaObjectImage obj = new MetaObjectImage(); obj.MetaType = MetaObjectType.Image; obj.Top = aposy; obj.Left = aposx; obj.Height = PrintHeight; obj.Width = PrintWidth; obj.DrawImageStyle = DrawStyle; obj.DPIRes = dpires; obj.PreviewOnly = BackStyle == BackStyleType.Preview; obj.DPIRes = dpires; if (OldStreamPos >= 0) { obj.StreamPos = OldStreamPos; obj.SharedImage = true; } else { obj.StreamPos = metafile.Pages[metafile.CurrentPage].AddStream(astream, SharedImage != SharedImageType.None); if (SharedImage != SharedImageType.None) { OldStreamPos = obj.StreamPos; } obj.SharedImage = SharedImage != SharedImageType.None; } obj.StreamSize = astream.Length; metafile.Pages[metafile.CurrentPage].Objects.Add(obj); } } DoPartialPrint = false; // Look for a partial print for (i = 0; i < Components.Count; i++) { compo = Components[i]; if (compo is ExpressionItem) { compe = (ExpressionItem)compo; if (compe.IsPartial) { DoPartialPrint = true; break; } } } PartialPrint = false; for (i = 0; i < Components.Count; i++) { compo = Components[i]; newwidth = -1; newheight = -1; // Component alignment switch (compo.Align) { case PrintItemAlign.None: newposx = aposx + compo.PosX; newposy = aposy + compo.PosY; break; case PrintItemAlign.Bottom: newposx = aposx + compo.PosX; newposy = aposy + LastExtent.Y - compo.LastExtent.Y; break; case PrintItemAlign.Right: newposx = aposx + LastExtent.X - compo.LastExtent.X; newposy = aposy + compo.PosY; break; case PrintItemAlign.BottomRight: newposx = aposx + compo.PosX; newposy = aposy + LastExtent.Y - compo.LastExtent.Y; break; case PrintItemAlign.LeftRight: newposx = aposx; newposy = aposy + compo.PosY; newwidth = LastExtent.X; break; case PrintItemAlign.TopBottom: newposx = aposx + compo.PosX; newposy = aposy + compo.PosY; newheight = LastExtent.Y; break; case PrintItemAlign.AllClient: newposx = aposx; newposy = aposy; newwidth = LastExtent.X; newheight = LastExtent.Y; break; default: newposx = aposx + compo.PosX; newposy = aposy + compo.PosY; break; } if (DoPartialPrint) { bool compoprinted = false; if (compo is ExpressionItem) { compe = (ExpressionItem)compo; if (compe.IsPartial) { intPartialPrint = false; compo.Print(adriver, newposx, newposy, newwidth, newheight, metafile, MaxExtent, ref intPartialPrint); if (intPartialPrint) { PartialPrint = true; } compoprinted = true; } } if ((!compoprinted) && compo.PartialFlag && (!PartialPrint)) { intPartialPrint = false; compo.PartialFlag = false; compo.Print(adriver, newposx, newposy, newwidth, newheight, metafile, MaxExtent, ref intPartialPrint); } if ((compe == null) && ((compo.Align == PrintItemAlign.TopBottom) || (compo.Align == PrintItemAlign.AllClient))) { bool dummypartial = false; compo.Print(adriver, newposx, newposy, newwidth, newheight, metafile, MaxExtent, ref dummypartial); } } else { compo.PartialFlag = false; // Evaluates print condition of each comonent if (compo.EvaluatePrintCondition()) { intPartialPrint = false; // For aligned to bottom elements, the partial print will // force to align bottom at the last section of the partial // print if (PartialPrint && ((compo.Align == PrintItemAlign.Bottom) || (compo.Align == PrintItemAlign.BottomRight))) { compo.PartialFlag = true; } else { compo.Print(adriver, newposx, newposy, newwidth, newheight, metafile, MaxExtent, ref intPartialPrint); } if (intPartialPrint) { PartialPrint = true; } if (compo is ExpressionItem) { compe = (ExpressionItem)compo; if (compe.IsGroupPageCount) { if (compe.LastMetaIndex > 0) { AddPageGroupCountItem(metafile.CurrentPage, compe.LastMetaIndex, compe.DisplayFormat); } } } } } } }
/// <summary> /// Used by report processing to determine the size of the section, depending on /// the output driver the size may vary /// </summary> /// <param name="adriver"></param> /// <param name="MaxExtent"></param> /// <param name="ForcePartial"></param> /// <returns></returns> public override Point GetExtension(PrintOut adriver, Point MaxExtent, bool ForcePartial) { int minsize, maxsize, currentsize; Point compsize; int newsize, i; Point newextent = new Point(Width, Height); PrintPosItem acompo; bool DoPartialPrint; ExpressionItem eitem; Point aresult = base.GetExtension(adriver, MaxExtent, ForcePartial); DoPartialPrint = false; // Look for a partial print for (i = 0; i < Components.Count; i++) { acompo = (PrintPosItem)Components[i]; if (acompo is ExpressionItem) { eitem = (ExpressionItem)acompo; if (eitem.IsPartial) { DoPartialPrint = true; break; } } } if (AutoContract) { minsize = 0; currentsize = 0; } else { minsize = aresult.Y; currentsize = aresult.Y; } if (AutoExpand) { maxsize = int.MaxValue; } else { maxsize = aresult.X; } if ((!AutoExpand) && (!AutoContract)) { aresult.Y = currentsize; LastExtent = aresult; for (i = 0; i < Components.Count; i++) { acompo = (PrintPosItem)Components[i]; if (acompo.Align != PrintItemAlign.None) { acompo.GetExtension(adriver, newextent, ForcePartial); } } return(aresult); } for (i = 0; i < Components.Count; i++) { acompo = (PrintPosItem)Components[i]; if (acompo.EvaluatePrintCondition()) { if (DoPartialPrint) { if (acompo is ExpressionItem) { eitem = (ExpressionItem)acompo; if (eitem.IsPartial) { newextent = MaxExtent; newextent.Y = newextent.Y - acompo.PosY; compsize = acompo.GetExtension(adriver, newextent, ForcePartial); if (compsize.Y > 0) { if ((acompo.Align == PrintItemAlign.Bottom) || (acompo.Align == PrintItemAlign.Right)) { newsize = compsize.Y; } else { newsize = acompo.PosY + compsize.Y; } if (newsize < maxsize) { if (newsize > currentsize) { currentsize = newsize; } } } } } } else { newextent = MaxExtent; newextent.Y = newextent.Y - acompo.PosY; compsize = acompo.GetExtension(adriver, newextent, ForcePartial); if (compsize.Y > 0) { if ((acompo.Align == PrintItemAlign.Bottom) || (acompo.Align == PrintItemAlign.Right)) { newsize = compsize.Y; } else { newsize = acompo.PosY + compsize.Y; } if (newsize < maxsize) { if (newsize > currentsize) { currentsize = newsize; } } } } } } if (currentsize < minsize) { currentsize = minsize; } aresult.Y = currentsize; LastExtent = aresult; return(aresult); }
public void Move() { PrintOut.ConsoleOut("Лететь"); }
public void UseAbility() { PrintOut.ConsoleOut("Бросать огненный шар"); }
public IActionResult IspisRasporeda3(PrintOut printRaspored) { List <Schedule> raspored = new List <Schedule>(printRaspored.IspisRasporeda()); return(View(raspored)); }
public void Move() { PrintOut.ConsoleOut("Идти"); }
public IActionResult IspisKolegija2(PrintOut print4) { List <Subjects> kolegiji2 = new List <Subjects>(print4.IspisKolegija2()); return(View(kolegiji2)); }
override public void BeginPrint(PrintOut driver) { base.BeginPrint(driver); if (FExecuting) { FExecuting = false; } EndPrint(); // Forward only apply to synchronous single pass report processing if (TwoPass || AsyncExecution) { MetaFile.ForwardOnly = false; } mmfirst = System.DateTime.Now; FDriver = driver; if (!FCompose) { MetaFile.Clear(); } MetaFile.Empty = false; try { MetaFile.PrinterFonts = PrinterFonts; UpdatePageSize = false; FillGlobalHeaders(); PendingSections.Clear(); ErrorProcessing = false; if (driver == null) { throw new UnNamedException("No Driver assigned"); } MetaFile.PrinterSelect = this.PrinterSelect; FDriver.SelectPrinter(PrinterSelect); if (FCompose) { MetaFile.ForwardOnly = false; InternalPageWidth = MetaFile.CustomX; InternalPageHeight = MetaFile.CustomY; PageNum = MetaFile.Pages.CurrentCount - 2; } else { Point apagesize; MetaFile.Empty = false; MetaFile.PrinterFonts = PrinterFonts; MetaFile.PreviewAbout = PreviewAbout; MetaFile.PreviewMargins = PreviewMargins; MetaFile.LinesPerInch = LinesPerInch; MetaFile.PaperSource = PaperSource; // Sets page orientation CurrentOrientation = PageOrientation; if (PageOrientation != OrientationType.Default) { FDriver.SetOrientation(PageOrientation); } PageDetail.PaperSource = PaperSource; PageDetail.Duplex = Duplex; PageDetail.ForcePaperName = ForcePaperName; if (PageSize != PageSizeType.Default) { if (PageSize == PageSizeType.User) { MetaFile.PageSizeIndex = -1; PageDetail.Index = PageSizeIndex; PageDetail.Custom = true; PageDetail.CustomHeight = CustomPageHeight; PageDetail.CustomWidth = CustomPageWidth; } else { MetaFile.PageSizeIndex = PageSizeIndex; PageDetail.Index = PageSizeIndex; PageDetail.Custom = false; PageDetail.CustomWidth = CustomPageWidth; PageDetail.CustomHeight = CustomPageHeight; } apagesize = FDriver.SetPageSize(PageDetail); } else { int newpagesize = MetaFile.PageSizeIndex; apagesize = FDriver.GetPageSize(out newpagesize); MetaFile.PageSizeIndex = newpagesize; } InternalPageWidth = apagesize.X; InternalPageHeight = apagesize.Y; MetaFile.Orientation = PageOrientation; MetaFile.BackColor = PageBackColor; MetaFile.CustomX = InternalPageWidth; MetaFile.CustomY = InternalPageHeight; PageNum = -1; } MetaFile.PrinterSelect = PrinterSelect; MetaFile.AutoScale = AutoScale; MetaFile.PreviewWindow = PreviewWindow; MetaFile.OpenDrawerAfter = ActionAfter; MetaFile.OpenDrawerBefore = ActionBefore; int i; for (i = 0; i < SubReports.Count; i++) { SubReports[i].LastRecord = false; } LastPage = false; InitEvaluator(); PageNumGroup = -1; FRecordCount = 0; InitializeParams(); FDataAlias.List.Clear(); for (i = 0; i < DataInfo.Count; i++) { AliasCollectionItem aitem = new AliasCollectionItem(); aitem.Alias = DataInfo[i].Alias; aitem.Data = DataInfo[i].Data; FDataAlias.List.Add(aitem); } try { ActivateDatasets(); } catch { DeActivateDatasets(); throw; } CheckIfDataAvailable(); Evaluator.AliasList = FDataAlias; PrepareParamsAfterOpen(); for (i = 0; i < SubReports.Count; i++) { SubReports[i].SubReportChanged(SubReportEvent.Start, ""); } CurrentSubReportIndex = -1; SubReport subrep; bool dataavail = false; do { CurrentSubReportIndex++; if (CurrentSubReportIndex >= SubReports.Count) { break; } subrep = SubReports[CurrentSubReportIndex]; if (subrep.ParentSubReport == null) { if (subrep.Alias.Length == 0) { dataavail = true; } else { if (subrep.PrintOnlyIfDataAvailable) { int index = DataInfo.IndexOf(subrep.Alias); if (!DataInfo[index].Data.Eof) { dataavail = true; } } else { dataavail = true; } } } if (dataavail) { subrep.SubReportChanged(SubReportEvent.SubReportStart, ""); subrep.SubReportChanged(SubReportEvent.DataChange, ""); CurrentSectionIndex = -1; subrep.CurrentGroupIndex = -subrep.GroupCount; if (subrep.CurrentGroupIndex < 0) { CurrentSectionIndex = subrep.FirstDetail + subrep.CurrentGroupIndex - 1; } section = null; subreport = null; if (!NextSection(true)) { dataavail = false; } } } while (!dataavail); if (!dataavail) { EndPrint(); AbortingThread = true; MetaFile.Empty = true; throw new NoDataToPrintException(Translator.TranslateStr(799)); } printing = true; } catch { MetaFile.Empty = true; throw; } }
public void printOut(string[] args) { PrintOut printer = new PrintOut(); printer.LandScape = false; printer.IsPreview = true; int year = int.Parse(args[2]); int month = int.Parse(args[3]); int day = int.Parse(args[4]); string name = args[0] + " " + args[1]; int x_center = 105; int y = 5; int julius = calcjulius(year, month, day); int number = calcshihai(year, julius); string openfilename = "./text/"; string openimgname = "./img/"; string[] openfilelist = { "suisei.txt", "hyouousei.txt", "mokusei.txt", "kaiousei.txt", "getsusei.txt", "gyoousei.txt", "kasei.txt", "meiousei.txt", "kinsei.txt", "shouousei.txt","dosei.txt", "tenousei.txt" }; string[] openimglist = { "kettei.png", "seicho.png", "kaitaku.png", "seisan.png", "0chiten.png", "haishin.png", "jujitsu.png", "keizai.png", "saikai.png", "uwaki.png", "ninki.png", "kenko.png" }; string[] openimglist2 = { "1.jpg", "0.jpg", "11.jpg", "10.jpg", "9.jpg", "8.jpg", "7.jpg", "6.jpg", "5.jpg", "4.jpg","3.jpg", "2.jpg" }; string[] shihai = { "水星", "氷王星", "木星", "海王星", "月星", "魚王星", "火星", "冥王星", "金星", "小王星", "土星", "天王星" }; printer.evPrint += delegate(object sender, PrintOutEventArgs e) { Print print = e.print; print.SetFont("MS ゴシック", 25); print.DrawImageResize(new Bitmap(openimgname + "title.png"), 65, 0, 80, 25); print.DrawImageResize(new Bitmap(openimgname + "shihai/" + openimglist2[number]), 165, -3, 40, 40); print.SetFont("MS ゴシック", 18); print.DrawStringCentering(name + "さんの支配星は、" + shihai[number] + "です", x_center, y + 20); print.DrawLine(0, y + 30, 220, y + 30); print.SetFont("MS ゴシック", 13); System.IO.StreamReader sr = new System.IO.StreamReader( openfilename + "feature/" + openfilelist[number], System.Text.Encoding.GetEncoding("utf-8")); int i = 0; while (sr.Peek() > -1) { print.DrawStringCentering(sr.ReadLine(), x_center, y + 33 + i * 6); i++; } sr.Close(); print.DrawLine(0, y + 107, 220, y + 107); print.SetFont("MS ゴシック", 18); print.DrawStringCentering(name + "さんの運命グラフ", x_center, y + 110); print.DrawImageResize(new Bitmap(openimgname + "graph/" + openimglist[number]), 45, y + 120, 120, 75); print.SetFont("MS ゴシック", 13); System.IO.StreamReader sr2 = new System.IO.StreamReader( openfilename + "nextyear/" + openfilelist[number], System.Text.Encoding.GetEncoding("utf-8")); int j = 0; while (sr2.Peek() > -1) { print.DrawStringCentering(sr2.ReadLine(), x_center, y + 196 + j * 6); j++; } sr2.Close(); }; printer.PrintPage(); }
public IActionResult IspisKolegija(PrintOut print3) { List <Classes> kolegiji = new List <Classes>(print3.IspisKolegija()); return(View(kolegiji)); }
public IActionResult IspisUcionica(PrintOut print5) { List <Classrooms> ucionice = new List <Classrooms>(print5.IspisUcionica()); return(View(ucionice)); }
private static void Main(string[] args) { /************************************************************** * Create instance of WebshopAPI **************************************************************/ WebShopApi api = new WebShopApi(); /************************************************************** * Create mockdata if not already created **************************************************************/ Seeder.Seed(); // Users created /* User Password Active Admin * Administrator CodicRulez YES YES * TestCustomer Codic2021 YES NO * InactiveCustomer Codic2021 NO NO */ /************************************************************** * Register specified user **************************************************************/ PrintOut.Red("Register()"); //wrong verification password Console.WriteLine($"registration successful: " + $"{api.Register("Benny", "password", "pasword")}"); //Tries to register a user that already exists Console.WriteLine($"registration successful: " + $"{api.Register("Administrator", "password", "password")}"); //Registers a non existing user (at first run at least) Console.WriteLine($"registration successful: " + $"{api.Register("Benny", "password", "password")}"); /************************************************************** * Log in the specified user **************************************************************/ User loggedInUser = null; PrintOut.Red("LogIn()"); //loggedInUser.IdId = api.Login("Benny", "Password"); loggedInUser = api.Login("Administrator", "CodicRulez"); ///loggedInUser.IdId = api.Login("TestCustomer", "Codic2021"); //loggedInUser.IdId = api.Login("InactiveCustomer", "Codic2021"); //loggedInUser.IdId = api.Login("", ""); //loggedInUser.IdId = api.Login("WrongCredetials", "SoSoWrong"); if (loggedInUser.Id > 0) { Console.WriteLine($"User with id {loggedInUser.Id} is logged in"); } else { Console.WriteLine("Not logged in, inactive user or wrong credentials."); } /************************************************************** * Promote() **************************************************************/ PrintOut.Red("Promote() - Admin Function"); Console.WriteLine("Promoting Benny to Admin"); var listOfUsers = api.FindUser(loggedInUser.Id, "Benny"); var success = false; if (listOfUsers.Count != 0) { success = api.Promote( loggedInUser.Id, listOfUsers[0].Id); Console.WriteLine($"successful: {success}"); } else { Console.WriteLine("Either you don´t have admin priviliges " + "or there are no such user in the database."); } Console.ReadKey(); /************************************************************** * Demote() **************************************************************/ PrintOut.Red("Demote() - Admin Function"); Console.WriteLine("Demoting Benny to User"); listOfUsers.Clear(); listOfUsers = api.FindUser(loggedInUser.Id, "Benny"); if (listOfUsers.Count != 0) { success = api.Demote( loggedInUser.Id, listOfUsers[0].Id); Console.WriteLine($"successful: {success}"); } else { Console.WriteLine("Either you don´t have admin priviliges " + "or there are no such user in the database."); } Console.ReadKey(); /************************************************************** * ActivateUser() **************************************************************/ PrintOut.Red("ActivateUser() - Admin Function"); Console.WriteLine("Activating \"InactiveCustomer\""); listOfUsers.Clear(); listOfUsers = api.FindUser(loggedInUser.Id, "InactiveCustomer"); if (listOfUsers.Count != 0) { success = api.ActivateUser( loggedInUser.Id, listOfUsers[0].Id); Console.WriteLine($"successful: {success}"); } else { Console.WriteLine("Either you don´t have admin priviliges " + "or there are no such user in the database."); } Console.ReadKey(); /************************************************************** * InactivateUser() **************************************************************/ PrintOut.Red("InactivateUser() - Admin Function"); Console.WriteLine("Inactivating \"InactiveCustomer\""); listOfUsers.Clear(); listOfUsers = api.FindUser(loggedInUser.Id, "InactiveCustomer"); if (listOfUsers.Count != 0) { success = api.InactivateUser( loggedInUser.Id, listOfUsers[0].Id); Console.WriteLine($"successful: {success}"); } else { Console.WriteLine("Either you don´t have admin priviliges " + "or there are no such user in the database."); } Console.ReadKey(); /************************************************************** * AddUser() **************************************************************/ PrintOut.Red("AddUser() - Admin Function"); Console.WriteLine("Adding user \"Nisse\" to database"); bool successful = api.AddUser(loggedInUser.Id, "Nisse", "MittLösenord"); Console.WriteLine($"Was add successful? {successful}"); if (!successful) { Console.WriteLine("Probably due to wrong user priviliges or duplicate of user"); } /************************************************************** * ListUsers() **************************************************************/ PrintOut.Red("ListUsers()"); Console.WriteLine("Users in database:"); foreach (var item in api.ListUsers(loggedInUser.Id)) { Console.WriteLine($"\t{item.Name}"); } if (loggedInUser.Id == 0) { Console.WriteLine("You are not logged in or has no priviliges to see users"); } PrintOut.DarkRed("Press enter()"); Console.ReadKey(); /************************************************************** * FindUsers() **************************************************************/ PrintOut.Red("FindUsers()"); Console.WriteLine("Users in database matching the keyword sto:"); foreach (var item in api.FindUser(loggedInUser.Id, "sto")) { Console.WriteLine($"\t{item.Name}"); } if (loggedInUser.Id == 0) { Console.WriteLine("You are not logged in or has no priviliges to see users"); } PrintOut.DarkRed("Press enter()"); Console.ReadKey(); /************************************************************** * GetCategories(keyword) **************************************************************/ PrintOut.Red("Get categories(keyword) - THIS IS NOT USED IN THE STEP WHERE YOU CAN CHOOSE CATEGORY."); var categories = api.GetCategories("Hu"); Console.WriteLine("Listing Categories with searchkeyword Hu:"); for (int i = 0; i < categories.Count; i++) { Console.WriteLine($"\t{i + 1}. {categories[i].Name}"); } PrintOut.DarkRed("Press enter()"); Console.ReadKey(); /************************************************************** * GetCategory() **************************************************************/ PrintOut.Red("Get category() - THIS IS NOT USED IN THE STEP WHERE YOU CAN CHOOSE CATEGORY."); if (categories.Count > 0) { var booksInCategory = api.GetBooksInCategory(categories[0].Id); Console.WriteLine("Listing books in category Humor:"); for (int i = 0; i < booksInCategory.Count; i++) { Console.WriteLine($"\t{i + 1}. {booksInCategory[i].Title}"); } } else { Console.WriteLine("Ingen träff"); } PrintOut.DarkRed("Press enter()"); Console.ReadKey(); /************************************************************** * AddBook() **************************************************************/ PrintOut.Red("AddBook()"); var amount = 1; var title = "I cirkelns utkant"; var author = "Dan Brown"; var price = 199; Console.WriteLine($"Adding {title} by {author} with amount {amount} and the price {price}."); Console.WriteLine($"Was it successful? " + $"{api.AddBook(loggedInUser.Id, amount, title, author, price)}"); PrintOut.DarkRed("Press enter()"); Console.ReadKey(); /************************************************************** * UpdateBook() **************************************************************/ PrintOut.Red("UpdateBook()"); title = "I cirkelns mitt"; author = "Dan Brown"; price = 199; var books = api.GetBooks("I cirkelns utkant"); try { Console.WriteLine($"Updating book with {title} by {author} and the price {price}."); Console.WriteLine($"Was it successful? " + $"{api.UpdateBook(loggedInUser.Id, books[0].Id, title, author, price)}"); books.Clear(); } catch { Console.WriteLine("Either you don´t have admin priviliges " + "or there are no such book in the database."); } PrintOut.DarkRed("Press enter()"); Console.ReadKey(); /************************************************************** * AddCategory() **************************************************************/ PrintOut.Red("AddCategory()"); Console.WriteLine("Adding \"Thrillers\" to the categories"); Console.WriteLine($"Was it successful? " + $"{api.AddCategory(loggedInUser.Id, "Thrillers")}"); /************************************************************** * UpdateCategory() **************************************************************/ PrintOut.Red("UpdateCategory()"); Console.WriteLine("Updating \"Thrillers\" to \"Thriller\""); var updateThisCategory = api.GetCategories("Thrillers"); try { successful = api.UpdateCategory(loggedInUser.Id, updateThisCategory[0].Id, "Thriller"); Console.WriteLine($"Was it successful? {successful}"); if (!successful) { Console.WriteLine("Probably due to wrong admin priviliges " + "or category already existing"); } } catch { Console.WriteLine("No such category or you don´t have the right priviliges"); } /************************************************************** * AddBookToCategory() **************************************************************/ PrintOut.Red("AddBookToCategory()"); Console.WriteLine("Adding {title} to \"Thriller\" category"); books = api.GetBooks("I cirkelns mitt"); try { var listOfCategories = api.GetCategories("Thriller"); Console.WriteLine($"Was it successful? " + $"{api.AddBookToCategory(loggedInUser.Id, books[0].Id, listOfCategories[0].Id)}"); books.Clear(); } catch { Console.WriteLine("No such category or you don´t have the right priviliges"); } /************************************************************** * GetBooksByAuthor() **************************************************************/ PrintOut.Red("GetBooksByAuthor() - THIS IS NOT USED IN THE NEXT STEP WHERE YOU CAN CHOOSE CATEGORY."); var booksByAuthor = api.GetBooksByAuthor("Stephen"); Console.WriteLine("Listing books by authors with keyword \"Stephen\":"); for (int i = 0; i < booksByAuthor.Count; i++) { Console.WriteLine($"\t{i + 1}. {booksByAuthor[i].Title}"); } PrintOut.DarkRed("Press enter()"); Console.ReadKey(); /************************************************************** * GetCategories() **************************************************************/ PrintOut.Red("Get categories()"); categories = api.GetCategories(); Console.WriteLine("Categories:"); for (int i = 0; i < categories.Count; i++) { Console.WriteLine($"\t{i + 1}. {categories[i].Name}"); } int userChoice = LoopThruTheMenu(categories); /************************************************************** * GetAvailibleBooks() **************************************************************/ //PrintOut.Red("GetAvailibleBooks()"); //books = api.GetAvailibleBooks(categories[userChoice - 1].Id); //for (int i = 0; i < books.Count; i++) //{ // Console.WriteLine($"\t{i + 1}. {books[i].Title}"); //} //userChoice = LoopThruTheMenu(books); /************************************************************** * Get book from keyword() **************************************************************/ PrintOut.Red("GetBooks(keyword)"); var listOfBooks = api.GetBooks(books[userChoice - 1].Title); Console.WriteLine($"I've retrieved the books for you. confirm your choice:"); for (int i = 0; i < listOfBooks.Count; i++) { Console.WriteLine($"\t{i + 1}. {listOfBooks[i].Title}"); } userChoice = LoopThruTheMenu(listOfBooks); /************************************************************** * GetBook() **************************************************************/ PrintOut.Red("GetBook()"); var book = api.GetBook(listOfBooks[userChoice - 1].Id); Console.WriteLine($"I got the book for you!"); Console.WriteLine($"{book.Title} written by {book.Author}\n" + $"Has the price {book.Price}\n" + $"Availible quantity: {book.Amount}"); PrintOut.DarkRed("Press enter()"); Console.ReadKey(); /************************************************************** * Buy book() **************************************************************/ PrintOut.Red("BuyBook()"); Console.WriteLine($"Was it successful? " + $"{api.BuyBook(loggedInUser.Id, listOfBooks[userChoice - 1].Id)}"); PrintOut.DarkRed("Press enter()"); Console.ReadKey(); /************************************************************** * Sold items() **************************************************************/ PrintOut.Red($"SoldItems()"); var list = api.SoldItems(loggedInUser.Id); foreach (var item in list) { Console.WriteLine($"{item.Title} from author {item.Author} " + $"was bought {item.PurchaseDate.ToShortDateString()} " + $"by user with userID {item.UserId} "); } if (list.Count == 0) { Console.WriteLine("No access to see sold books or there are no sold books in database."); } PrintOut.DarkRed("Press enter()"); Console.ReadKey(); /************************************************************** * Ping() **************************************************************/ PrintOut.Red($"Ping()"); Console.WriteLine(api.Ping(loggedInUser.Id)); PrintOut.DarkRed("Check database for session renewal then press enter()"); Console.ReadKey(); /************************************************************** * SetAmount() **************************************************************/ PrintOut.Red($"SetAmount()"); Console.WriteLine("Adding 10 books to database (the book you bought)"); Console.WriteLine($"Successful change: { api.SetAmount(loggedInUser.Id, listOfBooks[userChoice - 1].Id, 10)}"); book = api.GetBook(listOfBooks[userChoice - 1].Id); Console.WriteLine($"Here is the new status of the book!"); Console.WriteLine($"{book.Title} Availible quantity: {book.Amount}"); PrintOut.DarkRed("Press enter"); Console.ReadKey(); Console.WriteLine("Reducing number of books with 4 to database (the book you bought)"); Console.WriteLine($"Successful change: { api.SetAmount(loggedInUser.Id, listOfBooks[userChoice - 1].Id, -4)}"); book = api.GetBook(listOfBooks[userChoice - 1].Id); Console.WriteLine($"Here is the new status of the book!"); Console.WriteLine($"{book.Title} Availible quantity: {book.Amount}"); PrintOut.DarkRed("Press enter"); Console.ReadKey(); /************************************************************** * DeleteBook() **************************************************************/ PrintOut.Red($"DeleteBook()"); Console.WriteLine("Deleting 6 books from database (the book you bought)"); Console.WriteLine($"Successful change: { api.DeleteBook(loggedInUser.Id, listOfBooks[userChoice - 1].Id, 6)}"); Console.ReadKey(); /************************************************************** * DeleteCategory() **************************************************************/ PrintOut.Red($"DeleteCategory()"); Console.WriteLine("Deleting category from database (Thriller)"); Console.WriteLine($"Successful change: { api.DeleteCategory(loggedInUser.Id, 5)}"); Console.ReadKey(); /************************************************************** * MoneyEarned() **************************************************************/ PrintOut.Red("MoneyEarned()"); Console.WriteLine($"Money earned: {api.MoneyEarned(loggedInUser.Id)}"); /************************************************************** * BestCustomer() **************************************************************/ PrintOut.Red("BestCustomer()"); var bestCustomer = api.BestCustomer(loggedInUser.Id); if (bestCustomer != (null, 0)) { Console.WriteLine($"Best Customer: {bestCustomer.Item1.Name} has bought {bestCustomer.Item2} books"); }
public IActionResult IspisProfesora(PrintOut print2) { List <Teachers> profesori = new List <Teachers>(print2.IspisProfesora()); return(View(profesori)); }