private bool Validate()
        {
            if (!OperationValidate())
            {
                return(false);
            }

            if (!OperationDetailsValidate())
            {
                return(false);
            }

            grdMaterials.CancelCellEdit();
            grdProducts.CancelCellEdit();

            return(GetRecipe().Validate((message, severity, code, state) =>
            {
                using (MessageError dlgError = new MessageError(message, severity, null))
                    if (severity == ErrorSeverity.Warning)
                    {
                        dlgError.Buttons = MessageButtons.YesNo;
                        if (dlgError.Run() != ResponseType.Yes)
                        {
                            return false;
                        }
                    }
                    else
                    {
                        dlgError.Run();
                        return false;
                    }

                return true;
            }, null));
        }
예제 #2
0
        private bool Validate()
        {
            if (!GetUser().Validate((message, severity, code, state) =>
            {
                using (MessageError dlgError = new MessageError(message, severity))
                    if (severity == ErrorSeverity.Warning)
                    {
                        dlgError.Buttons = MessageButtons.YesNo;
                        if (dlgError.Run() != ResponseType.Yes)
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        dlgError.Run();
                        return(false);
                    }

                return(true);
            }, null))
            {
                return(false);
            }

            if (txtPassword1.Text != txtPassword2.Text)
            {
                MessageError.ShowDialog(Translator.GetString("Wrong password confirmation!"));
                return(false);
            }

            return(true);
        }
예제 #3
0
        protected override void btnGroupDelete_Clicked(object sender, EventArgs e)
        {
            G group = groupsPanel.GetSelectedGroup();
            DeletePermission permission = GetDeletePermission(group);

            switch (permission)
            {
            case DeletePermission.InUse:
                MessageError.ShowDialog(
                    Translator.GetString("This group cannot be deleted, because it is not empty. Please, delete or move to another group the contents of this group in order to be able to delete it!"),
                    "Icons.Group16.png");
                return;

            case DeletePermission.Reserved:
            case DeletePermission.No:
                MessageError.ShowDialog(
                    string.Format(Translator.GetString("Cannot delete group \"{0}\"!"), group.Name),
                    "Icons.Group16.png");
                return;
            }

            DeleteGroup(group);
            ReinitializeGrid(true, @group.Parent != null ? @group.Parent.Id : -1);
            OnGroupDeleted();
        }
예제 #4
0
        protected override bool DeleteEntity(Partner entity)
        {
            selectedId = entity.Id;

            switch (Partner.RequestDelete(entity.Id))
            {
            case DeletePermission.InUse:
                string title       = Translator.GetString("Partner in Use");
                string translation = Translator.GetString(
                    "The partner \"{0}\" cannot be deleted, because it is used in operations. Do you want to move it to the \"Deleted\" group?");
                string message = string.Format(translation, entity.Name);

                if (Message.ShowDialog(title, "Icons.Partner16.png", message, "Icons.Question32.png",
                                       MessageButtons.YesNo) == ResponseType.Yes)
                {
                    entity.Deleted = true;
                    entity.GroupId = PartnersGroup.DefaultGroupId;
                    entity.CommitChanges();
                    return(true);
                }
                return(false);

            case DeletePermission.Reserved:
            case DeletePermission.No:
                MessageError.ShowDialog(
                    string.Format(Translator.GetString("Cannot delete partner \"{0}\"!"), entity.Name),
                    "Icons.Partner16.png");
                return(false);
            }

            Partner.Delete(entity.Id);
            return(true);
        }
        protected virtual void btnOK_Clicked(object o, EventArgs args)
        {
            if (total == 0)
            {
                MessageError.ShowDialog(Translator.GetString("Please select a valid cash amount before proceeding!"));
                return;
            }

            if (!FormHelper.TryReceiptPrinterCommand(delegate
            {
                BusinessDomain.DeviceManager.TryDeviceCommand(delegate
                {
                    if (rbnCashInput.Active)
                    {
                        cashReceiptDriver.RegisterCash(total, txvCashDescription.Buffer.Text, txvReason.Buffer.Text);
                    }
                    else if (rbnCashOutput.Active)
                    {
                        cashReceiptDriver.RegisterCash(-total, txvCashDescription.Buffer.Text, txvReason.Buffer.Text);
                    }
                });
            }))
            {
                return;
            }

            dlgFiscalRegisterCash.Respond(ResponseType.Ok);
        }
