コード例 #1
0
        /// <summary>
        /// Load total amount design which could be set in AX
        /// </summary>
        private void LoadTotalAmountDesign()
        {
            LayoutData layoutData = new LayoutData(ApplicationSettings.Database.LocalConnection, ApplicationSettings.Database.DATAAREAID);
            string     layoutId   = layoutData.GetLayoutId(ApplicationSettings.Terminal.StoreId, ApplicationSettings.Terminal.TerminalId, ApplicationSettings.Terminal.TerminalOperator.OperatorId);

            using (DataTable layoutTable = layoutData.GetLayout(layoutId))
            {
                if (layoutTable.Rows.Count > 0)
                {
                    string layout = DBUtil.ToStr(layoutTable.Rows[0]["TOTALSLAYOUTXML"]);

                    if (!string.IsNullOrWhiteSpace(layout))
                    {
                        try
                        {
                            totalAmounts.SetLayout(Utility.GetStream(layout));
                            totalAmounts.HideHeader();
                            totalAmounts.Translate();
                        }
                        catch (Exception x)
                        {
                            ApplicationExceptionHandler.HandleException(x.Message, x);
                        }
                    }
                }
            }
        }
コード例 #2
0
        internal static DataTable GetOrdersList(string customerSearchTerm, string orderSearchTerm, DateTime?startDate, DateTime?endDate, int?resultMaxCount)
        {
            ApplicationLog.Log(
                SalesOrderActions.LogSource,
                "Getting the list of sales orders for a customer",
                LogTraceLevel.Trace);

            DataTable salesOrders;
            bool      retVal  = false;
            string    comment = string.Empty;

            try
            {
                salesOrders = SalesOrder.GetCustomerOrdersList(ref retVal, ref comment, customerSearchTerm, orderSearchTerm, startDate, endDate, resultMaxCount);
            }
            catch (PosisException px)
            {
                ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, px);
                throw;
            }
            catch (Exception x)
            {
                ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, x);
                throw new PosisException(52300, x);
            }
            return(salesOrders);
        }
コード例 #3
0
        private void HandlePosIsException(PosisException ex)
        {
            string message = string.Format(ApplicationLocalizer.Language.Translate(55002),
                                           LSRetailPosis.Settings.ApplicationSettings.ShortApplicationTitle);

            ApplicationExceptionHandler.HandleException(this.ToString(), ex);
            ShowErrorMessage(message);
        }
コード例 #4
0
 private void StartSession(List <Guid> scenarioIds)
 {
     try
     {
         _sessionManager.StartSession(scenarioIds);
     }
     catch (Exception ex)
     {
         ApplicationExceptionHandler.UnhandledException(ex);
     }
 }
コード例 #5
0
 private void StartSession(List <Guid> scenarioIds)
 {
     try
     {
         SessionConfigurationWizard wizard = new SessionConfigurationWizard(scenarioIds);
         _sessionManager.StartSession(wizard, wizard.Ticket);
     }
     catch (Exception ex)
     {
         ApplicationExceptionHandler.UnhandledException(ex);
     }
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: ProjectAgri20/newrepo
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            using (Form mainForm = new MainForm())
            {
                Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
                ApplicationExceptionHandler.Attach(mainForm);
                Application.Run(mainForm);
            }
        }
コード例 #7
0
 private void Show <T>(object sender, EventArgs e) where T : Form, new()
 {
     try
     {
         T form = new T();
         form.Show(this);
     }
     catch (Exception ex)
     {
         ApplicationExceptionHandler.UnhandledException(ex);
     }
 }
コード例 #8
0
ファイル: Program.cs プロジェクト: ProjectAgri20/newrepo
        static void Main(string[] args)
        {
            NameValueCollection _args = new NameValueCollection();

            GlobalSettings.IsDistributedSystem = false;

            if (args != null && args.Length > 0)
            {
                CommandLineMessage();
                Console.ReadLine();
            }
            else
            {
                if (ConfigurationManager.GetSection("UnattendedExecutionConfig") != null)
                {
                    _args.Add(ConfigurationManager.GetSection("UnattendedExecutionConfig") as NameValueCollection);
                }

                if (CommandLineExec.GetAppConfigCount(_args) > 0)
                {
                    SetDispatcherArg(ref _args);
                    using (CommandLineExec commandLine = new CommandLineExec(_args))
                    {
                        try
                        {
                            commandLine.StatusChanged += CommandLine_StatusChanged;
                            FrameworkServicesInitializer.InitializeExecution();
                            commandLine.StartSession();
                        }
                        catch (Exception ex)
                        {
                            TraceFactory.Logger.Debug(ex.ToString());
                            Console.WriteLine(ex.ToString());
                        }
                    }
                }
                else
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    TraceFactory.Logger.Debug("Starting STB User Console UI.");

                    using (Form mainForm = new MainForm())
                    {
                        Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
                        ApplicationExceptionHandler.Attach(mainForm);
                        Application.Run(mainForm);
                    }
                }
            }
        }
