// shows the form in edit modus
        // links:
        //  docLink: http://sql2x.org/documentationLink/49afd26c-4f21-4992-967b-be190eacef77
        public void ShowAsEdit(System.Guid aircraftMeasurementId)
        {
            var service = new CrudeAircraftMeasurementServiceClient();

            _isNew = false;
            try {
                _contract = service.FetchByAircraftMeasurementId(aircraftMeasurementId);
                maskedTextBoxLength.Text              = _contract.Length.ToString();
                maskedTextBoxHeight.Text              = _contract.Height.ToString();
                maskedTextBoxWeight.Text              = _contract.Weight.ToString();
                maskedTextBoxWingspan.Text            = _contract.Wingspan.ToString();
                maskedTextBoxWidth.Text               = _contract.Width.ToString();
                maskedTextBoxPayload.Text             = _contract.Payload.ToString();
                maskedTextBoxTakeoffWeightInKilo.Text = _contract.TakeoffWeightInKilo.ToString();
                maskedTextBoxSpeed.Text               = _contract.Speed.ToString();
                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();
            }
        }
示例#2
0
        public ActionResult CrudeAircraftMeasurementCreate(System.Guid?userId)
        {
            var contract = new CrudeAircraftMeasurementContract();

            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/Aircraft/CrudeAircraftMeasurement/CrudeAircraftMeasurementCreate.cshtml",
                       contract
                       ));
        }
示例#3
0
        public ActionResult CrudeAircraftMeasurementCreate([Bind()] CrudeAircraftMeasurementContract contract)
        {
            if (ModelState.IsValid)
            {
                new CrudeAircraftMeasurementServiceClient().Insert(contract);

                return(RedirectToAction("CrudeAircraftMeasurementIndex"));
            }

            return(View(
                       "~/Views/Crude/Aircraft/CrudeAircraftMeasurement/CrudeAircraftMeasurementCreate.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 CrudeAircraftMeasurementContract();
         _isNew    = true;
         Show();
     } catch (Exception ex) {
         if (ex == null)
         {
         }
         else
         {
             System.Diagnostics.Debugger.Break();
         }
     }
 }
示例#5
0
        public ActionResult CrudeAircraftMeasurementEdit([Bind()] CrudeAircraftMeasurementContract contract)
        {
            if (ModelState.IsValid)
            {
                contract.DateTime = DateTime.UtcNow;

                new CrudeAircraftMeasurementServiceClient().Update(contract);

                return(RedirectToAction("CrudeAircraftMeasurementIndex"));
            }

            return(View(
                       "~/Views/Crude/Aircraft/CrudeAircraftMeasurement/CrudeAircraftMeasurementEdit.cshtml",
                       contract
                       ));
        }
        // 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 CrudeAircraftMeasurementContract();
                _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();
                }
            }
        }
        public ActionResult AircraftMeasurementEdit(
            [Bind()] CrudeAircraftMeasurementContract contract,
            System.Guid aircraftId
            )
        {
            ViewBag.AircraftId = aircraftId;

            if (ModelState.IsValid)
            {
                contract.DateTime = DateTime.UtcNow;

                if (contract.AircraftMeasurementId == Guid.Empty)
                {
                    // insert right-side entity
                    contract.AircraftMeasurementId = Guid.NewGuid();
                    contract.UserId = new System.Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}");
                    new CrudeAircraftMeasurementServiceClient().Insert(contract);

                    // update left-side with right-side id
                    CrudeAircraftContract aircraftContract = new CrudeAircraftServiceClient().FetchByAircraftId(aircraftId);
                    aircraftContract.AircraftMeasurementId = contract.AircraftMeasurementId;
                    aircraftContract.DateTime = DateTime.UtcNow;
                    aircraftContract.UserId   = new System.Guid("{FFFFFFFF-5555-5555-5555-FFFFFFFFFFFF}");
                    new CrudeAircraftServiceClient().Update(aircraftContract);
                }
                else
                {
                    // update right-side entity
                    new CrudeAircraftMeasurementServiceClient().Update(contract);
                }
            }

            return(View(
                       "~/Views/Templates/Aircraft/AircraftMeasurement/AircraftMeasurementEdit.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(decimal length, decimal height, decimal weight, decimal wingspan, decimal width, decimal payload, decimal takeoffWeightInKilo, decimal speed, System.Guid userId)
        {
            try {
                _contract                             = new CrudeAircraftMeasurementContract();
                _isNew                                = true;
                _contract.Length                      = length;
                maskedTextBoxLength.Text              = _contract.Length.ToString();
                _contract.Height                      = height;
                maskedTextBoxHeight.Text              = _contract.Height.ToString();
                _contract.Weight                      = weight;
                maskedTextBoxWeight.Text              = _contract.Weight.ToString();
                _contract.Wingspan                    = wingspan;
                maskedTextBoxWingspan.Text            = _contract.Wingspan.ToString();
                _contract.Width                       = width;
                maskedTextBoxWidth.Text               = _contract.Width.ToString();
                _contract.Payload                     = payload;
                maskedTextBoxPayload.Text             = _contract.Payload.ToString();
                _contract.TakeoffWeightInKilo         = takeoffWeightInKilo;
                maskedTextBoxTakeoffWeightInKilo.Text = _contract.TakeoffWeightInKilo.ToString();
                _contract.Speed                       = speed;
                maskedTextBoxSpeed.Text               = _contract.Speed.ToString();
                _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();
                }
            }
        }