Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
0
        public override void Annul()
        {
            if (!CheckIsNewFormat())
            {
                return;
            }

            string error;
            string warning;

            if (BusinessDomain.CanAnnulOperation(this, out error, out warning))
            {
                LoadDetails();
                ClearDetails();
                Commit(GetPriceGroup(-1, locationId), true);
            }
            else if (warning != null)
            {
                BusinessDomain.RequestOperationAnnul(this);
            }
        }