Exemplo n.º 1
0
        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; }
        }