コード例 #1
0
        // shows the form in edit modus
        // links:
        //  docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77
        public void ShowAsEdit(System.Guid clientAddressId)
        {
            var service = new CrudeClientAddressServiceClient();

            _isNew = false;
            try {
                _contract = service.FetchByClientAddressId(clientAddressId);
                clientAddressTypeRefCombo.Text   = _contract.ClientAddressTypeRcd != null ? _contract.ClientAddressTypeRcd : String.Empty;
                textBoxAddressLineOneName.Text   = _contract.AddressLineOneName;
                textBoxAddressLineTwoName.Text   = _contract.AddressLineTwoName;
                textBoxAddressLineThreeName.Text = _contract.AddressLineThreeName;
                textBoxCityName.Text             = _contract.CityName;
                textBoxStreetName.Text           = _contract.StreetName;
                textBoxStateName.Text            = _contract.StateName;
                textBoxDistrictName.Text         = _contract.DistrictName;
                textBoxProvinceName.Text         = _contract.ProvinceName;
                textBoxZipCode.Text         = _contract.ZipCode;
                textBoxPoBox.Text           = _contract.PoBox;
                textBoxComment.Text         = _contract.Comment;
                _contract.DateTime          = DateTime.UtcNow;
                dateTimePickerDateTime.Text = _contract.DateTime.ToString();

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            } finally {
                service.Close();
            }
        }
コード例 #2
0
        // refresh the grid
        // links:
        //  docLink: http://sql2x.org/documentationLink/a90065e7-8ace-4de7-9367-d4653a7c637f
        public void RefreshCrudeClientAddress()
        {
            var clientAddress = new CrudeClientAddressServiceClient();

            try {
                var bindingSource = new BindingSource();
                bindingSource.DataSource = clientAddress.FetchWithFilter(
                    Guid.Empty
                    , Guid.Empty
                    , clientAddressTypeRefCombo.Text
                    , textBoxAddressLineOneName.Text
                    , textBoxAddressLineTwoName.Text
                    , textBoxAddressLineThreeName.Text
                    , textBoxCityName.Text
                    , textBoxStreetName.Text
                    , textBoxStateName.Text
                    , textBoxDistrictName.Text
                    , textBoxProvinceName.Text
                    , textBoxZipCode.Text
                    , textBoxPoBox.Text
                    , textBoxComment.Text
                    , Guid.Empty
                    , DateTime.MinValue
                    );
                dataGridViewCrudeClientAddress.AutoGenerateColumns = false;
                dataGridViewCrudeClientAddress.DataSource          = bindingSource;
                dataGridViewCrudeClientAddress.AutoResizeColumns();
                dataGridViewCrudeClientAddress.Refresh();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            } finally {
                clientAddress.Close();
            }
        }
コード例 #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 CrudeClientAddressServiceClient();

            try {
                _contract.ClientAddressTypeRcd = clientAddressTypeRefCombo.Text;
                _contract.AddressLineOneName   = textBoxAddressLineOneName.Text;
                _contract.AddressLineTwoName   = textBoxAddressLineTwoName.Text;
                _contract.AddressLineThreeName = textBoxAddressLineThreeName.Text;
                _contract.CityName             = textBoxCityName.Text;
                _contract.StreetName           = textBoxStreetName.Text;
                _contract.StateName            = textBoxStateName.Text;
                _contract.DistrictName         = textBoxDistrictName.Text;
                _contract.ProvinceName         = textBoxProvinceName.Text;
                _contract.ZipCode = textBoxZipCode.Text;
                _contract.PoBox   = textBoxPoBox.Text;
                _contract.Comment = textBoxComment.Text;

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

            Close();
        }