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

            _isNew = false;
            try {
                _contract = service.FetchByServicePackageId(servicePackageId);
                textBoxServicePackageName.Text = _contract.ServicePackageName;
                serviceSpecialServiceRequestPicker.SelectedValue = _contract.ServiceSpecialServiceRequestId;
                serviceCarRentalPicker.SelectedValue             = _contract.ServiceCarRentalId;
                departureAirportPicker.SelectedValue             = _contract.DepartureAirportId;
                arrivalAirportPicker.SelectedValue = _contract.ArrivalAirportId;
                maskedTextBoxStayDurationDays.Text = _contract.StayDurationDays.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
        // 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 servicePackageName, System.Guid serviceHotelId, System.Guid serviceSpecialServiceRequestId, System.Guid serviceCarRentalId, System.Guid departureAirportId, System.Guid arrivalAirportId, int stayDurationDays, System.Guid userId)
        {
            try {
                _contract = new CrudeServicePackageContract();
                _isNew    = true;
                _contract.ServicePackageName                     = servicePackageName;
                textBoxServicePackageName.Text                   = _contract.ServicePackageName;
                _contract.ServiceHotelId                         = serviceHotelId;
                _contract.ServiceSpecialServiceRequestId         = serviceSpecialServiceRequestId;
                serviceSpecialServiceRequestPicker.SelectedValue = _contract.ServiceSpecialServiceRequestId;
                _contract.ServiceCarRentalId                     = serviceCarRentalId;
                serviceCarRentalPicker.SelectedValue             = _contract.ServiceCarRentalId;
                _contract.DepartureAirportId                     = departureAirportId;
                departureAirportPicker.SelectedValue             = _contract.DepartureAirportId;
                _contract.ArrivalAirportId                       = arrivalAirportId;
                arrivalAirportPicker.SelectedValue               = _contract.ArrivalAirportId;
                _contract.StayDurationDays                       = stayDurationDays;
                maskedTextBoxStayDurationDays.Text               = _contract.StayDurationDays.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();
                }
            }
        }
예제 #3
0
        public ActionResult ServicePackageCreate([Bind()] CrudeServicePackageContract contract)
        {
            if (ModelState.IsValid)
            {
                new CrudeServicePackageServiceClient().Insert(contract);

                return(RedirectToAction("GetServicePackageIndex", new { servicePackageId = contract.ServicePackageId }));
            }

            return(View(
                       MVCHelper.Resolve(Request, "Service", "ServicePackage", "ServicePackageCreate"),
                       contract
                       ));
        }
        public ActionResult CrudeServicePackageCreate([Bind()] CrudeServicePackageContract contract)
        {
            if (ModelState.IsValid)
            {
                new CrudeServicePackageServiceClient().Insert(contract);

                return(RedirectToAction("CrudeServicePackageIndex"));
            }

            return(View(
                       "~/Views/Crude/Service/CrudeServicePackage/CrudeServicePackageCreate.cshtml",
                       contract
                       ));
        }
        public ActionResult CrudeServicePackageEdit([Bind()] CrudeServicePackageContract contract)
        {
            if (ModelState.IsValid)
            {
                contract.DateTime = DateTime.UtcNow;

                new CrudeServicePackageServiceClient().Update(contract);

                return(RedirectToAction("CrudeServicePackageIndex"));
            }

            return(View(
                       "~/Views/Crude/Service/CrudeServicePackage/CrudeServicePackageEdit.cshtml",
                       contract
                       ));
        }
예제 #6
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 CrudeServicePackageContract();
         _isNew    = true;
         Show();
     } catch (Exception ex) {
         if (ex == null)
         {
         }
         else
         {
             System.Diagnostics.Debugger.Break();
         }
     }
 }