コード例 #9
0
        /// <summary>
        /// Create pick list for the given order
        /// </summary>
        /// <param name="transaction"></param>
        internal static void TryCreatePickListForOrder(SalesStatus status, string orderId)
        {
            try
            {
                switch (status)
                {
                case SalesStatus.Created:
                case SalesStatus.Processing:
                case SalesStatus.Delivered:
                    // These statuses are allowed for Packslip creation
                    break;

                case SalesStatus.Canceled:
                case SalesStatus.Confirmed:
                case SalesStatus.Invoiced:
                case SalesStatus.Lost:
                case SalesStatus.Sent:
                case SalesStatus.Unknown:
                default:
                    // Please select an open order
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56132, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Prevent Picking list creation if cashier doesn't have view/edit access
                if (SalesOrder.InternalApplication.Services.LogOn.VerifyOperationAccess(
                        SalesOrder.InternalApplication.Shift.StaffId,
                        PosisOperations.CustomerOrderDetails))
                {
                    bool   retValue;
                    string comment;
                    SalesOrder.CreatePickingList(orderId, out retValue, out comment);

                    if (retValue)
                    {
                        // "The pick list was created"
                        SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56233);
                    }
                    else
                    {
                        // "Pick list could not be created as this time."
                        ApplicationLog.Log(SalesOrderActions.LogSource, comment, LogTraceLevel.Error);
                        SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56230, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            catch (Exception ex)
            {
                ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, ex);
                throw;
            }
        }
コード例 #10
0
 private void ShowSessionReports(object sender, EventArgs e)
 {
     try
     {
         var form = new STFReportGenerationForm();
         form.StartPosition = FormStartPosition.CenterParent;
         form.Show((IWin32Window)this);
     }
     catch (Exception ex)
     {
         ApplicationExceptionHandler.UnhandledException(ex);
     }
 }
コード例 #11
0
        /// <summary>
        /// Print a pack slip for the given order
        /// </summary>
        /// <param name="status"></param>
        /// <param name="orderId"></param>
        internal static void TryPrintPackSlip(SalesStatus status, string orderId)
        {
            try
            {
                //if (!selectedOrderStatus.Equals("Delivered"))
                if (status != SalesStatus.Delivered)
                {
                    // Please select an delivered order
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56133, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (string.IsNullOrEmpty(orderId))
                {
                    // Please select a sales order
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56116, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Prevent Packing slip printing if cashier doesn't have view/edit access
                if (SalesOrder.InternalApplication.Services.LogOn.VerifyOperationAccess(
                        SalesOrder.InternalApplication.Shift.StaffId,
                        PosisOperations.CustomerOrderDetails))
                {
                    IRetailTransaction transaction;
                    bool   retValue = false;
                    string comment;

                    SalesOrder.InternalApplication.Services.SalesOrder.GetCustomerOrder(
                        ref retValue, orderId, out comment, out transaction);

                    if (retValue)
                    {
                        SalesOrder.InternalApplication.Services.Printing.PrintPackSlip(transaction);
                    }
                    else
                    {
                        // The sales order was not found in AX
                        ApplicationLog.Log("frmGetSalesOrder.btnPrintPackSlip_Click()",
                                           string.Format("{0}/n{1}", ApplicationLocalizer.Language.Translate(56124), comment),
                                           LogTraceLevel.Error);
                        SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56124, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception x)
            {
                ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, x);
                SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56220, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #12
0
        private void ReturnItemsFromInvoice()
        {
            bool   retValue  = false;
            string comment   = string.Empty;
            string invoiceId = SelectedInvoiceId;
            CustomerOrderTransaction invoiceTransaction;
            DialogResult             results = DialogResult.None;

            try
            {
                // Construct a transaction from the given Invoice
                SalesOrder.GetSalesInvoiceTransaction(ref retValue, ref comment, invoiceId, out invoiceTransaction);

                if (retValue)
                {
                    ReturnTransactionConfirmation returnTransactionConfirmation = new ReturnTransactionConfirmation()
                    {
                        PosTransaction = invoiceTransaction,
                    };

                    InteractionRequestedEventArgs request = new InteractionRequestedEventArgs(returnTransactionConfirmation, () =>
                    {
                        if (returnTransactionConfirmation.Confirmed)
                        {
                            // The user selected to return items...
                            // Transfer the items to the posTranscation for the return
                            // Updates customer and calculates taxes based upon items and customer
                            SalesOrderActions.InsertReturnedItemsIntoTransaction(returnTransactionConfirmation.ReturnedLineNumbers, invoiceTransaction, this.Transaction);

                            // We only support returning a single-invoice at a time, so Close the form after processing the first one.
                            results = System.Windows.Forms.DialogResult.OK;
                            this.Close();
                        }
                    }
                                                                                              );

                    SalesOrder.InternalApplication.Services.Interaction.InteractionRequest(request);
                }
                else
                {
                    //An error occurred in the operation...
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(10002, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                ApplicationExceptionHandler.HandleException(this.ToString(), ex);
            }

            this.DialogResult = results;
        }
コード例 #13
0
 private void ShowDialog <T>(object sender, EventArgs e) where T : Form, new()
 {
     try
     {
         using (T form = new T())
         {
             form.ShowDialog(this);
         }
     }
     catch (Exception ex)
     {
         ApplicationExceptionHandler.UnhandledException(ex);
     }
 }
コード例 #14
0
ファイル: Program.cs プロジェクト: ProjectAgri20/newrepo
        static void Main(string[] args)
        {
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            if (args != null && args.Length > 0)
            {
                CommandLineMessage();
                Console.ReadLine();
            }
            else
            {
                NameValueCollection appConfig = ConfigurationManager.GetSection("UnattendedExecutionConfig") as NameValueCollection;
                if (CommandLineExec.GetAppConfigCount(appConfig) > 0)
                {
                    using (CommandLineExec commandLine = new CommandLineExec(appConfig))
                    {
                        try
                        {
                            commandLine.StatusChanged += CommandLine_StatusChanged;
                            FrameworkServicesInitializer.InitializeExecution();
                            commandLine.StartSession();
                        }
                        catch (Exception ex)
                        {
                            TraceFactory.Logger.Debug(ex.ToString());
                            Console.WriteLine(ex.ToString());
                        }
                    }
                }
                else
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    try
                    {
                        using (Form mainForm = new MainForm())
                        {
                            Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
                            ApplicationExceptionHandler.Attach(mainForm);
                            Application.Run(mainForm);
                        }
                    }
                    catch (Exception ex)
                    {
                        TraceFactory.Logger.Error(ex);
                        Application.Exit();
                    }
                }
            }
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: ProjectAgri20/newrepo
        static void Main()
        {
            TraceFactory.SetThreadContextProperty("ProcessId", Process.GetCurrentProcess().Id.ToString(CultureInfo.InvariantCulture));
            Thread.CurrentThread.SetName("Main");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Load settings from App.Config
            GlobalSettings.Load();

            using (Form mainForm = new MainForm())
            {
                Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
                ApplicationExceptionHandler.Attach(mainForm);
                Application.Run(mainForm);
            }
        }
コード例 #16
0
        private void OnLoaded(object sender, EventArgs e)
        {
            Application.Idle -= new EventHandler(OnLoaded);

            try
            {
                if (!ConnectToEnvironment())
                {
                    Application.Exit();
                }
            }
            catch (Exception ex)
            {
                // Inform the user of the error and allow them to send but do not kill the app unless they choose
                // For example, they may instead want to change environment.
                ApplicationExceptionHandler.UnhandledException(ex);
            }
        }
コード例 #17
0
        private void AdminControlPanel_Load(object sender, EventArgs e)
        {
            try
            {
                if (!ConnectToEnvironment())
                {
                    Application.Exit();
                }
            }
            catch (Exception ex)
            {
                // Inform the user of the error and allow them to send but do not kill the app unless they choose
                // For example, they may instead want to change environment.
                ApplicationExceptionHandler.UnhandledException(ex);
            }

            decimal version = 0;

            using (SqlAdapter adapter = new SqlAdapter(EnterpriseTestSqlConnection.ConnectionString))
            {
                try
                {
                    string sqlText = "SELECT value FROM fn_listextendedproperty(N'STF Revision', NULL, NULL, NULL, NULL, NULL, NULL)";
                    var    reader  = adapter.ExecuteReader(sqlText);
                    if (reader != null && reader.Read())
                    {
                        version = decimal.Parse(reader["value"].ToString());
                    }
                }
                catch (Exception)
                {
                }
            }

            if (version != 0)
            {
                versionLabel.Text = "STB v{0:#.##}".FormatWith(version);
            }
            else
            {
                versionLabel.Text = string.Empty;
            }
        }
コード例 #18
0
        /// <summary>
        /// Print text on the OPOS printer.
        /// </summary>
        /// <param name="text"></param>
        public void PrintReceipt(string text)
        {
            if (FiscalPrinter.FiscalPrinter.Instance.FiscalPrinterEnabled())
            {
                FiscalPrinter.FiscalPrinter.Instance.PrintReceipt(text);
                return;
            }

            // Always print to text file if test hook is enabled
            PrinterTestHook(text, "Receipt");

            if (!IsActive)
            {
                return;
            }

            try
            {
                NetTracer.Information("Peripheral [Printer] - Print Receipt");

                switch (this.deviceType)
                {
                case DeviceTypes.OPOS:
                    OPOSPrinting(text);
                    break;

                case DeviceTypes.Windows:
                    WindowsPrinting(text, this.DeviceName);
                    break;
                }
            }
            catch (Exception ex)
            {
                NetTracer.Warning("Peripheral [Printer] - Print Receipt Error: {0}", ex.ToString());

                ApplicationExceptionHandler.HandleException(this.ToString(), ex);
                Peripherals.InternalApplication.Services.Dialog.ShowMessage(6212);
            }
        }
コード例 #19
0
        /// <summary>
        /// Load a peripheral device with Retry prompt.
        /// </summary>
        /// <param name="peripheralStringId"></param>
        /// <param name="perphiral"></param>
        private void LoadPeripheral(int peripheralStringId, IPeripheral perphiral)
        {
            bool retry;

            do
            {
                try
                {
                    perphiral.Load();
                    retry = false;
                }
                catch (PosStartupException startupException)
                {
                    // The Fiscal printer validates law requirements and it must be able to abort the POS startup.
                    throw new PosStartupException(startupException.Message);
                }
                catch (Exception ex)
                {
                    ApplicationExceptionHandler.HandleException(this.ToString(), ex);

                    retry = PromptForRetry(peripheralStringId);
                }
            } while (retry);
        }
コード例 #20
0
        private void HandleStaffId(bool usePassword)
        {
            try
            {
                string           nextPromptText   = numPad.PromptText;
                NumpadEntryTypes currentEntryType = numPad.EntryType;

                LSRetailPosis.POSProcesses.Common.Login loginProcess = new LSRetailPosis.POSProcesses.Common.Login();
                bool okToContinue = loginProcess.LoginWindowEnterPressed(
                    ref currentEntryType, numPad.EnteredValue, ref operatorId, ref operatorName,
                    ref operatorNameOnReceipt, ref password, ref nextPromptText, ref usePassword);

                lblUser.Text      = string.IsNullOrEmpty(operatorName) ? string.Empty : string.Format(ApplicationLocalizer.Language.Translate(44), operatorName);
                numPad.EntryType  = currentEntryType;
                numPad.PromptText = nextPromptText;

                if (okToContinue)
                {
                    if (!Login.LogOnUser(usePassword, operatorId, operatorName, operatorNameOnReceipt, password))
                    {
                        ClearVariables();
                    }
                    else
                    {
                        LogonSuccessful();
                    }
                }
            }
            catch (Exception ex)
            {
                ApplicationExceptionHandler.HandleException(this.ToString(), ex);

                operatorName = string.Empty;
                lblUser.Text = string.Empty;
            }
        }
コード例 #21
0
        /// <summary>
        /// Create a pack slip for the given order
        /// </summary>
        /// <param name="status"></param>
        /// <param name="orderId"></param>
        internal static void TryCreatePackSlip(SalesStatus status, string orderId)
        {
            //to call pack Slip Method
            try
            {
                bool   retVal;
                string comment;

                switch (status)
                {
                case SalesStatus.Created:
                case SalesStatus.Processing:
                case SalesStatus.Delivered:
                    // These statuses are allowed for Packslip creation
                    break;

                case SalesStatus.Canceled:
                case SalesStatus.Confirmed:
                case SalesStatus.Invoiced:
                case SalesStatus.Lost:
                case SalesStatus.Sent:
                case SalesStatus.Unknown:
                default:
                    // Please select an open order
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56132, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (string.IsNullOrEmpty(orderId))
                {
                    // Please select a sales order
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56116, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // Prevent Packing slip creation if cashier doesn't have view/edit access
                if (SalesOrder.InternalApplication.Services.LogOn.VerifyOperationAccess(
                        SalesOrder.InternalApplication.Shift.StaffId,
                        PosisOperations.CustomerOrderDetails))
                {
                    //create Packing slip operation
                    SalesOrder.InternalApplication.Services.SalesOrder.CreatePackingSlip(out retVal, out comment, orderId);
                    if (retVal)
                    {
                        //A packing slip has been created.
                        SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56120, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        // "Pack list could not be created as this time."
                        ApplicationLog.Log(SalesOrderActions.LogSource, comment, LogTraceLevel.Error);
                        SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56231, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception x)
            {
                ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, x);

                // "Error creating the packing slip."
                SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56220, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #22
0
        /// <summary>
        /// Prints the selected page
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void printDoc_PrintPage(object sender, PrintPageEventArgs e)
        {
            const int LineHeight = 10;

            try
            {
                const string textFontName = "Courier New";
                const int    textFontSize = 7;

                e.HasMorePages = false;
                using (Font textFont = new Font(textFontName, textFontSize, FontStyle.Regular))
                    using (Font textFontBold = new Font(textFontName, textFontSize, FontStyle.Bold))
                    {
                        string temp = string.Empty;
                        float  x = 0, y = 0;
                        float  dpiXRatio    = e.Graphics.DpiX / 96f;                                                                                                          // 96dpi = 100%
                        float  dpiYRatio    = e.Graphics.DpiY / 96f;                                                                                                          // 96dpi = 100%
                        float  contentWidth = printText.Max(str => str.Replace(NORMAL_TEXT_MARKER, string.Empty).Replace(BOLD_TEXT_MARKER, string.Empty).Length) * dpiXRatio; // Line with max length = content width

                        while (this.printTextLine < printText.Length)
                        {
                            string subString;
                            int    index, index2;

                            if (y + LineHeight >= e.MarginBounds.Height)
                            { // No more room - advance to next page
                                e.HasMorePages = true;
                                return;
                            }

                            index = printText[this.printTextLine].IndexOf(BOLD_TEXT_MARKER);

                            if (index >= 0)
                            {
                                // Text line printing with bold Text in it.

                                x = 0;

                                subString = printText[this.printTextLine];

                                while (subString.Length > 0)
                                {
                                    index2 = subString.IndexOf(BOLD_TEXT_MARKER);

                                    if (index2 >= 0)
                                    {
                                        temp = subString.Substring(0, index2).Replace(NORMAL_TEXT_MARKER, string.Empty).Replace(BOLD_TEXT_MARKER, string.Empty);
                                        e.Graphics.DrawString(temp, textFont, Brushes.Black, x + e.MarginBounds.Left, y + e.MarginBounds.Top);
                                        x = x + (temp.Length * 6);

                                        index2    = index2 + 3;
                                        subString = subString.Substring(index2, subString.Length - index2);
                                        index2    = subString.IndexOf(NORMAL_TEXT_MARKER);

                                        temp = subString.Substring(0, index2).Replace(NORMAL_TEXT_MARKER, string.Empty).Replace(BOLD_TEXT_MARKER, string.Empty);
                                        e.Graphics.DrawString(temp, textFontBold, Brushes.Black, x + e.MarginBounds.Left, y + e.MarginBounds.Top);
                                        x = x + (temp.Length * 6);

                                        subString = subString.Substring(index2, subString.Length - index2);
                                    }
                                    else
                                    {
                                        subString = subString.Replace(NORMAL_TEXT_MARKER, string.Empty).Replace(BOLD_TEXT_MARKER, string.Empty);
                                        e.Graphics.DrawString(subString, textFont, Brushes.Black, x + e.MarginBounds.Left, y + e.MarginBounds.Top);
                                        subString = string.Empty;
                                    }
                                }
                            }
                            else
                            {
                                // Text line printing with no bold Text in it.

                                subString = printText[this.printTextLine].Replace(NORMAL_TEXT_MARKER, string.Empty);

                                Match barCodeMarkerMatch = Regex.Match(subString, barCodeRegEx, RegexOptions.Compiled | RegexOptions.IgnoreCase);

                                if (barCodeMarkerMatch.Success)
                                {
                                    // Get the receiptId
                                    subString = barCodeMarkerMatch.Groups[1].ToString();

                                    using (Image barcodeImage = barCode.Create(subString, e.Graphics.DpiX, e.Graphics.DpiY))
                                    {
                                        if (barcodeImage != null)
                                        {
                                            float barcodeHeight = (barcodeImage.Height / dpiYRatio);

                                            if (y + barcodeHeight >= e.MarginBounds.Height)
                                            { // No more room - advance to next page
                                                e.HasMorePages = true;
                                                return;
                                            }

                                            // Render barcode in the center of receipt.
                                            e.Graphics.DrawImage(barcodeImage, ((contentWidth - (barcodeImage.Width / dpiXRatio)) / 2) + e.MarginBounds.Left, y + e.MarginBounds.Top);
                                            y += barcodeHeight;
                                        }
                                    }
                                }
                                else
                                {
                                    e.Graphics.DrawString(subString, textFont, Brushes.Black, e.MarginBounds.Left, y + e.MarginBounds.Top);
                                }
                            }
                            y = y + LineHeight;

                            printTextLine += 1;
                        } // of while()
                    }// of using()
            }             // of try
            catch (Exception ex)
            {
                NetTracer.Warning("Peripheral [Printer] - Exception in print page");

                ApplicationExceptionHandler.HandleException(this.ToString(), ex);
            }
        }
コード例 #23
0
        /// <summary>
        /// Attempt to return invoices for the given order
        /// </summary>
        /// <param name="transaction"></param>
        /// <returns></returns>
        internal static CustomerOrderTransaction ReturnOrderInvoices(CustomerOrderTransaction transaction)
        {
            CustomerOrderTransaction result = null;

            try
            {
                if (transaction == null)
                {
                    // Operation not valid for this type of transaction
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(3175, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(null);
                }

                if (transaction.OrderType != CustomerOrderType.SalesOrder)
                {
                    // Operation not valid for this type of transaction
                    SalesOrder.InternalApplication.Services.Dialog.ShowMessage(3175, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(null);
                }

                bool   retValue = false;
                string comment  = string.Empty;

                using (DataTable invoices = SalesOrder.GetSalesInvoiceList(ref retValue, ref comment, transaction.OrderId))
                {
                    if ((!retValue) || (invoices == null) || (invoices.Rows.Count == 0))
                    {
                        if (!retValue)
                        {
                            ApplicationLog.Log(SalesOrderActions.LogSource, comment, LogTraceLevel.Error);
                        }

                        // There are no sales orders in the database for this customer....
                        SalesOrder.InternalApplication.Services.Dialog.ShowMessage(56123, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return(null);
                    }

                    // Show the available sales orders for selection...
                    using (frmGetSalesInvoices dlg = new frmGetSalesInvoices(invoices, transaction))
                    {
                        SalesOrder.InternalApplication.ApplicationFramework.POSShowForm(dlg);

                        if (dlg.DialogResult == System.Windows.Forms.DialogResult.OK)
                        {
                            // Copy the transaction back from the 'return invoices' form
                            result = dlg.Transaction;

                            SalesOrderActions.ProcessReturnReasonCodes(result);
                        }
                    }
                }
            }
            catch (PosisException px)
            {
                POSFormsManager.ShowPOSErrorDialog(px);
                ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, px);
            }
            catch (Exception x)
            {
                ApplicationExceptionHandler.HandleException(SalesOrderActions.LogSource, x);
                throw;
            }

            return(result);
        }
コード例 #24
0
 private void HandleGiftCardException(GiftCardException ex)
 {
     ApplicationExceptionHandler.HandleException(this.ToString(), ex);
     ShowErrorMessage(ex.Message);
 }
コード例 #25
0
 private void DispatcherErrorReceived(object sender, ExceptionDetailEventArgs e)
 {
     ApplicationExceptionHandler.UnhandledException(e.Message, e.Detail, UserManager.CurrentUserName);
 }