예제 #6
0
        private bool Validate()
        {
            foreach (KeyValuePair <Entry, string> pair in priceGroupWarnings)
            {
                Entry txtPrice = pair.Key;
                if (Currency.IsValidExpression(txtPrice.Text))
                {
                    continue;
                }

                MessageError.ShowDialog(pair.Value);
                SelectInvalidPrice(txtPrice);
                return(false);
            }

            if (!CheckPricesSaleLessThanPurchase())
            {
                return(false);
            }

            Item ret = GetItem();

            if (string.IsNullOrWhiteSpace(ret.MUnit))
            {
                if (!OnValidateCallback(Translator.GetString("Measurement unit cannot be empty!"), ErrorSeverity.Error, (int)Item.ErrorCodes.MeasUnitEmpty, null))
                {
                    return(false);
                }
            }

            BusinessDomain.AppConfiguration.CustomGeneratedBarcodeType   = (GeneratedBarcodeType)cboBarcodeType.GetSelectedValue();
            BusinessDomain.AppConfiguration.CustomGeneratedBarcodeFormat = txtBarcodeFormat.Text;

            return(GetItem().Validate(OnValidateCallback, null));
        }
예제 #7
0
        protected virtual bool SaveDocument(FinalizeAction action = FinalizeAction.CommitDocument)
        {
            if (sale != null && chkPrintCashReceipt.Active)
            {
                action |= FinalizeAction.PrintCashReceipt | FinalizeAction.CollectSaleData;

                if (sale.IsVATExempt || (sale.VAT.IsZero() && sale.Total > 0))
                {
                    if (VATGroup.GetExemptGroup() == null)
                    {
                        MessageError.ShowDialog(string.Format(Translator.GetString("To print a receipt for a document without VAT you need to define a 0% VAT group in {0} and in the receipt printer if necessary!"), DataHelper.ProductName));
                        return(false);
                    }
                }
            }

            HardwareErrorResponse res;

            do
            {
                res.Retry = false;
                try {
                    BusinessDomain.DeviceManager.FinalizeOperation(new FinalizeOperationOptions {
                        Sale = sale, Document = document, Action = action
                    });
                } catch (InvoiceNumberInUseException ex) {
                    txtNumber.SelectRegion(0, txtNumber.Text.Length);
                    MessageError.ShowDialog(
                        Translator.GetString("The entered document number already exists!"),
                        ErrorSeverity.Error, ex);
                    return(false);
                } catch (HardwareErrorException ex) {
                    res = FormHelper.HandleHardwareError(ex);
                    if (!res.Retry)
                    {
                        dlgEditNewDocument.Respond(ResponseType.Cancel);
                        return(false);
                    }
                } catch (InsufficientItemAvailabilityException ex) {
                    MessageError.ShowDialog(
                        string.Format(Translator.GetString("The document cannot be saved due to insufficient quantities of item \"{0}\"."), ex.ItemName),
                        ErrorSeverity.Warning, ex);
                    dlgEditNewDocument.Respond(ResponseType.Cancel);
                    return(false);
                } catch (Exception ex) {
                    MessageError.ShowDialog(
                        Translator.GetString("An error occurred while saving the document!"),
                        ErrorSeverity.Error, ex);
                    dlgEditNewDocument.Respond(ResponseType.Cancel);
                    return(false);
                }
            } while (res.Retry);

            if (sale != null)
            {
                document.Signature = sale.Signature;
            }

            return(true);
        }
