private void OnFormLoad(object sender, EventArgs e) { //Event handler for form load event this.Cursor = Cursors.WaitCursor; try { //Get lists this.mClients.Merge(FreightGateway.GetClients()); this.mVendors.Merge(FreightGateway.GetVendors()); //Load controls this.Text = "Load Tender" + "(" + (!this.mEntry.IsIDNull() ? this.mEntry.ID.ToString() : "New") + ")"; this.lblID.Text = !this.mEntry.IsIDNull() ? this.mEntry.ID.ToString("00000000") : ""; this.dtpScheduleDate.Value = !this.mEntry.IsScheduleDateNull() ? this.mEntry.ScheduleDate : DateTime.Today; this.cboClient.SelectedValue = !this.mEntry.IsClientNumberNull() ? this.mEntry.ClientNumber : "141"; OnClientSelectedIndexChanged(null, EventArgs.Empty); if (!this.mEntry.IsVendorNumberNull() && this.mEntry.VendorNumber.Trim().Length > 0) { this.cboShipper.SelectedValue = this.mEntry.VendorNumber; } else { this.cboShipper.SelectedIndex = -1; this.cboShipper.Text = !this.mEntry.IsVendorNameNull() ? this.mEntry.VendorName : ""; this.txtAddressLine1.Text = !this.mEntry.IsVendorAddressLine1Null() ? this.mEntry.VendorAddressLine1 : ""; this.txtAddressLine2.Text = !this.mEntry.IsVendorAddressLine2Null() ? this.mEntry.VendorAddressLine2 : ""; this.txtCity.Text = !this.mEntry.IsVendorCityNull() ? this.mEntry.VendorCity : ""; this.txtState.Text = !this.mEntry.IsVendorStateNull() ? this.mEntry.VendorState : ""; this.txtZip.Text = !this.mEntry.IsVendorZipNull() ? this.mEntry.VendorZip : ""; this.txtZip4.Text = !this.mEntry.IsVendorZip4Null() ? this.mEntry.VendorZip4 : ""; } OnShipperAddressChanged(null, EventArgs.Empty); this.txtContactName.Text = !this.mEntry.IsContactNameNull() ? this.mEntry.ContactName : ""; this.txtContactPhone.Text = !this.mEntry.IsContactPhoneNull() ? this.mEntry.ContactPhone : ""; this.txtContactEmail.Text = !this.mEntry.IsContactEmailNull() ? this.mEntry.ContactEmail : ""; this.mtbOpen.Text = !this.mEntry.IsWindowOpenNull() ? this.mEntry.WindowOpen.ToString().PadLeft(4, '0') : ""; this.mtbClose.Text = !this.mEntry.IsWindowCloseNull() ? this.mEntry.WindowClose.ToString().PadLeft(4, '0') : ""; this.txtDescription.Text = !this.mEntry.IsDescriptionNull() ? this.mEntry.Description : ""; this.txtQuantity.Text = !this.mEntry.IsAmountNull() ? this.mEntry.Amount.ToString() : "0"; if (!this.mEntry.IsAmountTypeNull()) { this.cboContainer.Text = this.mEntry.AmountType; } else { this.cboContainer.SelectedIndex = 0; } this.txtWeight.Text = !this.mEntry.IsWeightNull() ? this.mEntry.Weight.ToString() : "0"; this.chkFullTrailer.Checked = !this.mEntry.IsIsFullTrailerNull() ? this.mEntry.IsFullTrailer : false; this.txtComments.Text = !this.mEntry.IsCommentsNull() ? this.mEntry.Comments : ""; this.cboClient.Focus(); } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); } finally { OnValidateForm(null, null); this.Cursor = Cursors.Default; } }
private void OnControlLoad(object sender, EventArgs e) { //Event handler for control load event this.Cursor = Cursors.WaitCursor; try { if (!this.DesignMode) { #region Grid customizations from normal layout (to support cell editing) this.grdTDSInfo.DisplayLayout.Override.RowSelectors = DefaultableBoolean.False; this.grdTDSInfo.DisplayLayout.Override.SelectTypeRow = SelectType.Single; this.grdTDSInfo.DisplayLayout.Override.SelectTypeCell = SelectType.Single; this.grdTDSInfo.DisplayLayout.TabNavigation = TabNavigation.NextCell; this.grdTDSInfo.DisplayLayout.Override.AllowAddNew = AllowAddNew.No; this.grdTDSInfo.DisplayLayout.Override.AllowDelete = DefaultableBoolean.False; this.grdTDSInfo.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False; this.grdTDSInfo.DisplayLayout.Override.MaxSelectedCells = 1; this.grdTDSInfo.DisplayLayout.Override.CellClickAction = CellClickAction.RowSelect; this.grdTDSInfo.DisplayLayout.Bands[0].Override.CellClickAction = CellClickAction.RowSelect; this.grdTDSInfo.DisplayLayout.Bands[0].Override.RowFilterMode = RowFilterMode.AllRowsInBand; #endregion this.dtpStartDate.MinDate = this.dtpEndDate.MinDate = DateTime.Today.AddDays(-90); this.dtpStartDate.MaxDate = this.dtpEndDate.MaxDate = DateTime.Today; this.dtpStartDate.Value = this.dtpEndDate.MinDate = DateTime.Today; this.mClients.Merge(FreightGateway.GetClients()); if (this.cboClient.Items.Count > 0) { this.cboClient.SelectedIndex = 0; } OnClientChanged(null, EventArgs.Empty); } } catch (Exception ex) { App.ReportError(new ApplicationException(ex.Message)); } finally { this.Cursor = Cursors.Default; } }
private void OnFormLoad(object sender, EventArgs e) { //Event handler for form load event this.Cursor = Cursors.WaitCursor; try { //Get lists this.bsClients.DataSource = FreightGateway.GetClients(); this.bsAgents.DataSource = FreightGateway.GetAgents(); //Load controls this.Text = "Pickup Request" + "(" + (this.mRequest.RequestID > 0 ? this.mRequest.RequestID.ToString() : "New") + (this.mIsTemplate ? " Template)" : ")"); this.lblRequestID.Text = this.mRequest.RequestID > 0 ? this.mRequest.RequestID.ToString("00000000") : ""; this.dtpScheduleDate.Value = !this.mRequest.IsScheduleDateNull() ? this.mRequest.ScheduleDate : DateTime.Today; if (!this.mRequest.IsClientNumberNull()) { this.cboClient.SelectedValue = this.mRequest.ClientNumber; } else { this.cboClient.SelectedIndex = -1; this.cboClient.Text = !this.mRequest.IsClientNull() ? this.mRequest.Client : ""; } this.txtCaller.Text = !this.mRequest.IsCallerNameNull() ? this.mRequest.CallerName : ""; if (!this.mRequest.IsShipperNumberNull() && this.mRequest.ShipperNumber.Trim().Length > 0) { this.cboShipper.SelectedValue = this.mRequest.ShipperNumber; } else { this.cboShipper.SelectedIndex = -1; this.cboShipper.Text = !this.mRequest.IsShipperNull() ? this.mRequest.Shipper : ""; this.txtShipperAddress.Text = !this.mRequest.IsShipperAddressNull() ? this.mRequest.ShipperAddress : ""; } OnShipperAddressChanged(null, EventArgs.Empty); this.txtShipperPhone.Text = !this.mRequest.IsShipperPhoneNull() ? this.mRequest.ShipperPhone : ""; this.mtbOpen.Text = !this.mRequest.IsWindowOpenNull() ? this.mRequest.WindowOpen.ToString().PadLeft(4, '0') : ""; this.mtbClose.Text = !this.mRequest.IsWindowCloseNull() ? this.mRequest.WindowClose.ToString().PadLeft(4, '0') : ""; if (!this.mRequest.IsTerminalNumberNull()) { this.cboTerminal.SelectedValue = this.mRequest.TerminalNumber.Trim(); } else { this.cboTerminal.SelectedIndex = -1; this.cboTerminal.Text = !this.mRequest.IsTerminalNull() ? this.mRequest.Terminal : ""; } OnTerminalSelectedIndexChanged(null, EventArgs.Empty); if (!this.mRequest.IsDriverNameNull()) { this.cboDriver.Text = this.mRequest.DriverName; } else { this.cboDriver.SelectedIndex = -1; } this.dtpActual.Checked = !this.mRequest.IsActualPickupNull(); if (this.dtpActual.Checked) { this.dtpActual.Value = this.mRequest.ActualPickup; } this.dtpActual.Enabled = true; this.cboOrderType.SelectedIndex = this.mRequest.OrderType == "B" ? 1 : 0; this.txtQuantity.Text = !this.mRequest.IsAmountNull() ? this.mRequest.Amount.ToString() : "0"; if (!this.mRequest.IsAmountTypeNull()) { this.cboContainer.Text = this.mRequest.AmountType; } else { this.cboContainer.SelectedIndex = 0; } this.cboFreightType.Text = !this.mRequest.IsFreightTypeNull() ? this.mRequest.FreightType : "Tsort"; this.txtWeight.Text = !this.mRequest.IsWeightNull() ? this.mRequest.Weight.ToString() : "0"; this.txtComments.Text = !this.mRequest.IsCommentsNull() ? this.mRequest.Comments : ""; this.cboClient.Focus(); } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); } finally { OnValidateForm(null, null); this.Cursor = Cursors.Default; } }