Beispiel #1
0
        //Update in DB
        public void Update(TransactionFeeCarHotel transactionFee)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            db.spDesktopDataAdmin_UpdateTransactionFeeCarHotel_v1(
                transactionFee.TransactionFeeId,
                transactionFee.TransactionFeeDescription,
                transactionFee.TravelIndicator,
                transactionFee.BookingSourceCode,
                transactionFee.BookingOriginationCode,
                transactionFee.ChargeTypeCode,
                transactionFee.TransactionTypeCode,
                transactionFee.FeeCategory,
                transactionFee.TravelerClassCode,
                transactionFee.SupplierCode,
                transactionFee.MinimumFeeCategoryQuantity,
                transactionFee.MaximumFeeCategoryQuantity,
                transactionFee.MinimumTicketPrice,
                transactionFee.MaximumTicketPrice,
                transactionFee.TicketPriceCurrencyCode,
                transactionFee.TripTypeClassificationId,
                transactionFee.TemplateFeeFlag,
                transactionFee.EnabledDate,
                transactionFee.ExpiryDate,
                transactionFee.IncursGSTFlagNonNullable,
                transactionFee.FeeAmount,
                transactionFee.FeeCurrencyCode,
                transactionFee.FeePercent,
                transactionFee.PolicyLocationId,
                adminUserGuid,
                transactionFee.VersionNumber

                );
        }
        public ActionResult Delete(int cid, int tid)
        {
            //Get Item From Database
            TransactionFeeClientFeeGroup transactionFeeClientFeeGroup = new TransactionFeeClientFeeGroup();

            transactionFeeClientFeeGroup = transactionFeeClientFeeGroupRepository.GetItem(cid, tid);

            //Check Exists
            if (transactionFeeClientFeeGroup == null)
            {
                ViewData["ActionMethod"] = "DeleteGet";
                return(View("RecordDoesNotExistError"));
            }

            ClientFeeGroupTransactionFeeCarHotelVM clientFeeGroupTransactionFeeCarHotelVM = new ClientFeeGroupTransactionFeeCarHotelVM();

            clientFeeGroupTransactionFeeCarHotelVM.TransactionFeeClientFeeGroup = transactionFeeClientFeeGroup;

            ClientFeeGroup clientFeeGroup = new ClientFeeGroup();

            clientFeeGroup = clientFeeGroupRepository.GetGroup(cid);
            clientFeeGroupTransactionFeeCarHotelVM.ClientFeeGroup = clientFeeGroup;

            TransactionFeeCarHotel transactionFeeCarHotel = new TransactionFeeCarHotel();

            transactionFeeCarHotel = transactionFeeCarHotelRepository.GetItem(tid);
            transactionFeeCarHotelRepository.EditForDisplay(transactionFeeCarHotel);
            clientFeeGroupTransactionFeeCarHotelVM.TransactionFeeCarHotel = transactionFeeCarHotel;

            return(View(clientFeeGroupTransactionFeeCarHotelVM));
        }
        public ActionResult Delete(int id)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }


            //Get Item From Database
            TransactionFeeCarHotel transactionFee = new TransactionFeeCarHotel();

            transactionFee = transactionFeeCarHotelRepository.GetItem(id);

            //Check Exists
            if (transactionFee == null)
            {
                ViewData["ActionMethod"] = "ViewGet";
                return(View("RecordDoesNotExistError"));
            }

            TransactionFeeCarHotelVM transactionFeeCarHotelVM = new TransactionFeeCarHotelVM();

            transactionFeeCarHotelRepository.EditForDisplay(transactionFee);
            transactionFeeCarHotelVM.TransactionFee = transactionFee;

            return(View(transactionFeeCarHotelVM));
        }
 public TransactionFeeCarHotelVM(TransactionFeeCarHotel transactionFee,
                                 IEnumerable <SelectListItem> travelIndicators,
                                 IEnumerable <SelectListItem> policyLocations,
                                 IEnumerable <SelectListItem> bookingSources,
                                 IEnumerable <SelectListItem> bookingOriginations,
                                 IEnumerable <SelectListItem> chargeTypes,
                                 IEnumerable <SelectListItem> transactionTypes,
                                 IEnumerable <SelectListItem> feeCategories,
                                 IEnumerable <SelectListItem> travelerBackOfficeTypes,
                                 IEnumerable <SelectListItem> tripTypeClassifications,
                                 IEnumerable <SelectListItem> ticketPriceCurrencies,
                                 IEnumerable <SelectListItem> feeCurrencies
                                 )
 {
     TransactionFee          = transactionFee;
     TravelIndicators        = travelIndicators;
     PolicyLocations         = policyLocations;
     BookingSources          = bookingSources;
     ChargeTypes             = chargeTypes;
     BookingOriginations     = bookingOriginations;
     TransactionTypes        = transactionTypes;
     FeeCategories           = feeCategories;
     TravelerBackOfficeTypes = travelerBackOfficeTypes;
     TripTypeClassifications = tripTypeClassifications;
     TicketPriceCurrencies   = ticketPriceCurrencies;
     FeeCurrencies           = feeCurrencies;
 }
 public ClientFeeGroupTransactionFeeCarHotelVM(TransactionFeeClientFeeGroup transactionFeeClientFeeGroup, ClientFeeGroup clientFeeGroup, TransactionFeeCarHotel transactionFeeCarHotel, int feeTypeId, string feeTypeDisplayName, string feeTypeDisplayNameShort)
 {
     TransactionFeeClientFeeGroup = transactionFeeClientFeeGroup;
     ClientFeeGroup         = clientFeeGroup;
     TransactionFeeCarHotel = transactionFeeCarHotel;
     FeeTypeId               = feeTypeId;
     FeeTypeDisplayName      = feeTypeDisplayName;
     FeeTypeDisplayNameShort = feeTypeDisplayNameShort;
 }