예제 #8
0
        protected override void btnImport_Clicked(object o, EventArgs args)
        {
            if (!User.CheckOwnerExists())
            {
                string text = Translator.GetString("You need to add an owner before you can import users.");
                MessageError.ShowDialog(text, ErrorSeverity.Error);
                return;
            }

            int  selectedRow = grid.FocusedRow;
            long?groupId     = null;

            if (selectedRow >= 0)
            {
                selectedId = entities [selectedRow].Id;
                groupId    = entities [selectedRow].GroupId;
            }

            // Added transaction to ensure that we are connected to the same server in case of
            // master-slave replication
            using (new DbMasterScope(BusinessDomain.DataAccessProvider)) {
                FormHelper.ImportData <User> (CustomValidate);
                OnEntitiesChanged(groupId);
            }
        }
예제 #9
0
        private bool Validate()
        {
            if (!Percent.IsValidExpression(txtValue.Text))
            {
                MessageError.ShowDialog(Translator.GetString("Invalid percent value!"));
                txtValue.GrabFocus();
                return(false);
            }

            return(GetVATGroup().Validate((message, severity, code, state) =>
            {
                using (MessageError dlgError = new MessageError(message, severity))
                    if (severity == ErrorSeverity.Warning)
                    {
                        dlgError.Buttons = MessageButtons.YesNo;
                        if (dlgError.Run() != ResponseType.Yes)
                        {
                            return false;
                        }
                    }
                    else
                    {
                        dlgError.Run();
                        return false;
                    }

                return true;
            }, null));
        }
예제 #10
0
        private void btnOK_Clicked(object o, EventArgs args)
        {
            StringBuilder bankNotesAndMoneyBuilder = new StringBuilder();

            foreach (ToggleButton toggleButton in allButtons)
            {
                if (toggleButton.Active)
                {
                    double value = (double)toggleButton.Data ["Value"];
                    bankNotesAndMoneyBuilder.Append(value.ToString(CultureInfo.InvariantCulture.NumberFormat) + ';');
                }
            }

            if (string.IsNullOrEmpty(bankNotesAndMoneyBuilder.ToString()))
            {
                MessageError.ShowDialog(Translator.GetString("You must have at least one bank note or coin type selected."),
                                        ErrorSeverity.Error);
                return;
            }

            bankNotesAndMoneyBuilder.Remove(bankNotesAndMoneyBuilder.Length - 1, 1);
            bankNotesAndCoins = bankNotesAndMoneyBuilder.ToString();
            BusinessDomain.AppConfiguration.BankNotesAndCoins = bankNotesAndCoins;

            dlgChooseBankNotesAndCoins.Respond(ResponseType.Ok);
        }
예제 #11
0
 public static ResponseType ShowDialog(string message, ErrorSeverity severity = ErrorSeverity.Warning, Exception ex = null, MessageButtons buttons = MessageButtons.OK)
 {
     using (MessageError msg = new MessageError(message, severity, ex)
     {
         Buttons = buttons
     })
         return(msg.Run());
 }
