Ejemplo n.º 1
0
        // refresh the grid
        // links:
        //  docLink: http://sql2x.org/documentationLink/a90065e7-8ace-4de7-9367-d4653a7c637f
        public void RefreshCrudeAircraftMeasurement()
        {
            var aircraftMeasurement = new CrudeAircraftMeasurementServiceClient();

            try {
                var bindingSource = new BindingSource();
                bindingSource.DataSource = aircraftMeasurement.FetchWithFilter(
                    Guid.Empty
                    , maskedTextBoxLength.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxLength.Text)
                    , maskedTextBoxHeight.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxHeight.Text)
                    , maskedTextBoxWeight.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxWeight.Text)
                    , maskedTextBoxWingspan.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxWingspan.Text)
                    , maskedTextBoxWidth.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxWidth.Text)
                    , maskedTextBoxPayload.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxPayload.Text)
                    , maskedTextBoxTakeoffWeightInKilo.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxTakeoffWeightInKilo.Text)
                    , maskedTextBoxSpeed.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxSpeed.Text)
                    , Guid.Empty
                    , DateTime.MinValue
                    );
                dataGridViewCrudeAircraftMeasurement.AutoGenerateColumns = false;
                dataGridViewCrudeAircraftMeasurement.DataSource          = bindingSource;
                dataGridViewCrudeAircraftMeasurement.AutoResizeColumns();
                dataGridViewCrudeAircraftMeasurement.Refresh();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            } finally {
                aircraftMeasurement.Close();
            }
        }
Ejemplo n.º 2
0
        // shows the form in edit modus
        // links:
        //  docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77
        public void ShowAsEdit(System.Guid aircraftMeasurementId)
        {
            var service = new CrudeAircraftMeasurementServiceClient();

            _isNew = false;
            try {
                _contract = service.FetchByAircraftMeasurementId(aircraftMeasurementId);
                maskedTextBoxLength.Text              = _contract.Length.ToString();
                maskedTextBoxHeight.Text              = _contract.Height.ToString();
                maskedTextBoxWeight.Text              = _contract.Weight.ToString();
                maskedTextBoxWingspan.Text            = _contract.Wingspan.ToString();
                maskedTextBoxWidth.Text               = _contract.Width.ToString();
                maskedTextBoxPayload.Text             = _contract.Payload.ToString();
                maskedTextBoxTakeoffWeightInKilo.Text = _contract.TakeoffWeightInKilo.ToString();
                maskedTextBoxSpeed.Text               = _contract.Speed.ToString();
                userPicker.SelectedValue              = _contract.UserId;
                _contract.DateTime          = DateTime.UtcNow;
                dateTimePickerDateTime.Text = _contract.DateTime.ToString();

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            } finally {
                service.Close();
            }
        }
Ejemplo n.º 3
0
        // saves the form
        // links:
        //  docLink: http://sql2x.org/documentationLink/c9522930-91f8-4468-a936-8030bb2a6482
        private void buttonSave_Click(object sender, EventArgs e)
        {
            var service = new CrudeAircraftMeasurementServiceClient();

            try {
                _contract.Length              = maskedTextBoxLength.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxLength.Text);
                _contract.Height              = maskedTextBoxHeight.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxHeight.Text);
                _contract.Weight              = maskedTextBoxWeight.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxWeight.Text);
                _contract.Wingspan            = maskedTextBoxWingspan.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxWingspan.Text);
                _contract.Width               = maskedTextBoxWidth.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxWidth.Text);
                _contract.Payload             = maskedTextBoxPayload.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxPayload.Text);
                _contract.TakeoffWeightInKilo = maskedTextBoxTakeoffWeightInKilo.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxTakeoffWeightInKilo.Text);
                _contract.Speed               = maskedTextBoxSpeed.Text == String.Empty ? 0 : Convert.ToDecimal(maskedTextBoxSpeed.Text);
                _contract.UserId              = (Guid)userPicker.SelectedValue;

                if (_isNew)
                {
                    service.Insert(_contract);
                }
                else
                {
                    service.Update(_contract);
                }
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            } finally {
                service.Close();
            }

            Close();
        }