// refresh the grid
        // links:
        //  docLink: http://sql2x.org/documentationLink/a90065e7-8ace-4de7-9367-d4653a7c637f
        public void RefreshCrudeClientDocumentTypeRef()
        {
            var clientDocumentTypeRef = new CrudeClientDocumentTypeRefServiceClient();

            try {
                var bindingSource = new BindingSource();
                bindingSource.DataSource = clientDocumentTypeRef.FetchWithFilter(
                    textBoxClientDocumentType.Text
                    , textBoxClientDocumentTypeName.Text
                    , textBoxClientDocumentTypeDescription.Text
                    , Convert.ToBoolean(checkBoxActiveFlag.Checked)
                    , maskedTextBoxSortOrder.Text == String.Empty ? 0 : Convert.ToInt32(maskedTextBoxSortOrder.Text)
                    , Guid.Empty
                    , DateTime.MinValue
                    );
                dataGridViewCrudeClientDocumentTypeRef.AutoGenerateColumns = false;
                dataGridViewCrudeClientDocumentTypeRef.DataSource          = bindingSource;
                dataGridViewCrudeClientDocumentTypeRef.AutoResizeColumns();
                dataGridViewCrudeClientDocumentTypeRef.Refresh();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            } finally {
                clientDocumentTypeRef.Close();
            }
        }
        // shows the form in edit modus
        // links:
        //  docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77
        public void ShowAsEdit(string clientDocumentTypeRcd, System.Guid userId)
        {
            var service = new CrudeClientDocumentTypeRefServiceClient();

            _isNew = false;
            try {
                _contract = service.FetchByClientDocumentTypeRcd(clientDocumentTypeRcd);
                textBoxClientDocumentType.Text            = _contract.ClientDocumentTypeRcd;
                textBoxClientDocumentTypeName.Text        = _contract.ClientDocumentTypeName;
                textBoxClientDocumentTypeDescription.Text = _contract.ClientDocumentTypeDescription;
                checkBoxActiveFlag.Checked  = _contract.ActiveFlag;
                maskedTextBoxSortOrder.Text = _contract.SortOrder.ToString();
                _contract.UserId            = 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();
            }
        }
        // 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 CrudeClientDocumentTypeRefServiceClient();

            try {
                _contract.ClientDocumentTypeRcd         = textBoxClientDocumentType.Text;
                _contract.ClientDocumentTypeName        = textBoxClientDocumentTypeName.Text;
                _contract.ClientDocumentTypeDescription = textBoxClientDocumentTypeDescription.Text;
                _contract.ActiveFlag = Convert.ToBoolean(checkBoxActiveFlag.Checked);
                _contract.SortOrder  = maskedTextBoxSortOrder.Text == String.Empty ? 0 : Convert.ToInt32(maskedTextBoxSortOrder.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();
        }
示例#4
0
        // fetch all rows from the SOAP layer and populate the ComboBox with it
        public void PopulateCombo()
        {
            if (!DesignMode && cboRef.DataSource == null)
            {
                CrudeClientDocumentTypeRefServiceClient clientDocumentTypeRef = null;

                try {
                    clientDocumentTypeRef = new CrudeClientDocumentTypeRefServiceClient();
                    List <CrudeClientDocumentTypeRefContract> contracts = clientDocumentTypeRef.FetchAll();

                    cboRef.DataSource    = contracts;
                    cboRef.DisplayMember = "ClientDocumentTypeName";
                    cboRef.ValueMember   = "ClientDocumentTypeRcd";
                } catch (Exception ex) {
                    if (ex != null)
                    {
                    }
                } finally {
                    if (clientDocumentTypeRef != null)
                    {
                        clientDocumentTypeRef.Close();
                    }
                }
            }
        }