예제 #1
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));
        }
예제 #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);
        }
        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));
        }
예제 #4
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());
 }
예제 #5
0
        private bool OnValidateCallback(string message, ErrorSeverity severity, int code, StateHolder state)
        {
            using (MessageError dlgError = new MessageError(message, severity))
                if (severity == ErrorSeverity.Warning)
                {
                    dlgError.Buttons = MessageButtons.YesNo;
                    if (dlgError.Run() != ResponseType.Yes)
                    {
                        SelectFieldByCode((Item.ErrorCodes)code);
                        return(false);
                    }
                }
                else
                {
                    dlgError.Run();
                    SelectFieldByCode((Item.ErrorCodes)code);
                    return(false);
                }

            return(true);
        }
예제 #6
0
        private bool Validate()
        {
            return(GetLocation().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));
        }
예제 #7
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;
                }
            }
        }
예제 #8
0
 public static ResponseType ShowDialog(string message, string dialogIcon, ErrorSeverity severity = ErrorSeverity.Warning, Exception ex = null)
 {
     using (MessageError msg = new MessageError(message, dialogIcon, severity, ex))
         return(msg.Run());
 }