예제 #12
0
        protected override void btnEdit_Clicked(object o, EventArgs args)
        {
            if (grid.Selection.Count <= 0)
            {
                MessageError.ShowDialog(Translator.GetString("Please select an operation to edit a payment of."), ErrorSeverity.Error);
                return;
            }

            Payment selectedPayment = entities [grid.Selection [0]];
            string  message;

            if (!BusinessDomain.CanEditPayment(selectedPayment, out message))
            {
                MessageError.ShowDialog(message);
                return;
            }

            selectedId = selectedPayment.Id;
            if (selectedPayment.OperationType == (int)OperationType.AdvancePayment)
            {
                using (new DbMasterScope(BusinessDomain.DataAccessProvider))
                    using (EditNewAdvancePayment dialog = new EditNewAdvancePayment(selectedPayment)) {
                        if (dialog.Run() != ResponseType.Ok || dialog.Payments.Count == 0)
                        {
                            return;
                        }

                        foreach (Payment payment in dialog.Payments)
                        {
                            payment.EditAdvance();
                        }

                        dialog.PrintPayments(dialog.Payments);
                        ReinitializeGrid(true, null);
                        return;
                    }
            }

            Operation operation = GetOperationOfSelectedPayment();

            if (operation == null)
            {
                return;
            }

            using (new DbMasterScope(BusinessDomain.DataAccessProvider))
                using (EditNewPayment dialog = new EditNewPayment(operation)) {
                    if (dialog.Run() != ResponseType.Ok)
                    {
                        return;
                    }

                    operation.CommitPayments();
                    dialog.PrintPayments(dialog.OriginalPayments, operation);
                    ReinitializeGrid(true, null);
                }
        }
예제 #13
0
        protected void btnOK_Clicked(object o, EventArgs args)
        {
            if (IsEditable)
            {
                if (!CheckEntries())
                {
                    return;
                }

                SetDocumentFields();

                SaveOperationPartner();

                if (!SaveDocument())
                {
                    return;
                }

                BusinessDomain.AppConfiguration.LastDocumentPaymentMethodId = (long)cboPaymentType.GetSelectedValue();
            }
            else
            {
                SetDocumentFields();
                if (!SaveDocument(FinalizeAction.None))
                {
                    return;
                }
            }

            try {
                if (isPrintable && (chkPrintOriginal.Active || chkPrintCopy.Active || chkPrintInternational.Active))
                {
                    document.PrintOriginal      = chkPrintOriginal.Active;
                    document.PrintCopies        = chkPrintCopy.Active ? spnPrintCopy.ValueAsInt : 0;
                    document.PrintInternational = chkPrintInternational.Active;

                    document.IsOriginal = document.PrintOriginal;

                    // Hide this dialog so the preview can show on a clean screen
                    dlgEditNewDocument.Hide();
                    DocumentBase doc = document;
                    if (!document.PrintOriginal && document.PrintInternational)
                    {
                        doc            = document.GetInternational();
                        doc.IsOriginal = null;
                    }
                    FormHelper.PrintPreviewObject(doc);
                }

                dlgEditNewDocument.Respond(ResponseType.Ok);
            } catch (Exception ex) {
                MessageError.ShowDialog(GetErrorWhileGeneratingMessage(), ErrorSeverity.Error, ex);

                dlgEditNewDocument.Respond(ResponseType.Cancel);
            }
        }
예제 #14
0
        protected void btnOK_Clicked(object o, EventArgs args)
        {
            if (selected.Count == 0)
            {
                MessageError.ShowDialog(Translator.GetString("Please select at least one payment type."), ErrorSeverity.Error);
                return;
            }

            dlgChoosePaymentTypes.Respond(ResponseType.Ok);
        }
        protected override void btnOK_Clicked(object o, System.EventArgs args)
        {
            if (!SelectedItem.CheckIsNewFormat())
            {
                MessageError.ShowDialog(string.Format(Translator.GetString("This stock-taking cannot be edited because it is created with an older version of {0}! Only new stock-taking operations can be edited."), DataHelper.ProductName));
                return;
            }

            base.btnOK_Clicked(o, args);
        }
예제 #16
0
 private bool Validate()
 {
     if (rbPriceGroup.Active && ArithmeticOperation == OperatorType.Divide && PriceGroupValue.IsZero())
     {
         MessageError.ShowDialog(Translator.GetString("Division by zero is impossible."));
         txtPriceGroupValue.GrabFocus();
         return(false);
     }
     return(true);
 }
예제 #17
0
 private bool Validate()
 {
     if (txtEmail.Visible && !Validator.CheckEmail(txtEmail.Text.Trim()))
     {
         MessageError.ShowDialog(Translator.GetString("The entered e-mail address is invalid."));
         txtEmail.GrabFocus();
         return(false);
     }
     return(true);
 }
