/// <summary> /// Sets the visibility of controls based on the status of the Sales Order. /// </summary> /// <param name="form">The Sales Order Details form.</param> /// <param name="args">The <see cref="System.EventArgs"/> instance containing the event data.</param> public static void OnLoad1Step(ISalesOrderDetails form, EventArgs args) { ISalesOrder salesOrder = form.CurrentEntity as ISalesOrder; if (salesOrder != null) { form.lueAccount.IsReadOnly = !string.IsNullOrEmpty(salesOrder.ErpExtId); var closed = salesOrder.IsClosed(); form.lueAccount.IsReadOnly = closed; form.lueOpportunity.IsReadOnly = closed; form.dtpOrderDate.IsReadOnly = closed; form.dtpPromisedDate.IsReadOnly = closed; form.txtCustPO.IsReadOnly = closed; form.pklOrderStatus.IsReadOnly = closed; form.dtpDueDate.IsReadOnly = closed; form.txtComments.IsReadOnly = closed; form.chkBackOrdered.IsReadOnly = closed; form.txtCustomerRFQ.IsReadOnly = closed; form.btnSaveSalesOrder.Visible = !closed; form.btnReset.Visible = !closed; form.btnDelete.Visible = !closed; } }