protected override void Archive() { base.Archive(); DB.SYS_Printer entity = (DB.SYS_Printer)BindingSource.DataSource; entity.Archived = !entity.Archived; btnArchive.Caption = entity.Archived ? "Un-Archive" : "Archive"; try { using (TransactionScope transaction = DataContext.GetTransactionScope()) { DataContext.SaveChangesEntitySystemContext(); DataContext.CompleteTransaction(transaction); } DataContext.EntitySystemContext.AcceptAllChanges(); } catch (Exception ex) { DataContext.EntitySystemContext.RejectChanges(); HasErrors = true; if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex)) { throw ex; } } }
public CompanySite() { Site = ApplicationDataContext.Instance.SystemEntityContext.SYS_Site.Include("SYS_Entity").FirstOrDefault(n => n.SYS_Entity.Id == ApplicationDataContext.Instance.LoggedInUser.DefaultSiteId); Entity = Site.SYS_Entity; billingAddress = Site.SYS_Address_BillingAddress; //dataContext.EntitySystemContext.SYS_Address.FirstOrDefault(n => n.Id == Site.BillingAddress); shippingAddress = Site.SYS_Address_ShippingAddress; //dataContext.EntitySystemContext.SYS_Address.FirstOrDefault(n => n.Id == Site.ShippingAddress); printerBarcode = Site.SYS_Printer_Barcode; //dataContext.EntitySystemContext.SYS_Printer.FirstOrDefault(n => n.Id == Site.PrinterBarcode); printerPicker = Site.SYS_Printer_Picker; //dataContext.EntitySystemContext.SYS_Printer.FirstOrDefault(n => n.Id == Site.PrinterPicker); printerReceipt = Site.SYS_Printer_Receipt; //dataContext.EntitySystemContext.SYS_Printer.FirstOrDefault(n => n.Id == Site.PrinterReceipt); }
internal static String Save(DB.SYS_Printer entry, DataContext dataContext) { try { if (dataContext.EntitySystemContext.GetEntityState(entry) == System.Data.Entity.EntityState.Detached) { dataContext.EntitySystemContext.SYS_Printer.Add(entry); } } catch (System.Data.Entity.Validation.DbEntityValidationException ex) { return(dataContext.PackageValidationException()); } return("Success"); }
private void RegisterPrintJob(long documentId, long printerId) { try { using (TransactionScope transaction = DataContext.GetTransactionScope()) { DB.SYS_Printer printer = BL.SYS.SYS_Printer.Load(printerId, DataContext); DB.SYS_DOC_Header document = BL.SYS.SYS_DOC_Header.Load(documentId, DataContext); switch (printer.PrinterType) { case "DOTMATRIX": switch (document.TypeId) { case (byte)BL.SYS.SYS_DOC_Type.Quote: case (byte)BL.SYS.SYS_DOC_Type.CreditNote: case (byte)BL.SYS.SYS_DOC_Type.BackOrder: DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, SalesPrintTemplate.OuterXml, documentId, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); break; case (byte)BL.SYS.SYS_DOC_Type.SalesOrder: if (BL.SYS.SYS_DOC_Header.LoadByTrackId(document.TrackId, BL.SYS.SYS_DOC_Type.TAXInvoice, DataContext) != null) { document = BL.SYS.SYS_DOC_Header.LoadByTrackId(document.TrackId, BL.SYS.SYS_DOC_Type.TAXInvoice, DataContext); DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, SalesPrintTemplate.OuterXml, document.Id, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); } break; case (byte)BL.SYS.SYS_DOC_Type.TAXInvoice: DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, SalesPrintTemplate.OuterXml, documentId, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); break; case (byte)BL.SYS.SYS_DOC_Type.PickingSlip: DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, PickingSlipSalesPrintTemplate.OuterXml, documentId, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); break; case (byte)BL.SYS.SYS_DOC_Type.PurchaseOrder: case (byte)BL.SYS.SYS_DOC_Type.GoodsReceived: case (byte)BL.SYS.SYS_DOC_Type.GoodsReturned: DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, PurchaseSalesPrintTemplate.OuterXml, documentId, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); break; case (byte)BL.SYS.SYS_DOC_Type.TransferRequest: case (byte)BL.SYS.SYS_DOC_Type.TransferShipment: case (byte)BL.SYS.SYS_DOC_Type.TransferReceived: case (byte)BL.SYS.SYS_DOC_Type.InventoryAdjustment: DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, AdjustmentSalesPrintTemplate.OuterXml, documentId, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); break; case (byte)BL.SYS.SYS_DOC_Type.Job: case (byte)BL.SYS.SYS_DOC_Type.BOMAssemblyStarted: case (byte)BL.SYS.SYS_DOC_Type.BOMDisassemblyStarted: case (byte)BL.SYS.SYS_DOC_Type.BOMCanceled: case (byte)BL.SYS.SYS_DOC_Type.BOMComplete: DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, WorkSalesPrintTemplate.OuterXml, documentId, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); break; } break; case "INKJET": PrintReportDocument(printer.Location, document.Title, document.TypeId.Value, documentId); break; case "RECEIPT": switch (document.TypeId) { case (byte)BL.SYS.SYS_DOC_Type.Quote: case (byte)BL.SYS.SYS_DOC_Type.CreditNote: case (byte)BL.SYS.SYS_DOC_Type.BackOrder: DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, ReceiptSalesPrintTemplate.OuterXml, documentId, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); break; case (byte)BL.SYS.SYS_DOC_Type.SalesOrder: if (BL.SYS.SYS_DOC_Header.LoadByTrackId(document.TrackId, BL.SYS.SYS_DOC_Type.TAXInvoice, DataContext) != null) { document = BL.SYS.SYS_DOC_Header.LoadByTrackId(document.TrackId, BL.SYS.SYS_DOC_Type.TAXInvoice, DataContext); if (printer.PrinterType == "RECEIPT") { DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, ReceiptSalesPrintTemplate.OuterXml, document.Id, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); } } break; case (byte)BL.SYS.SYS_DOC_Type.TAXInvoice: DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, ReceiptSalesPrintTemplate.OuterXml, documentId, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); break; case (byte)BL.SYS.SYS_DOC_Type.PickingSlip: DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, ReceiptSalesPrintTemplate.OuterXml, documentId, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); break; case (byte)BL.SYS.SYS_DOC_Type.PurchaseOrder: case (byte)BL.SYS.SYS_DOC_Type.GoodsReceived: case (byte)BL.SYS.SYS_DOC_Type.GoodsReturned: DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, ReceiptSalesPrintTemplate.OuterXml, documentId, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); break; case (byte)BL.SYS.SYS_DOC_Type.TransferRequest: case (byte)BL.SYS.SYS_DOC_Type.TransferShipment: case (byte)BL.SYS.SYS_DOC_Type.TransferReceived: case (byte)BL.SYS.SYS_DOC_Type.InventoryAdjustment: DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, ReceiptSalesPrintTemplate.OuterXml, documentId, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); break; case (byte)BL.SYS.SYS_DOC_Type.Job: case (byte)BL.SYS.SYS_DOC_Type.BOMAssemblyStarted: case (byte)BL.SYS.SYS_DOC_Type.BOMDisassemblyStarted: case (byte)BL.SYS.SYS_DOC_Type.BOMCanceled: case (byte)BL.SYS.SYS_DOC_Type.BOMComplete: DocumentPrinter.Instance.PrintDocument(printer.Location, printer.PrinterModel, ReceiptSalesPrintTemplate.OuterXml, documentId, ConfigurationManager.ConnectionStrings["BaseConnection"].ConnectionString); break; } break; } BL.ORG.ORG_TRX_Header.SetDateFirstPrinted(document.Id, BL.ApplicationDataContext.Instance.LoggedInUser.PersonId, DataContext); BL.ORG.ORG_TRX_Header.SetDateLastPrinted(document.Id, BL.ApplicationDataContext.Instance.LoggedInUser.PersonId, DataContext); DataContext.EntityOrganisationContext.SaveChanges(); DataContext.CompleteTransaction(transaction); } DataContext.EntityOrganisationContext.AcceptAllChanges(); } catch (Exception ex) { DataContext.EntityOrganisationContext.RejectChanges(); if (CDS.Shared.Exception.UserInterfaceExceptionHandler.HandleException(ref ex)) { throw ex; } throw new Exception("Failed to Register print job /n" + ex.ToString()); } }
public static DB.SYS_Printer GetPreviousItem(DB.SYS_Printer SYS_Printer, DataContext dataContext) { return(dataContext.EntitySystemContext.SYS_Printer.OrderByDescending(o => o.Name).FirstOrDefault(n => n.Name.CompareTo(SYS_Printer.Name) < 0 && n.Name.CompareTo(SYS_Printer.Name) != 0)); }
public static DB.SYS_Printer GetNextItem(DB.SYS_Printer SYS_Printer, DataContext dataContext) { return(dataContext.EntitySystemContext.SYS_Printer.OrderBy(o => o.Name).FirstOrDefault(n => n.Name.CompareTo(SYS_Printer.Name) > 0 && n.Name.CompareTo(SYS_Printer.Name) != 0)); }