예제 #7
0
        // shows by foreign keys
        // links:
        //  docLink: http://sql2x.org/documentationLink/f21e72c1-2d57-44c1-a9c1-1b80bad6a391
        public void ShowAsAddByServiceHotel(System.Guid serviceHotelId)
        {
            try {
                _contract                   = new CrudeServicePackageContract();
                _isNew                      = true;
                _contract.DateTime          = DateTime.UtcNow;
                dateTimePickerDateTime.Text = _contract.DateTime.ToString();
                _contract.ServiceHotelId    = serviceHotelId;

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }
예제 #8
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 CrudeServicePackageContract();
                _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();
                }
            }
        }
예제 #9
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 txtServicePackageCode_Validating(object sender, CancelEventArgs e)
        {
            if (!DesignMode)
            {
                // empty picker on no code
                if (string.IsNullOrEmpty(txtServicePackageCode.Text))
                {
                    _servicePackageId          = Guid.Empty;
                    txtServicePackageName.Text = string.Empty;
                    txtServicePackageCode.Text = string.Empty;
                    return;
                }

                CrudeServicePackageServiceClient servicePackage = null;

                try {
                    servicePackage = new CrudeServicePackageServiceClient();
                    CrudeServicePackageContract contract = servicePackage.FetchByServicePackageName(txtServicePackageCode.Text);

                    if (contract != null)
                    {
                        txtServicePackageCode.Text = contract.ServicePackageName;
                        txtServicePackageName.Text = contract.ServicePackageName;
                        _servicePackageId          = contract.ServicePackageId;
                    }
                } catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                } finally {
                    if (servicePackage != null)
                    {
                        servicePackage.Close();
                    }
                }

                if (this.Picked != null)
                {
                    this.Picked(new object(), new EventArgs());
                }
            }
        }
예제 #10
0
        public ActionResult ServicePackageCreate(System.Guid?serviceHotelId, System.Guid?serviceSpecialServiceRequestId, System.Guid?serviceCarRentalId, System.Guid?departureAirportId, System.Guid?arrivalAirportId, System.Guid?userId)
        {
            var contract = new CrudeServicePackageContract();

            if (serviceHotelId != null)
            {
                contract.ServiceHotelId = (System.Guid)serviceHotelId;
            }
            if (serviceSpecialServiceRequestId != null)
            {
                contract.ServiceSpecialServiceRequestId = (System.Guid)serviceSpecialServiceRequestId;
            }
            if (serviceCarRentalId != null)
            {
                contract.ServiceCarRentalId = (System.Guid)serviceCarRentalId;
            }
            if (departureAirportId != null)
            {
                contract.DepartureAirportId = (System.Guid)departureAirportId;
            }
            if (arrivalAirportId != null)
            {
                contract.ArrivalAirportId = (System.Guid)arrivalAirportId;
            }
            if (userId != null)
            {
                contract.UserId = (System.Guid)userId;
            }

            ViewBag.ServiceHotelId =
                new SelectList(new CrudeServiceHotelServiceClient().FetchAll(),
                               "ServiceHotelId",
                               "HotelName",
                               contract.ServiceHotelId
                               );

            ViewBag.ServiceSpecialServiceRequestId =
                new SelectList(new CrudeServiceSpecialServiceRequestServiceClient().FetchAll(),
                               "ServiceSpecialServiceRequestId",
                               "ServiceSpecialServiceRequestName",
                               contract.ServiceSpecialServiceRequestId
                               );

            ViewBag.ServiceCarRentalId =
                new SelectList(new CrudeServiceCarRentalServiceClient().FetchAll(),
                               "ServiceCarRentalId",
                               "CarName",
                               contract.ServiceCarRentalId
                               );

            ViewBag.DepartureAirportId =
                new SelectList(new CrudeAirportServiceClient().FetchAll(),
                               "AirportId",
                               "AirportName",
                               contract.DepartureAirportId
                               );

            ViewBag.ArrivalAirportId =
                new SelectList(new CrudeAirportServiceClient().FetchAll(),
                               "AirportId",
                               "AirportName",
                               contract.ArrivalAirportId
                               );

            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(
                       MVCHelper.Resolve(Request, "Service", "ServicePackage", "ServicePackageCreate"),
                       contract
                       ));
        }