예제 #18
0
        protected virtual void btnOK_Clicked(object o, EventArgs args)
        {
            string locName = txtExchangeLocation.Text;

            if (usesLocation && location == null && !string.IsNullOrWhiteSpace(locName) && txtExchangeLocation.Sensitive)
            {
                Location loc = Location.GetByCode(locName) ?? Location.GetByName(locName);
                if (loc != null)
                {
                    SetLocation(loc);
                }
                else
                {
                    MessageError.ShowDialog(string.Format(Translator.GetString("A location \"{0}\" cannot be found!"), locName));
                    return;
                }
            }

            if (chkExchangeFile.Active)
            {
                if (string.IsNullOrWhiteSpace(txtExchangeFile.Text))
                {
                    MessageError.ShowDialog(Translator.GetString("No file selected for export!"));
                    return;
                }

                string dir = Path.GetDirectoryName(txtExchangeFile.Text);
                if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
                {
                    try {
                        Directory.CreateDirectory(dir);
                    } catch (Exception ex) {
                        MessageError.ShowDialog(string.Format(Translator.GetString("Error occurred while creating folder \"{0}\". Please check if you have write permissions to that location."), dir), ErrorSeverity.Warning, ex);
                        return;
                    }
                }
            }

            if (chkEmail.Active)
            {
                if (string.IsNullOrEmpty(txtEmail.Text))
                {
                    MessageError.ShowDialog(Translator.GetString("No e-mail recipients entered!"));
                    return;
                }

                if (string.IsNullOrEmpty(txtEmailSubject.Text))
                {
                    MessageError.ShowDialog(Translator.GetString("No e-mail subject entered!"));
                    return;
                }
            }

            dlgExchangeObjects.Respond(ResponseType.Ok);
        }
예제 #19
0
 protected void btnOK_Clicked(object o, EventArgs args)
 {
     Item = Business.Entities.Item.GetByAny(txtItem.Text);
     if (Item == null)
     {
         MessageError.ShowDialog(Translator.GetString("Please select a valid item."), ErrorSeverity.Error);
         txtItem.GrabFocus();
         return;
     }
     dlgAddServiceCharge.Respond(ResponseType.Ok);
 }
        protected override void AnnulOperation()
        {
            StockTaking stockTaking = SelectedItem;

            if (!stockTaking.CheckIsNewFormat())
            {
                MessageError.ShowDialog(string.Format(Translator.GetString("This stock-taking cannot be annulled because it is created with an older version of {0}! Only new stock-taking operations can be annulled."), DataHelper.ProductName));
                return;
            }

            stockTaking.Annul();
        }
예제 #21
0
 private static void ReinitializeHardware(Device oldItem, Device newItem)
 {
     BusinessDomain.ReinitializeHardware(oldItem, newItem,
                                         () => MessageError.ShowDialog(Translator.GetString("An error occurred while connecting to the cash receipt device. Check the input parameters.")),
                                         () => MessageError.ShowDialog(Translator.GetString("An error occurred while connecting to the receipt device. Check the input parameters.")),
                                         () => MessageError.ShowDialog(Translator.GetString("An error occurred while connecting to the external display. Check the input parameters.")),
                                         () => MessageError.ShowDialog(Translator.GetString("An error occurred while connecting to the card reader device. Check the input parameters.")),
                                         () => MessageError.ShowDialog(Translator.GetString("An error occurred while connecting to the electronic scale. Check the input parameters.")),
                                         () => MessageError.ShowDialog(Translator.GetString("An error occurred while connecting to the sales data controller. Check the input parameters.")),
                                         () => MessageError.ShowDialog(Translator.GetString("An error occurred while connecting to the kitchen printer. Check the input parameters.")),
                                         () => MessageError.ShowDialog(Translator.GetString("An error occurred while connecting to the barcode scanner. Check the input parameters.")));
 }
