public ActionResult CrudeAddressCreate(System.Guid?userId)
        {
            var contract = new CrudeAddressContract();

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

            ViewBag.AddressTypeRcd =
                new SelectList(new CrudeAddressTypeRefServiceClient().FetchAll(),
                               "AddressTypeRcd",
                               "AddressTypeName",
                               contract.AddressTypeRcd
                               );

            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/Address/CrudeAddress/CrudeAddressCreate.cshtml",
                       contract
                       ));
        }
        public ActionResult CrudeAddressCreate([Bind()] CrudeAddressContract contract)
        {
            if (ModelState.IsValid)
            {
                new CrudeAddressServiceClient().Insert(contract);

                return(RedirectToAction("CrudeAddressIndex"));
            }

            return(View(
                       "~/Views/Crude/Address/CrudeAddress/CrudeAddressCreate.cshtml",
                       contract
                       ));
        }
        public ActionResult CrudeAddressEdit([Bind()] CrudeAddressContract contract)
        {
            if (ModelState.IsValid)
            {
                contract.DateTime = DateTime.UtcNow;

                new CrudeAddressServiceClient().Update(contract);

                return(RedirectToAction("CrudeAddressIndex"));
            }

            return(View(
                       "~/Views/Crude/Address/CrudeAddress/CrudeAddressEdit.cshtml",
                       contract
                       ));
        }
Exemple #4
0
 // 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 CrudeAddressContract();
         _isNew    = true;
         Show();
     } catch (Exception ex) {
         if (ex == null)
         {
         }
         else
         {
             System.Diagnostics.Debugger.Break();
         }
     }
 }
Exemple #5
0
        // 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 addressTypeRcd, string addressOne, string addressTwo, string addressThree, string city, string street, string state, string district, string province, string zipCode, string poBox, string comment, System.Guid userId)
        {
            try {
                _contract = new CrudeAddressContract();
                _isNew    = true;
                _contract.AddressTypeRcd    = addressTypeRcd;
                addressTypeRefCombo.Text    = _contract.AddressTypeRcd != null ? _contract.AddressTypeRcd : String.Empty;
                _contract.AddressOne        = addressOne;
                textBoxAddressOne.Text      = _contract.AddressOne;
                _contract.AddressTwo        = addressTwo;
                textBoxAddressTwo.Text      = _contract.AddressTwo;
                _contract.AddressThree      = addressThree;
                textBoxAddressThree.Text    = _contract.AddressThree;
                _contract.City              = city;
                textBoxCity.Text            = _contract.City;
                _contract.Street            = street;
                textBoxStreet.Text          = _contract.Street;
                _contract.State             = state;
                textBoxState.Text           = _contract.State;
                _contract.District          = district;
                textBoxDistrict.Text        = _contract.District;
                _contract.Province          = province;
                textBoxProvince.Text        = _contract.Province;
                _contract.ZipCode           = zipCode;
                textBoxZipCode.Text         = _contract.ZipCode;
                _contract.PoBox             = poBox;
                textBoxPoBox.Text           = _contract.PoBox;
                _contract.Comment           = comment;
                textBoxComment.Text         = _contract.Comment;
                _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();
                }
            }
        }
Exemple #6
0
        // shows by foreign keys
        // links:
        //  docLink: http://sql2x.org/documentationLink/f21e72c1-2d57-44c1-a9c1-1b80bad6a391
        public void ShowAsAddByAddressType(string addressTypeRcd)
        {
            try {
                _contract                   = new CrudeAddressContract();
                _isNew                      = true;
                _contract.DateTime          = DateTime.UtcNow;
                dateTimePickerDateTime.Text = _contract.DateTime.ToString();
                _contract.AddressTypeRcd    = addressTypeRcd;
                addressTypeRefCombo.Text    = _contract.AddressTypeRcd != null ? _contract.AddressTypeRcd : String.Empty;

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }
Exemple #7
0
        // shows the form with default values for comboboxes and pickers
        // links:
        //  docLink: http://sql2x.org/documentationLink/599dcb45-f71b-4672-bb18-46975a4fe9b3
        public void ShowAsAddByRules(System.Guid userId)
        {
            try {
                _contract                   = new CrudeAddressContract();
                _isNew                      = true;
                _contract.UserId            = userId;
                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();
                }
            }
        }
Exemple #8
0
        // shows the form in edit modus
        // links:
        //  docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77
        public void ShowAsEdit(System.Guid addressId)
        {
            var service = new CrudeAddressServiceClient();

            _isNew = false;
            try {
                _contract = service.FetchByAddressId(addressId);
                addressTypeRefCombo.Text    = _contract.AddressTypeRcd != null ? _contract.AddressTypeRcd : String.Empty;
                textBoxAddressOne.Text      = _contract.AddressOne;
                textBoxAddressTwo.Text      = _contract.AddressTwo;
                textBoxAddressThree.Text    = _contract.AddressThree;
                textBoxCity.Text            = _contract.City;
                textBoxStreet.Text          = _contract.Street;
                textBoxState.Text           = _contract.State;
                textBoxDistrict.Text        = _contract.District;
                textBoxProvince.Text        = _contract.Province;
                textBoxZipCode.Text         = _contract.ZipCode;
                textBoxPoBox.Text           = _contract.PoBox;
                textBoxComment.Text         = _contract.Comment;
                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();
            }
        }