public ActionResult CrudeExternalSystemCreate(System.Guid?userId)
        {
            var contract = new CrudeExternalSystemContract();

            if (userId != null)
            {
                contract.UserId = (System.Guid)userId;
            }

            if (userId == null)
            {
                contract.UserId = new System.Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}");
            }

            ViewBag.DefaultUserName =
                new CrudeDefaultUserServiceClient().FetchByDefaultUserId(contract.UserId).DefaultUserName;

            contract.DateTime = DateTime.UtcNow;


            return(View(
                       "~/Views/Crude/External/CrudeExternalSystem/CrudeExternalSystemCreate.cshtml",
                       contract
                       ));
        }
        // shows the form with default values for comboboxes and pickers
        // links:
        //  docLink: http://sql2x.org/documentationLink/f5685d96-a0bb-4f7b-beaa-b3d578c7cf28
        public void ShowAsAdd(string externalSystemCode, string externalSystemName, System.Guid userId)
        {
            try {
                _contract = new CrudeExternalSystemContract();
                _isNew    = true;
                _contract.ExternalSystemCode   = externalSystemCode;
                textBoxExternalSystemCode.Text = _contract.ExternalSystemCode;
                _contract.ExternalSystemName   = externalSystemName;
                textBoxExternalSystemName.Text = _contract.ExternalSystemName;
                _contract.UserId            = userId;
                userPicker.SelectedValue    = userId;
                _contract.DateTime          = DateTime.UtcNow;
                dateTimePickerDateTime.Text = _contract.DateTime.ToString();

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }
        // shows the form in edit modus
        // links:
        //  docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77
        public void ShowAsEdit(System.Guid externalSystemId)
        {
            var service = new CrudeExternalSystemServiceClient();

            _isNew = false;
            try {
                _contract = service.FetchByExternalSystemId(externalSystemId);
                textBoxExternalSystemCode.Text = _contract.ExternalSystemCode;
                textBoxExternalSystemName.Text = _contract.ExternalSystemName;
                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();
            }
        }
        public ActionResult CrudeExternalSystemCreate([Bind()] CrudeExternalSystemContract contract)
        {
            if (ModelState.IsValid)
            {
                new CrudeExternalSystemServiceClient().Insert(contract);

                return(RedirectToAction("CrudeExternalSystemIndex"));
            }

            return(View(
                       "~/Views/Crude/External/CrudeExternalSystem/CrudeExternalSystemCreate.cshtml",
                       contract
                       ));
        }
        public ActionResult CrudeExternalSystemEdit([Bind()] CrudeExternalSystemContract contract)
        {
            if (ModelState.IsValid)
            {
                contract.DateTime = DateTime.UtcNow;

                new CrudeExternalSystemServiceClient().Update(contract);

                return(RedirectToAction("CrudeExternalSystemIndex"));
            }

            return(View(
                       "~/Views/Crude/External/CrudeExternalSystem/CrudeExternalSystemEdit.cshtml",
                       contract
                       ));
        }
 // shows the form with default values for comboboxes and pickers
 // links:
 //  docLink: http://sql2x.org/documentationLink/e04d0806-55ef-41cc-8669-acf0ddd850c7
 public void ShowAsAdd()
 {
     try {
         _contract = new CrudeExternalSystemContract();
         _isNew    = true;
         Show();
     } catch (Exception ex) {
         if (ex == null)
         {
         }
         else
         {
             System.Diagnostics.Debugger.Break();
         }
     }
 }
Exemple #7
0
        // populates the Picker with the first match from the SOAP service
        // links:
        //  docLink: http://sql2x.org/documentationLink/3e8b9e1a-39eb-444f-9632-ce3406db3534
        private void txtExternalSystemCode_Validating(object sender, CancelEventArgs e)
        {
            if (!DesignMode)
            {
                // empty picker on no code
                if (string.IsNullOrEmpty(txtExternalSystemCode.Text))
                {
                    _externalSystemId          = Guid.Empty;
                    txtExternalSystemName.Text = string.Empty;
                    txtExternalSystemCode.Text = string.Empty;
                    return;
                }

                CrudeExternalSystemServiceClient externalSystem = null;

                try {
                    externalSystem = new CrudeExternalSystemServiceClient();
                    CrudeExternalSystemContract contract = externalSystem.FetchByExternalSystemCode(txtExternalSystemCode.Text);

                    if (contract != null)
                    {
                        txtExternalSystemCode.Text = contract.ExternalSystemCode;
                        txtExternalSystemName.Text = contract.ExternalSystemName;
                        _externalSystemId          = contract.ExternalSystemId;
                    }
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                } finally {
                    if (externalSystem != null)
                    {
                        externalSystem.Close();
                    }
                }

                if (this.Picked != null)
                {
                    this.Picked(new object(), new EventArgs());
                }
            }
        }