private void BtnPrint_Click(object sender, EventArgs e) { Btn btn = (Btn)sender; Order order = btn.Order; string path = $@"{Util.CURRENT_PATH}\Order_{order.Id}.pdf"; if (Util.ExistFile(path)) { System.Diagnostics.Process.Start(path); } else { order = DataDB.GetOrderById(order.Id); PDFUtil.CreateAssignedOrderreport(order); } }
private void SetItemList() { int index = 0; foreach (Order order in shownOrdersList) { string orderId = order.Id.ToString(); FlowLayoutPanel flowItem = new FlowLayoutPanel { FlowDirection = FlowDirection.LeftToRight }; Btn btnPrint = new Btn { Width = 50, Height = 35, Order = order, Text = "Print", Index = index }; btnPrint.Click += BtnPrint_Click; Label info = new Label { Text = $"{PDFUtil.GetProyectName(order.ExcelPath)}", Width = Panel.Width - 100, Height = 40, Font = new System.Drawing.Font("Arial Narrow", 12, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))) }; flowItem.Height = 40; flowItem.Width = Panel.Width; flowItem.Name = orderId; flowItem.Controls.Add(info); flowItem.Controls.Add(btnPrint); Panel.Controls.Add(flowItem); index++; } }