Beispiel #6
0
        //Delete From DB
        public void Delete(TransactionFeeCarHotel transactionFee)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            db.spDesktopDataAdmin_DeleteTransactionFeeCarHotel_v1(
                transactionFee.TransactionFeeId,
                adminUserGuid,
                transactionFee.VersionNumber
                );
        }
        public ActionResult Create(TransactionFeeCarHotelVM transactionFeeCarHotelVM)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            //Get TransactionFee Info
            TransactionFeeCarHotel transactionFeeCarHotel = new TransactionFeeCarHotel();

            transactionFeeCarHotel = transactionFeeCarHotelVM.TransactionFee;

            //Update Model From Form + Validate against DB
            try
            {
                UpdateModel <TransactionFee>(transactionFeeCarHotel, "TransactionFee");
            }
            catch
            {
                string n = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        n += error.ErrorMessage;
                    }
                }
                ViewData["Message"] = "ValidationError : " + n;
                return(View("Error"));
            }


            //Database Update
            try
            {
                transactionFeeCarHotelRepository.Add(transactionFeeCarHotel);
            }
            catch (SqlException ex)
            {
                //Non-Unique Name
                if (ex.Message == "NonUniqueName")
                {
                    return(View("NonUniqueNameError"));
                }
                LogRepository logRepository = new LogRepository();
                logRepository.LogError(ex.Message);

                ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details";
                return(View("Error"));
            }

            return(RedirectToAction("List", "TransactionFee"));
        }
        public ActionResult Edit(TransactionFeeCarHotelVM transactionFeeVM)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            TransactionFeeCarHotel transactionFee = new TransactionFeeCarHotel();

            transactionFee = transactionFeeCarHotelRepository.GetItem(transactionFeeVM.TransactionFee.TransactionFeeId);

            //Check Exists
            if (transactionFee == null)
            {
                ViewData["ActionMethod"] = "EditPost";
                return(View("RecordDoesNotExistError"));
            }

            //Update  Model from Form
            try
            {
                UpdateModel(transactionFee, "TransactionFee");
            }
            catch
            {
                string n = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        n += error.ErrorMessage;
                    }
                }
                ViewData["Message"] = "ValidationError : " + n;
                return(View("Error"));
            }

            //Database Update
            try
            {
                transactionFeeCarHotelRepository.Update(transactionFee);
            }
            catch (SqlException ex)
            {
                LogRepository logRepository = new LogRepository();
                logRepository.LogError(ex.Message);

                ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details";
                return(View("Error"));
            }

            return(RedirectToAction("List", "TransactionFee"));
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            //Get Item From Database
            TransactionFeeCarHotel transactionFee = new TransactionFeeCarHotel();

            transactionFee = transactionFeeCarHotelRepository.GetItem(id);

            //Check Exists
            if (transactionFee == null)
            {
                ViewData["ActionMethod"] = "DeletePost";
                return(View("RecordDoesNotExistError"));
            }

            //Delete Item
            try
            {
                transactionFee.VersionNumber = Int32.Parse(collection["TransactionFee.VersionNumber"]);
                transactionFeeCarHotelRepository.Delete(transactionFee);
            }
            catch (SqlException ex)
            {
                //Versioning Error - go to standard versionError page
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/TransactionFeeCarHotel.mvc/Delete/" + transactionFee.TransactionFeeId.ToString();
                    return(View("VersionError"));
                }
                //Restraint Error - go to standard DeleteError page
                if (ex.Message == "SQLDeleteError")
                {
                    ViewData["ReturnURL"] = "/TransactionFeeCarHotel.mvc/Delete/" + transactionFee.TransactionFeeId.ToString();
                    return(View("DeleteError"));
                }

                LogRepository logRepository = new LogRepository();
                logRepository.LogError(ex.Message);

                //Generic Error
                ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details";
                return(View("Error"));
            }

            //Return
            return(RedirectToAction("List", "TransactionFee"));
        }
        // GET: View A Single TransactionFeeCarHotel
        public ActionResult View(int id)
        {
            //Get Item From Database
            TransactionFeeCarHotel transactionFee = new TransactionFeeCarHotel();

            transactionFee = transactionFeeCarHotelRepository.GetItem(id);

            //Check Exists
            if (transactionFee == null)
            {
                ViewData["ActionMethod"] = "ViewGet";
                return(View("RecordDoesNotExistError"));
            }

            TransactionFeeCarHotelVM transactionFeeCarHotelVM = new TransactionFeeCarHotelVM();

            transactionFeeCarHotelRepository.EditForDisplay(transactionFee);
            transactionFeeCarHotelVM.TransactionFee = transactionFee;

            return(View(transactionFeeCarHotelVM));
        }
