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

            _isNew = false;
            try {
                _contract = service.FetchByFinancialFareId(financialFareId);
                financialFareTypeRefCombo.Text                 = _contract.FinancialFareTypeRcd != null ? _contract.FinancialFareTypeRcd : String.Empty;
                departureAirportPicker.SelectedValue           = _contract.DepartureAirportId;
                arrivalAirportPicker.SelectedValue             = _contract.ArrivalAirportId;
                dateTimePickerValidFromFlightDateTime.Value    = _contract.ValidFromFlightDateTime != DateTime.MinValue ? _contract.ValidFromFlightDateTime : dateTimePickerValidFromFlightDateTime.MinDate;
                dateTimePickerValidFromFlightDateTime.Checked  = _contract.ValidFromFlightDateTime != DateTime.MinValue;
                dateTimePickerValidUntilFlightDateTime.Value   = _contract.ValidUntilFlightDateTime != DateTime.MinValue ? _contract.ValidUntilFlightDateTime : dateTimePickerValidUntilFlightDateTime.MinDate;
                dateTimePickerValidUntilFlightDateTime.Checked = _contract.ValidUntilFlightDateTime != DateTime.MinValue;
                maskedTextBoxAmount.Text = _contract.Amount.ToString();
                financialCurrencyPicker.SelectedValue = _contract.FinancialCurrencyId;
                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();
            }
        }
Example #2
0
        public ActionResult CrudeFinancialFareCreate([Bind()] CrudeFinancialFareContract contract)
        {
            if (ModelState.IsValid)
            {
                new CrudeFinancialFareServiceClient().Insert(contract);

                return(RedirectToAction("CrudeFinancialFareIndex"));
            }

            return(View(
                       "~/Views/Crude/Financial/CrudeFinancialFare/CrudeFinancialFareCreate.cshtml",
                       contract
                       ));
        }
Example #3
0
        public ActionResult CrudeFinancialFareEdit([Bind()] CrudeFinancialFareContract contract)
        {
            if (ModelState.IsValid)
            {
                contract.DateTime = DateTime.UtcNow;

                new CrudeFinancialFareServiceClient().Update(contract);

                return(RedirectToAction("CrudeFinancialFareIndex"));
            }

            return(View(
                       "~/Views/Crude/Financial/CrudeFinancialFare/CrudeFinancialFareEdit.cshtml",
                       contract
                       ));
        }
Example #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 CrudeFinancialFareContract();
         _isNew    = true;
         Show();
     } catch (Exception ex) {
         if (ex == null)
         {
         }
         else
         {
             System.Diagnostics.Debugger.Break();
         }
     }
 }
Example #5
0
        // shows by foreign keys
        // links:
        //  docLink: http://sql2x.org/documentationLink/f21e72c1-2d57-44c1-a9c1-1b80bad6a391
        public void ShowAsAddByFinancialFareType(string financialFareTypeRcd)
        {
            try {
                _contract                      = new CrudeFinancialFareContract();
                _isNew                         = true;
                _contract.DateTime             = DateTime.UtcNow;
                dateTimePickerDateTime.Text    = _contract.DateTime.ToString();
                _contract.FinancialFareTypeRcd = financialFareTypeRcd;
                financialFareTypeRefCombo.Text = _contract.FinancialFareTypeRcd != null ? _contract.FinancialFareTypeRcd : String.Empty;

                Show();
            } catch (Exception ex) {
                if (ex == null)
                {
                }
                else
                {
                    System.Diagnostics.Debugger.Break();
                }
            }
        }
Example #6
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 CrudeFinancialFareContract();
                _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();
                }
            }
        }
Example #7
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 financialFareTypeRcd, System.Guid departureAirportId, System.Guid arrivalAirportId, System.DateTime validFromFlightDateTime, System.DateTime validUntilFlightDateTime, decimal amount, System.Guid financialCurrencyId, System.Guid userId)
        {
            try {
                _contract = new CrudeFinancialFareContract();
                _isNew    = true;
                _contract.FinancialFareTypeRcd                 = financialFareTypeRcd;
                financialFareTypeRefCombo.Text                 = _contract.FinancialFareTypeRcd != null ? _contract.FinancialFareTypeRcd : String.Empty;
                _contract.DepartureAirportId                   = departureAirportId;
                departureAirportPicker.SelectedValue           = _contract.DepartureAirportId;
                _contract.ArrivalAirportId                     = arrivalAirportId;
                arrivalAirportPicker.SelectedValue             = _contract.ArrivalAirportId;
                _contract.ValidFromFlightDateTime              = validFromFlightDateTime;
                dateTimePickerValidFromFlightDateTime.Value    = _contract.ValidFromFlightDateTime != DateTime.MinValue ? _contract.ValidFromFlightDateTime : dateTimePickerValidFromFlightDateTime.MinDate;
                dateTimePickerValidFromFlightDateTime.Checked  = _contract.ValidFromFlightDateTime != DateTime.MinValue;
                _contract.ValidUntilFlightDateTime             = validUntilFlightDateTime;
                dateTimePickerValidUntilFlightDateTime.Value   = _contract.ValidUntilFlightDateTime != DateTime.MinValue ? _contract.ValidUntilFlightDateTime : dateTimePickerValidUntilFlightDateTime.MinDate;
                dateTimePickerValidUntilFlightDateTime.Checked = _contract.ValidUntilFlightDateTime != DateTime.MinValue;
                _contract.Amount                      = amount;
                maskedTextBoxAmount.Text              = _contract.Amount.ToString();
                _contract.FinancialCurrencyId         = financialCurrencyId;
                financialCurrencyPicker.SelectedValue = _contract.FinancialCurrencyId;
                _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();
                }
            }
        }
Example #8
0
        public ActionResult CrudeFinancialFareCreate(System.Guid?departureAirportId, System.Guid?arrivalAirportId, System.Guid?financialCurrencyId, System.Guid?userId)
        {
            var contract = new CrudeFinancialFareContract();

            if (departureAirportId != null)
            {
                contract.DepartureAirportId = (System.Guid)departureAirportId;
            }
            if (arrivalAirportId != null)
            {
                contract.ArrivalAirportId = (System.Guid)arrivalAirportId;
            }
            if (financialCurrencyId != null)
            {
                contract.FinancialCurrencyId = (System.Guid)financialCurrencyId;
            }
            if (userId != null)
            {
                contract.UserId = (System.Guid)userId;
            }

            ViewBag.FinancialFareTypeRcd =
                new SelectList(new CrudeFinancialFareTypeRefServiceClient().FetchAll(),
                               "FinancialFareTypeRcd",
                               "FinancialFareTypeName",
                               contract.FinancialFareTypeRcd
                               );

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

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

            contract.ValidFromFlightDateTime = DateTime.UtcNow;

            contract.ValidUntilFlightDateTime = DateTime.UtcNow;

            ViewBag.FinancialCurrencyId =
                new SelectList(new CrudeFinancialCurrencyServiceClient().FetchAll(),
                               "FinancialCurrencyId",
                               "FinancialCurrencyTypeName",
                               contract.FinancialCurrencyId
                               );

            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/Financial/CrudeFinancialFare/CrudeFinancialFareCreate.cshtml",
                       contract
                       ));
        }