/// <summary>
        /// Constructor
        /// </summary>
        public CancelOrderComponentControl(CancelOrderComponent component)
            : base(component)
        {
            InitializeComponent();
            _component = component;

            _proceduresTableView.Table = _component.ProceduresTable;
            _cancelReason.DataSource   = _component.CancelReasonChoices;
            _cancelReason.DataBindings.Add("Value", _component, "SelectedCancelReason", true, DataSourceUpdateMode.OnPropertyChanged);
            _okButton.DataBindings.Add("Enabled", _component, "AcceptEnabled", false, DataSourceUpdateMode.OnPropertyChanged);
        }
		/// <summary>
		/// Constructor
		/// </summary>
		public CancelOrderComponentControl(CancelOrderComponent component)
			: base(component)
		{
			InitializeComponent();
			_component = component;

			_proceduresTableView.Table = _component.ProceduresTable;
			_cancelReason.DataSource = _component.CancelReasonChoices;
			_cancelReason.DataBindings.Add("Value", _component, "SelectedCancelReason", true, DataSourceUpdateMode.OnPropertyChanged);
			_okButton.DataBindings.Add("Enabled", _component, "AcceptEnabled", false, DataSourceUpdateMode.OnPropertyChanged);
		}
示例#3
0
		public static bool CancelOrder(EntityRef orderRef, string description, IDesktopWindow desktopWindow)
		{
			// first check for warnings
			QueryCancelOrderWarningsResponse response = null;
			Platform.GetService<IOrderEntryService>(
				service => response = service.QueryCancelOrderWarnings(new QueryCancelOrderWarningsRequest(orderRef)));

			if (response.Errors != null && response.Errors.Count > 0)
			{
				var error = CollectionUtils.FirstElement(response.Errors);
				desktopWindow.ShowMessageBox(error, MessageBoxActions.Ok);
				return false;
			}

			if (response.Warnings != null && response.Warnings.Count > 0)
			{
				var warn = CollectionUtils.FirstElement(response.Warnings);
				var action = desktopWindow.ShowMessageBox(
					warn + "\n\nAre you sure you want to cancel this order?",
					MessageBoxActions.YesNo);
				if (action == DialogBoxAction.No)
					return false;
			}

			var cancelOrderComponent = new CancelOrderComponent(orderRef);
			var exitCode = ApplicationComponent.LaunchAsDialog(
				desktopWindow,
				cancelOrderComponent,
				String.Format(SR.TitleCancelOrder, description));

			if (exitCode == ApplicationComponentExitCode.Accepted)
			{
				Platform.GetService<IOrderEntryService>(
					service => service.CancelOrder(new CancelOrderRequest(orderRef, cancelOrderComponent.SelectedCancelReason)));

				return true;
			}
			return false;
		}
 public void SetComponent(IApplicationComponent component)
 {
     _component = (CancelOrderComponent)component;
 }
		public void SetComponent(IApplicationComponent component)
		{
			_component = (CancelOrderComponent)component;
		}