예제 #22
0
        private bool Validate()
        {
            string name = txtName.Text.Trim();

            if (name.Length == 0)
            {
                MessageError.ShowDialog(Translator.GetString("Payment type name cannot be empty!"));
                return(false);
            }

            return(true);
        }
예제 #23
0
 private void btnTest_Clicked(object sender, EventArgs e)
 {
     if (ReLoadDatabases())
     {
         MessageError.ShowDialog(Translator.GetString("The connection to the server was successful."),
                                 "Icons.Database32.png", ErrorSeverity.Information);
     }
     else
     {
         MessageError.ShowDialog(Translator.GetString("The connection to the server was not successful!"),
                                 "Icons.Database32.png");
     }
 }
        private bool Validate()
        {
            if (hasEmptyRange)
            {
                MessageError.ShowDialog(emptyRangeMessage);
                return(false);
            }

            var  maxId      = Operation.GetMaxId();
            bool userWarned = false;

            for (int i = allStartNumbersPerLocation.Count - 1; i >= 0; i--)
            {
                foreach (OperationNumberingInfo numberingInfo in allStartNumbersPerLocation[i].Value)
                {
                    long endRange = maxId;
                    OperationNumberingInfo nextInfo = null;
                    if (i + 1 < allStartNumbersPerLocation.Count)
                    {
                        nextInfo = allStartNumbersPerLocation [i + 1].Value.FirstOrDefault(n => n.OperationType == numberingInfo.OperationType);
                        if (nextInfo != null)
                        {
                            endRange = nextInfo.StartNumber - 2;
                        }
                    }

                    long rangeSize = Math.Max(endRange - numberingInfo.StartNumber, 0);
                    if (rangeSize < OperationNumberingInfo.MINIMAL_NUMBERS_PER_LOCATION)
                    {
                        MessageError.ShowDialog(GetShortRangeWarning(numberingInfo, nextInfo, true, maxId), ErrorSeverity.Error);
                        SelectDocumentType(numberingInfo);
                        return(false);
                    }

                    if (userWarned || rangeSize >= OperationNumberingInfo.RECOMMENDED_NUMBERS_PER_LOCATION - 2)
                    {
                        continue;
                    }

                    if (Message.ShowDialog(Translator.GetString("Document Numbers per Location"), string.Empty,
                                           string.Format(GetShortRangeWarning(numberingInfo, nextInfo, false, maxId), OperationNumberingInfo.RECOMMENDED_NUMBERS_PER_LOCATION), "Icons.Warning32.png",
                                           MessageButtons.YesNo) == ResponseType.No)
                    {
                        SelectDocumentType(numberingInfo);
                        return(false);
                    }
                    userWarned = true;
                }
            }
            return(true);
        }
        private static bool ValidateDate(ref DateTime?date, Entry txtDate)
        {
            DateTime result = BusinessDomain.GetDateValue(txtDate.Text.Trim());

            if (result == DateTime.MinValue)
            {
                MessageError.ShowDialog(Translator.GetString("The entered date is invalid."), ErrorSeverity.Error);

                txtDate.GrabFocus();
                txtDate.SelectRegion(0, txtDate.Text.Length);
                return(false);
            }

            date = result;
            return(true);
        }
예제 #26
0
        protected override void btnOK_Clicked(object o, EventArgs args)
        {
            if (Exchanger.UsesFile && string.IsNullOrWhiteSpace(txtExchangeFile.Text))
            {
                MessageError.ShowDialog(Translator.GetString("Please specify an import file before continuing."));
                return;
            }

            BusinessDomain.AppConfiguration.LastImportFolder = Folder;
            if (grid.Selection.Count > 0)
            {
                BusinessDomain.AppConfiguration.LastImporter = exchangersModel [grid.Selection [0]].GetType().Name;
            }

            base.btnOK_Clicked(o, args);
        }
