// 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();
            }
        }
Example #2
0
        public ActionResult ClientAddressEdit(
            System.Guid clientId
            )
        {
            ViewBag.ClientId = clientId;
            CrudeClientContract clientContract = new CrudeClientServiceClient().FetchByClientId(clientId);

            CrudeClientAddressContract addressContract;

            if (clientContract.ClientAddressId != Guid.Empty)
            {
                addressContract = new CrudeClientAddressServiceClient().FetchByClientAddressId(clientContract.ClientAddressId);
            }
            else
            {
                addressContract = new CrudeClientAddressContract();
            }

            ViewBag.ClientAddressTypeRcd =
                new SelectList(new CrudeClientAddressTypeRefServiceClient().FetchAll(),
                               "ClientAddressTypeRcd",
                               "ClientAddressTypeName",
                               addressContract.ClientAddressTypeRcd
                               );

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

            return(View(
                       MVCHelper.Resolve(Request, "Client", "ClientAddress", "ClientAddressEdit"),
                       addressContract
                       ));
        }
        public ActionResult CrudeClientAddressCreate([Bind()] CrudeClientAddressContract contract)
        {
            if (ModelState.IsValid)
            {
                new CrudeClientAddressServiceClient().Insert(contract);

                return(RedirectToAction("CrudeClientAddressIndex"));
            }

            return(View(
                       "~/Views/Crude/Client/CrudeClientAddress/CrudeClientAddressCreate.cshtml",
                       contract
                       ));
        }
        public ActionResult CrudeClientAddressEdit([Bind()] CrudeClientAddressContract contract)
        {
            if (ModelState.IsValid)
            {
                contract.DateTime = DateTime.UtcNow;

                new CrudeClientAddressServiceClient().Update(contract);

                return(RedirectToAction("CrudeClientAddressIndex"));
            }

            return(View(
                       "~/Views/Crude/Client/CrudeClientAddress/CrudeClientAddressEdit.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 CrudeClientAddressContract();
         _isNew     = true;
         this.Text += " - Not Savable (User Missing)";
         Show();
     } catch (Exception ex) {
         if (ex == null)
         {
         }
         else
         {
             System.Diagnostics.Debugger.Break();
         }
     }
 }
        // shows the form with default values for comboboxes and pickers
        // links:
        //  docLink: http://sql2x.org/documentationLink/f5685d96-a0bb-4f7b-beaa-b3d578c7cf28
        public void ShowAsAdd(System.Guid clientId, string clientAddressTypeRcd, string addressLineOneName, string addressLineTwoName, string addressLineThreeName, string cityName, string streetName, string stateName, string districtName, string provinceName, string zipCode, string poBox, string comment, System.Guid userId)
        {
            try {
                _contract                        = new CrudeClientAddressContract();
                _isNew                           = true;
                _contract.ClientId               = clientId;
                _contract.ClientAddressTypeRcd   = clientAddressTypeRcd;
                clientAddressTypeRefCombo.Text   = _contract.ClientAddressTypeRcd != null ? _contract.ClientAddressTypeRcd : String.Empty;
                _contract.AddressLineOneName     = addressLineOneName;
                textBoxAddressLineOneName.Text   = _contract.AddressLineOneName;
                _contract.AddressLineTwoName     = addressLineTwoName;
                textBoxAddressLineTwoName.Text   = _contract.AddressLineTwoName;
                _contract.AddressLineThreeName   = addressLineThreeName;
                textBoxAddressLineThreeName.Text = _contract.AddressLineThreeName;
                _contract.CityName               = cityName;
                textBoxCityName.Text             = _contract.CityName;
                _contract.StreetName             = streetName;
                textBoxStreetName.Text           = _contract.StreetName;
                _contract.StateName              = stateName;
                textBoxStateName.Text            = _contract.StateName;
                _contract.DistrictName           = districtName;
                textBoxDistrictName.Text         = _contract.DistrictName;
                _contract.ProvinceName           = provinceName;
                textBoxProvinceName.Text         = _contract.ProvinceName;
                _contract.ZipCode                = zipCode;
                textBoxZipCode.Text              = _contract.ZipCode;
                _contract.PoBox                  = poBox;
                textBoxPoBox.Text                = _contract.PoBox;
                _contract.Comment                = comment;
                textBoxComment.Text              = _contract.Comment;
                _contract.UserId                 = 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 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 CrudeClientAddressContract();
                _isNew                      = true;
                _contract.UserId            = userId;
                _contract.DateTime          = DateTime.UtcNow;
                dateTimePickerDateTime.Text = _contract.DateTime.ToString();

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }
        public ActionResult CrudeClientAddressCreate(System.Guid?clientId, System.Guid?userId)
        {
            var contract = new CrudeClientAddressContract();

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

            ViewBag.ClientAddressTypeRcd =
                new SelectList(new CrudeClientAddressTypeRefServiceClient().FetchAll(),
                               "ClientAddressTypeRcd",
                               "ClientAddressTypeName",
                               contract.ClientAddressTypeRcd
                               );

            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/Client/CrudeClientAddress/CrudeClientAddressCreate.cshtml",
                       contract
                       ));
        }
Example #9
0
        public ActionResult ClientAddressEdit(
            [Bind()] CrudeClientAddressContract contract,
            System.Guid clientId
            )
        {
            ViewBag.ClientId = clientId;

            if (ModelState.IsValid)
            {
                if (contract.ClientAddressId == Guid.Empty)
                {
                    // new address
                    contract.ClientAddressId = Guid.NewGuid();
                    contract.UserId          = new System.Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}");
                    contract.DateTime        = DateTime.UtcNow;

                    new CrudeClientAddressServiceClient().Insert(contract);

                    // update client
                    CrudeClientContract clientContract = new CrudeClientServiceClient().FetchByClientId(clientId);
                    clientContract.ClientAddressId = contract.ClientAddressId;
                    new CrudeClientServiceClient().Update(clientContract);
                }
                else
                {
                    new CrudeClientAddressServiceClient().Update(contract);
                }

                return(RedirectToAction("ClientAddressEdit", new { clientId = clientId }));
            }

            return(View(
                       MVCHelper.Resolve(Request, "Client", "ClientAddress", "ClientAddressEdit"),
                       contract
                       ));
        }