Beispiel #11
0
        public void EditForDisplay(TransactionFeeCarHotel transactionFee)
        {
            TravelIndicatorRepository travelIndicatorRepository = new TravelIndicatorRepository();
            TravelIndicator           travelIndicator           = new TravelIndicator();

            travelIndicator = travelIndicatorRepository.GetTravelIndicator(transactionFee.TravelIndicator);
            if (travelIndicator != null)
            {
                transactionFee.TravelIndicatorDescription = travelIndicator.TravelIndicatorDescription;
            }

            CurrencyRepository currencyRepository = new CurrencyRepository();
            Currency           currency           = new Currency();

            currency = currencyRepository.GetCurrency(transactionFee.FeeCurrencyCode);
            if (currency != null)
            {
                transactionFee.FeeCurrencyName = currency.Name;
            }
            currency = currencyRepository.GetCurrency(transactionFee.TicketPriceCurrencyCode);
            if (currency != null)
            {
                transactionFee.TicketPriceCurrencyName = currency.Name;
            }


            BookingSourceRepository bookingSourceRepository = new BookingSourceRepository();
            BookingSource           bookingSource           = new BookingSource();

            bookingSource = bookingSourceRepository.GetBookingSource(transactionFee.BookingSourceCode);
            if (bookingSource != null)
            {
                transactionFee.BookingSourceDescription = bookingSource.BookingSourceDescription;
            }

            BookingOriginationRepository bookingOriginationRepository = new BookingOriginationRepository();
            BookingOrigination           bookingOrigination           = new BookingOrigination();

            bookingOrigination = bookingOriginationRepository.GetBookingOrigination(transactionFee.BookingOriginationCode);
            if (bookingOrigination != null)
            {
                transactionFee.BookingOriginationCode = bookingOrigination.BookingOriginationCode;
            }

            ChargeTypeRepository chargeTypeRepository = new ChargeTypeRepository();
            ChargeType           chargeType           = new ChargeType();

            chargeType = chargeTypeRepository.GetChargeType(transactionFee.ChargeTypeCode);
            if (bookingOrigination != null)
            {
                transactionFee.ChargeTypeDescription = chargeType.ChargeTypeDescription;
            }

            TravelerBackOfficeTypeRepository travelerBackOfficeTypeRepository = new TravelerBackOfficeTypeRepository();
            TravelerBackOfficeType           travelerBackOfficeType           = new TravelerBackOfficeType();

            travelerBackOfficeType = travelerBackOfficeTypeRepository.GetTravelerBackOfficeType(transactionFee.TravelerClassCode);
            if (travelerBackOfficeType != null)
            {
                transactionFee.TravelerBackOfficeTypeDescription = travelerBackOfficeType.TravelerBackOfficeTypeDescription;
            }

            if (transactionFee.ProductId != null)
            {
                ProductRepository productRepository = new ProductRepository();
                Product           product           = new Product();
                product = productRepository.GetProduct((int)transactionFee.ProductId);
                if (product != null)
                {
                    transactionFee.ProductName = product.ProductName;

                    //Supplier
                    if (!String.IsNullOrEmpty(transactionFee.SupplierCode))
                    {
                        SupplierRepository supplierRepository = new SupplierRepository();
                        Supplier           supplier           = new Supplier();
                        supplier = supplierRepository.GetSupplier(transactionFee.SupplierCode, (int)transactionFee.ProductId);
                        if (supplier != null)
                        {
                            transactionFee.SupplierName = supplier.SupplierName;
                        }
                    }
                }
            }

            if (transactionFee.PolicyLocationId != null)
            {
                PolicyLocationRepository policyLocationRepository = new PolicyLocationRepository();
                PolicyLocation           policyLocation           = new PolicyLocation();
                policyLocation = policyLocationRepository.GetPolicyLocation((int)transactionFee.PolicyLocationId);
                if (policyLocation != null)
                {
                    transactionFee.PolicyLocationName = policyLocation.PolicyLocationName;
                }
            }

            //IncursGSTFlag is nullable
            if (transactionFee.IncursGSTFlag != true)
            {
                transactionFee.IncursGSTFlag = false;
            }
            transactionFee.IncursGSTFlagNonNullable = (bool)transactionFee.IncursGSTFlag;
        }
        // GET: Create A Single Transaction Fee
        public ActionResult Create(int productId)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            ProductRepository productRepository = new ProductRepository();
            Product           product           = new Product();

            product = productRepository.GetProduct(productId);
            if (product == null || productId < 2 || productId > 3)
            {
                ViewData["ActionMethod"] = "CreateGet";
                return(View("RecordDoesNotExistError"));
            }

            TransactionFeeCarHotelVM transactionFeeVM       = new TransactionFeeCarHotelVM();
            TransactionFeeCarHotel   transactionFeeCarHotel = new TransactionFeeCarHotel();

            transactionFeeCarHotel.ProductName = product.ProductName;
            transactionFeeCarHotel.ProductId   = product.ProductId;
            transactionFeeCarHotel.IncursGSTFlagNonNullable = false;
            transactionFeeVM.TransactionFee = transactionFeeCarHotel;

            TravelIndicatorRepository travelIndicatorRepository = new TravelIndicatorRepository();

            transactionFeeVM.TravelIndicators = new SelectList(travelIndicatorRepository.GetAllTravelIndicators().ToList(), "TravelIndicator1", "TravelIndicatorDescription");

            BookingSourceRepository bookingSourceRepository = new BookingSourceRepository();

            transactionFeeVM.BookingSources = new SelectList(bookingSourceRepository.GetAllBookingSources().ToList(), "BookingSourceCode", "BookingSourceCode");

            BookingOriginationRepository bookingOriginationRepository = new BookingOriginationRepository();

            transactionFeeVM.BookingOriginations = new SelectList(bookingOriginationRepository.GetAllBookingOriginations().ToList(), "BookingOriginationCode", "BookingOriginationCode");

            ChargeTypeRepository chargeTypeRepository = new ChargeTypeRepository();

            transactionFeeVM.ChargeTypes = new SelectList(chargeTypeRepository.GetAllChargeTypes().ToList(), "ChargeTypeCode", "ChargeTypeDescription");

            TransactionTypeRepository transactionTypeRepository = new TransactionTypeRepository();

            transactionFeeVM.TransactionTypes = new SelectList(transactionTypeRepository.GetAllTransactionTypes().ToList(), "TransactionTypeCode", "TransactionTypeCode");

            FeeCategoryRepository feeCategoryRepository = new FeeCategoryRepository();

            transactionFeeVM.FeeCategories = new SelectList(feeCategoryRepository.GetAllFeeCategories().ToList(), "FeeCategory1", "FeeCategory1");

            TravelerBackOfficeTypeRepository travelerBackOfficeTypeRepository = new TravelerBackOfficeTypeRepository();

            transactionFeeVM.TravelerBackOfficeTypes = new SelectList(travelerBackOfficeTypeRepository.GetAllTravelerBackOfficeTypes().ToList(), "TravelerBackOfficeTypeCode", "TravelerBackOfficeTypeDescription");

            TripTypeClassificationRepository tripTypeClassificationRepository = new TripTypeClassificationRepository();

            transactionFeeVM.TripTypeClassifications = new SelectList(tripTypeClassificationRepository.GetAllTripTypeClassifications().ToList(), "TripTypeClassificationId", "TripTypeClassificationDescription");

            CurrencyRepository currencyRepository = new CurrencyRepository();

            transactionFeeVM.TicketPriceCurrencies = new SelectList(currencyRepository.GetAllCurrencies().ToList(), "CurrencyCode", "Name");
            transactionFeeVM.FeeCurrencies         = new SelectList(currencyRepository.GetAllCurrencies().ToList(), "CurrencyCode", "Name");

            //Location is used in CarHotel only
            PolicyLocationRepository policyLocationRepository = new PolicyLocationRepository();

            transactionFeeVM.PolicyLocations = new SelectList(policyLocationRepository.GetAllPolicyLocations().ToList(), "PolicyLocationId", "PolicyLocationName");

            return(View(transactionFeeVM));
        }