// GET: /Edit
        public ActionResult Edit(int id)
        {
            //Set Access Rights
            ViewData["Access"] = "";
            if (rolesRepository.HasWriteAccessToGDSOrderType())
            {
                ViewData["Access"] = "WriteAccess";
            }

            GDSOrderType gdsOrderType = gdsOrderTypeRepository.GetGDSOrderType(id);

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

            //Check Access
            if (!rolesRepository.HasWriteAccessToGDSOrderType())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            GDSOrderTypeVM gdsOrderTypeVM = new GDSOrderTypeVM();

            gdsOrderTypeRepository.EditForDisplay(gdsOrderType);
            gdsOrderTypeVM.GDSOrderType = gdsOrderType;

            return(View(gdsOrderTypeVM));
        }
예제 #2
0
 public void EditForDisplay(GDSOrderType item)
 {
     item.AbacusFlagNullable        = (item.AbacusFlag.HasValue) ? item.AbacusFlag.Value : false;
     item.AllGDSSystemsFlagNullable = (item.AllGDSSystemsFlag.HasValue) ? item.AllGDSSystemsFlag.Value : false;
     item.AmadeusFlagNullable       = (item.AmadeusFlag.HasValue) ? item.AmadeusFlag.Value : false;
     item.ApolloFlagNullable        = (item.ApolloFlag.HasValue) ? item.ApolloFlag.Value : false;
     item.EDSFlagNullable           = (item.EDSFlag.HasValue) ? item.EDSFlag.Value : false;
     item.GalileoFlagNullable       = (item.GalileoFlag.HasValue) ? item.GalileoFlag.Value : false;
     item.RadixxFlagNullable        = (item.RadixxFlag.HasValue) ? item.RadixxFlag.Value : false;
     item.SabreFlagNullable         = (item.SabreFlag.HasValue) ? item.SabreFlag.Value : false;
     item.TravelskyFlagNullable     = (item.TravelskyFlag.HasValue) ? item.TravelskyFlag.Value : false;
     item.WorldspanFlagNullable     = (item.WorldspanFlag.HasValue) ? item.WorldspanFlag.Value : false;
     item.IsThirdPartyFlagNullable  = (item.IsThirdPartyFlag.HasValue) ? item.IsThirdPartyFlag.Value : false;
 }
예제 #3
0
        //GDSOrderTypeShowDataFlag True/False
        public bool GDSOrderTypeShowDataFlag(int gdsOrderTypeId)
        {
            bool showDataFlag = false;

            GDSOrderType gdsOrderType = db.GDSOrderTypes.SingleOrDefault(c => c.GDSOrderTypeId == gdsOrderTypeId);

            if (gdsOrderType != null)
            {
                if (gdsOrderType.ShowDataFlag == true)
                {
                    showDataFlag = true;
                }
            }

            return(showDataFlag);
        }
예제 #4
0
        //Is GDSOrderType ThirdParty Mandatory
        public bool IsGDSOrderTypeThirdPartyMandatory(int gdsOrderTypeId)
        {
            bool isGDSOrderTypeThirdPartyMandatory = false;

            GDSOrderType gdsOrderType = db.GDSOrderTypes.SingleOrDefault(c => c.GDSOrderTypeId == gdsOrderTypeId);

            if (gdsOrderType != null)
            {
                if (gdsOrderType.IsThirdPartyFlag == true)
                {
                    isGDSOrderTypeThirdPartyMandatory = true;
                }
            }

            return(isGDSOrderTypeThirdPartyMandatory);
        }
        public ActionResult Create()
        {
            //Set Access Rights
            ViewData["Access"] = "";
            if (rolesRepository.HasWriteAccessToGDSOrderType())
            {
                ViewData["Access"] = "WriteAccess";
            }

            GDSOrderTypeVM gdsOrderTypeVM = new GDSOrderTypeVM();

            GDSOrderType gdsOrderType = new GDSOrderType();

            gdsOrderTypeVM.GDSOrderType = gdsOrderType;

            return(View(gdsOrderTypeVM));
        }
        public ActionResult Delete(GDSOrderTypeVM gdsOrderTypeVM, FormCollection collection)
        {
            //Check Access
            if (!rolesRepository.HasWriteAccessToGDSOrderType())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            //Get Item From Database
            GDSOrderType gdsOrderType = new GDSOrderType();

            gdsOrderType = gdsOrderTypeRepository.GetGDSOrderType(gdsOrderTypeVM.GDSOrderType.GDSOrderTypeId);

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

            //Delete Item
            try
            {
                gdsOrderTypeRepository.Delete(gdsOrderTypeVM);
            }
            catch (SqlException ex)
            {
                //Versioning Error - go to standard versionError page
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/GDSOrderType.mvc/Delete/" + gdsOrderType.GDSOrderTypeId;
                    return(View("VersionError"));
                }
                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"));
        }
        public ActionResult Delete(int id)
        {
            GDSOrderType gdsOrderType = new GDSOrderType();

            gdsOrderType = gdsOrderTypeRepository.GetGDSOrderType(id);

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

            //Check AccessRights
            if (!rolesRepository.HasWriteAccessToGDSOrderType())
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            GDSOrderTypeVM gdsOrderTypeVM = new GDSOrderTypeVM();

            gdsOrderTypeVM.AllowDelete = true;

            //Attached Items
            List <GDSOrderTypeReference> gdsOrderTypeReferences = gdsOrderTypeRepository.GetGDSOrderTypeReferences(gdsOrderType.GDSOrderTypeId);

            if (gdsOrderTypeReferences.Count > 0)
            {
                gdsOrderTypeVM.AllowDelete            = false;
                gdsOrderTypeVM.GDSOrderTypeReferences = gdsOrderTypeReferences;
            }

            gdsOrderTypeVM.GDSOrderType = gdsOrderType;

            return(View(gdsOrderTypeVM));
        }
예제 #8
0
 public GDSOrderTypeVM(GDSOrderType gdsOrderType, List <GDSOrderTypeReference> gdsOrderTypeReferences)
 {
     GDSOrderType           = gdsOrderType;
     GDSOrderTypeReferences = gdsOrderTypeReferences;
 }