예제 #27
0
        private void PresentationDomain_CardRecognized(object sender, CardReadArgs e)
        {
            User user = User.GetByCard(e.CardId);

            if (user == null)
            {
                MessageError.ShowDialog(Translator.GetString("Invalid card!"));
                txtPassword.GrabFocus();
                return;
            }

            BusinessDomain.LoggedUser = user;
            BusinessDomain.AppConfiguration.LastLoggedUID = user.Id;

            dlgUserLogin.Respond(ResponseType.Ok);
        }
예제 #28
0
        private bool CheckNoDuplicateConditionType(PriceRule.ConditionType conditionType, bool isException)
        {
            PriceRuleCondition existingCondition = priceRule.Conditions.Find(c => c.Type == conditionType &&
                                                                             c.IsException == !isException);

            if (existingCondition == null || !existingCondition.IsActive)
            {
                return(true);
            }

            MessageError.ShowDialog(isException ?
                                    Translator.GetString("There is already a condition of this type.") :
                                    Translator.GetString("There is already an exception of this type."), ErrorSeverity.Error);

            return(false);
        }
예제 #29
0
        protected override void btnAnnul_Clicked(object o, EventArgs args)
        {
            if (Message.ShowDialog(GetAnnulTitle(), string.Empty, GetAnnulQuestion(), "Icons.Question32.png",
                                   MessageButtons.YesNo) != ResponseType.Yes)
            {
                return;
            }

            string error;
            string warning;

            if (!BusinessDomain.CanAnnulOperation(SelectedItem, out error, out warning))
            {
                if (warning != null)
                {
                    if (MessageError.ShowDialog(warning, buttons: MessageButtons.YesNo) != ResponseType.Yes)
                    {
                        return;
                    }
                }
                else
                {
                    MessageError.ShowDialog(error);
                    return;
                }
            }

            try {
                AnnulOperation();
                GetEntities();
                grid.Model = entities;
                if (btnPreview.Active)
                {
                    previewWidget.LoadOperation(SelectedItem);
                }
            } catch (ArgumentException) {
            } catch (InsufficientItemAvailabilityException ex) {
                if (btnPreview.Active)
                {
                    previewWidget.LoadOperation(SelectedItem);
                }

                MessageError.ShowDialog(string.Format(Translator.GetString("The operation cannot be annulled " +
                                                                           "because the annulment will cause negative availability of item \"{0}\"."), ex.ItemName),
                                        ErrorSeverity.Warning, ex);
            }
        }
예제 #30
0
        private void btnPrint_Clicked(object o, EventArgs args)
        {
            if (!ValidateFilters())
            {
                return;
            }

            DisplayReport();

            if (string.IsNullOrEmpty(txvPreview.Buffer.Text))
            {
                using (MessageError dlgMsg = new MessageError(
                           Translator.GetString("No matches."), "Icons.Report16.png",
                           ErrorSeverity.Information, null)) {
                    dlgMsg.Run();
                }
            }
            else
            {
                try {
                    exportProgress = new MessageProgress(Translator.GetString("Printing report..."), null, null);
                    exportProgress.Show();

                    FormHelper.TryReceiptPrinterCommand(delegate
                    {
                        DeviceManagerBase devMan = BusinessDomain.DeviceManager;
                        ICashReceiptPrinterController printer = devMan.CustomerOrderPrinter as ICashReceiptPrinterController;
                        if (printer != null)
                        {
                            PrintNonFiscal(devMan, printer);
                        }
                        else
                        {
                            IKitchenPrinterController kitchenPrinter = devMan.CustomerOrderPrinter as IKitchenPrinterController;
                            if (kitchenPrinter != null)
                            {
                                PrintKitchen(devMan, kitchenPrinter);
                            }
                        }
                    }, false);
                } finally {
                    exportProgress.Dispose();
                    exportProgress = null;
                }
            }
        }