コード例 #1
0
        //
        // GET: /ClientProfileGroup/Create

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

            ClientProfileGroupVM clientProfileGroupVM = new ClientProfileGroupVM();

            //GDS List
            GDSRepository gDSRepository = new GDSRepository();
            SelectList    gDSs          = new SelectList(gDSRepository.GetClientProfileBuilderGDSs().ToList(), "GDSCode", "GDSName");

            clientProfileGroupVM.GDSs = gDSs;

            //BackOfficeSystem List removing 'All' option
            BackOfficeSystemRepository backOfficeSystemRepository = new BackOfficeSystemRepository();
            SelectList backOffices = new SelectList(backOfficeSystemRepository.GetAllBackOfficeSystems().ToList(), "BackOfficeSytemId", "BackOfficeSystemDescription");

            clientProfileGroupVM.BackOffices = backOffices;

            //Hierarchy List
            TablesDomainHierarchyLevelRepository tablesDomainHierarchyLevelRepository = new TablesDomainHierarchyLevelRepository();
            SelectList hierarchyTypesList = new SelectList(tablesDomainHierarchyLevelRepository.GetDomainHierarchies(groupName).ToList(), "HierarchyLevelTableName", "HierarchyLevelTableName");

            clientProfileGroupVM.HierarchyTypes = hierarchyTypesList;

            ClientProfileGroup ClientProfileGroup = new ClientProfileGroup();

            clientProfileGroupVM.ClientProfileGroup = ClientProfileGroup;

            return(View(clientProfileGroupVM));
        }
コード例 #2
0
 public ClientProfileItemsVM(
     int clientProfileGroupId,
     string clientProfileGroupClientProfileGroupName,
     string clientProfileGroupGDSName,
     string clientProfileGroupHierarchyItem,
     string clientProfileGroupBackOfficeSystemDescription,
     int clientProfilePanelId,
     ClientProfileGroup clientProfileGroup,
     List <ClientProfileItemVM> clientProfileItemsClientDetails,
     List <ClientProfileItemVM> clientProfileItemsMidOffice,
     List <ClientProfileItemVM> clientProfileItemsBackOffice,
     List <ClientProfileItemVM> clientProfileItemsItinerary,
     List <ClientProfileItemVM> clientProfileItems24Hours,
     List <ClientProfileItemVM> clientProfileItemsAirRailPolicy,
     List <ClientProfileItemVM> ClientProfileItemsAmadeusTPM,
     bool hasDomainWriteAccess)
 {
     ClientProfileGroupId = clientProfileGroupId;
     ClientProfileGroupClientProfileGroupName = clientProfileGroupClientProfileGroupName;
     ClientProfileGroupGDSName       = clientProfileGroupGDSName;
     ClientProfileGroupHierarchyItem = clientProfileGroupHierarchyItem;
     ClientProfileGroupBackOfficeSystemDescription = clientProfileGroupBackOfficeSystemDescription;
     ClientProfilePanelId            = clientProfilePanelId;
     ClientProfileGroup              = clientProfileGroup;
     ClientProfileItemsClientDetails = clientProfileItemsClientDetails;
     ClientProfileItemsMidOffice     = clientProfileItemsMidOffice;
     ClientProfileItemsBackOffice    = clientProfileItemsBackOffice;
     ClientProfileItemsItinerary     = clientProfileItemsItinerary;
     ClientProfileItems24Hours       = clientProfileItems24Hours;
     ClientProfileItemsAirRailPolicy = clientProfileItemsAirRailPolicy;
     HasDomainWriteAccess            = hasDomainWriteAccess;
 }
        //Add Data From Linked Tables for Display
        public void EditGroupForDisplay(ClientProfileGroup clientProfileGroup)
        {
            //Set Hierarchy if ClientTopUnit
            ClientProfileGroupClientTopUnit clientProfileGroupClientTopUnit = clientProfileGroup.ClientProfileGroupClientTopUnits.SingleOrDefault();

            if (clientProfileGroupClientTopUnit != null)
            {
                ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
                ClientTopUnit           clientTopUnit           = new ClientTopUnit();
                clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientProfileGroupClientTopUnit.ClientTopUnitGuid);
                if (clientTopUnit != null)
                {
                    clientProfileGroup.HierarchyItem = clientTopUnit.ClientTopUnitName;
                    clientProfileGroup.HierarchyCode = clientTopUnit.ClientTopUnitGuid;
                    clientProfileGroup.HierarchyType = "ClientTopUnit";
                }
            }

            //Set Hierarchy if ClientSubUnit
            ClientProfileGroupClientSubUnit clientProfileGroupClientSubUnit = clientProfileGroup.ClientProfileGroupClientSubUnits.SingleOrDefault();

            if (clientProfileGroupClientSubUnit != null)
            {
                ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository();
                ClientSubUnit           clientSubUnit           = new ClientSubUnit();
                clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientProfileGroupClientSubUnit.ClientSubUnitGuid);
                if (clientSubUnit != null)
                {
                    clientProfileGroup.HierarchyItem = clientSubUnit.ClientSubUnitName;
                    clientProfileGroup.HierarchyCode = clientSubUnit.ClientSubUnitGuid;
                    clientProfileGroup.HierarchyType = "ClientSubUnit";
                }
            }
        }
コード例 #4
0
        // GET: /UnDelete
        public ActionResult UnDelete(int id)
        {
            //Get Item From Database
            ClientProfileGroup clientProfileGroup = new ClientProfileGroup();

            clientProfileGroup = clientProfileGroupRepository.GetGroup(id);

            //Check Exists
            if (clientProfileGroup == null || clientProfileGroup.DeletedFlag == false)
            {
                ViewData["ActionMethod"] = "DeleteGet";
                return(View("RecordDoesNotExistError"));
            }

            //Check Access
            RolesRepository rolesRepository = new RolesRepository();

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

            ClientProfileGroupVM clientProfileGroupVM = new ClientProfileGroupVM();

            clientProfileGroupRepository.EditGroupForDisplay(clientProfileGroup);
            clientProfileGroupVM.ClientProfileGroup = clientProfileGroup;

            ViewData["UniqueName"] = clientProfileGroup.UniqueName;

            return(View(clientProfileGroupVM));
        }
コード例 #5
0
 public ClientProfileGroupVM(ClientProfileGroup clientProfileGroup,
                             IEnumerable <SelectListItem> hierarchyTypes,
                             IEnumerable <SelectListItem> gDSs,
                             IEnumerable <SelectListItem> backOffices)
 {
     ClientProfileGroup = clientProfileGroup;
     HierarchyTypes     = hierarchyTypes;
     GDSs        = gDSs;
     BackOffices = backOffices;
 }
        //Update the publish date on an item
        public void UpdateGroupPublishDate(ClientProfileGroup group)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            db.spDesktopDataAdmin_UpdateClientProfilePublishDate_v1(
                group.ClientProfileGroupId,
                adminUserGuid,
                group.VersionNumber
                );
        }
コード例 #7
0
        public ActionResult UnDelete(ClientProfileGroupVM clientProfileGroupVM)
        {
            //Check Valid Item passed in Form
            if (clientProfileGroupVM.ClientProfileGroup == null)
            {
                ViewData["ActionMethod"] = "DeletePost";
                return(View("RecordDoesNotExistError"));
            }

            //Get Item From Database
            ClientProfileGroup clientProfileGroup = new ClientProfileGroup();

            clientProfileGroup = clientProfileGroupRepository.GetGroup(clientProfileGroupVM.ClientProfileGroup.ClientProfileGroupId);

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

            //Check Access
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientProfileGroup(clientProfileGroup.ClientProfileGroupId))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            //Delete Form Item
            try
            {
                clientProfileGroupVM.ClientProfileGroup.DeletedFlag = false;
                clientProfileGroupRepository.UpdateGroupDeletedStatus(clientProfileGroupVM.ClientProfileGroup);
            }
            catch (SqlException ex)
            {
                //Versioning Error - go to standard versionError page
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/ClientProfileGroup.mvc/UnDelete/" + clientProfileGroup.ClientProfileGroupId;
                    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("ListDeleted"));
        }
        //Add Group
        public void Add(ClientProfileGroup group)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            db.spDesktopDataAdmin_InsertClientProfileGroup_v1(
                group.ClientProfileGroupName,
                group.HierarchyType,
                group.HierarchyCode,
                group.GDSCode,
                group.BackOfficeSytemId,
                group.PseudoCityOrOfficeId,
                group.UniqueName,
                adminUserGuid
                );
        }
コード例 #9
0
        // GET: /Publish
        public ActionResult Publish(int id)
        {
            ClientProfileGroup clientProfileGroup = new ClientProfileGroup();

            clientProfileGroup = clientProfileGroupRepository.GetGroup(id);

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

            clientProfileGroupRepository.EditGroupForDisplay(clientProfileGroup);
            clientProfileGroupVM.ClientProfileGroup = clientProfileGroup;

            //Get ClientTopUnit
            if (clientProfileGroup.HierarchyType == "ClientSubUnit")
            {
                ClientProfileGroupClientSubUnit clientProfileGroupClientSubUnit = clientProfileGroup.ClientProfileGroupClientSubUnits.SingleOrDefault();
                if (clientProfileGroupClientSubUnit != null)
                {
                    ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository();
                    ClientSubUnit           clientSubUnit           = new ClientSubUnit();
                    clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientProfileGroupClientSubUnit.ClientSubUnitGuid);
                    if (clientSubUnit != null)
                    {
                        if (clientSubUnit.ClientTopUnit != null)
                        {
                            ViewData["ClientTopUnitName"] = clientSubUnit.ClientTopUnit.ClientTopUnitName;
                        }
                    }
                }
            }

            //GDS Window
            string clientProfileBuilderText = GDSIntegration.WriteGDSProfile(id);

            if (!string.IsNullOrEmpty(clientProfileBuilderText))
            {
                ViewData["clientProfileText"] = clientProfileBuilderText;
            }

            return(View(clientProfileGroupVM));
        }
コード例 #10
0
        public JsonResult Publish(int clientProfileGroupId, string sabreStatus, string gdsCode)
        {
            //Get Item From Database
            ClientProfileGroup clientProfileGroup = new ClientProfileGroup();

            clientProfileGroup = clientProfileGroupRepository.GetGroup(clientProfileGroupId);

            //Check Exists in Database
            if (clientProfileGroup == null)
            {
                ViewData["ActionMethod"] = "DeletePost";
                return(Json("Record Does Not Exist Error"));
            }

            //Check Access
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientProfileGroup(clientProfileGroup.ClientProfileGroupId))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(Json("Error"));
            }

            GDS           gds           = new GDS();
            GDSRepository gdsRepository = new GDSRepository();

            gds = gdsRepository.GetGDS(clientProfileGroup.GDSCode);

            string gdsName = gds.GDSName;

            switch (gdsCode)
            {
            case "1S":
                gdsName = sabreStatus;
                break;
            }

            string response = DoPublish(clientProfileGroup, gds, gdsName, clientProfileGroup.PseudoCityOrOfficeId, false);

            return(Json(response));
        }
コード例 #11
0
        // GET: /View
        public ActionResult View(int id)
        {
            ClientProfileGroup clientProfileGroup = new ClientProfileGroup();

            clientProfileGroup = clientProfileGroupRepository.GetGroup(id);

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

            clientProfileGroupRepository.EditGroupForDisplay(clientProfileGroup);
            clientProfileGroupVM.ClientProfileGroup = clientProfileGroup;

            ViewData["UniqueName"] = clientProfileGroup.UniqueName;

            return(View(clientProfileGroupVM));
        }
コード例 #12
0
        public JsonResult HasClientProfileGroupBeenUpdatedSinceLoad(string clientProfileGroupId, string lastUpdateTimestamp)
        {
            string retval = string.Empty;

            int id = Int32.Parse(clientProfileGroupId);

            //Get Item From Database
            ClientProfileGroup clientProfileGroup = new ClientProfileGroup();

            clientProfileGroup = clientProfileGroupRepository.GetGroup(id);

            //Check Exists
            if (clientProfileGroup == null)
            {
                retval = "RecordDoesNotExistError";
            }

            //Check Access
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientProfileGroup(id))
            {
                retval = "You do not have access to this item";
            }

            if (!string.IsNullOrEmpty(lastUpdateTimestamp))
            {
                DateTime profileLoadedTimestamp = CWTDateHelpers.RoundToSecond(Convert.ToDateTime(lastUpdateTimestamp));
                DateTime currentTimestamp       = CWTDateHelpers.RoundToSecond(Convert.ToDateTime(clientProfileGroup.LastUpdateTimestamp));
                retval = (currentTimestamp > profileLoadedTimestamp) ? "true" : "false";
            }
            else
            {
                retval = "false";
            }

            return(Json(retval));
        }
        //
        // GET: /ClientProfileItem/List

        public ActionResult List(int id, int?clientProfilePanelId)
        {
            ClientProfileItemsVM clientProfileItemsVM = new ClientProfileItemsVM();

            //Set Access Rights
            if (hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                clientProfileItemsVM.HasDomainWriteAccess = true;
            }

            //Get the ClientProfileGroup
            ClientProfileGroup clientProfileGroup = new ClientProfileGroup();

            clientProfileGroup = clientProfileGroupRepository.GetGroup(id);
            clientProfileGroupRepository.EditGroupForDisplay(clientProfileGroup);
            clientProfileItemsVM.ClientProfileGroup = clientProfileGroup;

            clientProfileItemsVM.ClientProfileGroupId = clientProfileGroup.ClientProfileGroupId;
            clientProfileItemsVM.ClientProfileGroupClientProfileGroupName = clientProfileGroup.ClientProfileGroupName;

            GDS           gds           = new GDS();
            GDSRepository gdsRepository = new GDSRepository();

            gds = gdsRepository.GetGDS(clientProfileGroup.GDSCode);
            clientProfileItemsVM.ClientProfileGroupGDSName = gds.GDSName;

            clientProfileItemsVM.ClientProfileGroupHierarchyItem = clientProfileGroup.HierarchyItem;
            clientProfileItemsVM.ClientProfileGroupBackOfficeSystemDescription = clientProfileGroup.BackOfficeSystem.BackOfficeSystemDescription;
            clientProfileItemsVM.ClientProfilePanelId = clientProfilePanelId ?? 0;

            //Get ClientTopUnit
            if (clientProfileGroup.HierarchyType == "ClientSubUnit")
            {
                ClientProfileGroupClientSubUnit clientProfileGroupClientSubUnit = clientProfileGroup.ClientProfileGroupClientSubUnits.SingleOrDefault();
                if (clientProfileGroupClientSubUnit != null)
                {
                    ClientSubUnitRepository clientSubUnitRepository = new ClientSubUnitRepository();
                    ClientSubUnit           clientSubUnit           = new ClientSubUnit();
                    clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientProfileGroupClientSubUnit.ClientSubUnitGuid);
                    if (clientSubUnit != null)
                    {
                        if (clientSubUnit.ClientTopUnit != null)
                        {
                            ViewData["ClientTopUnitName"] = clientSubUnit.ClientTopUnit.ClientTopUnitName;
                        }
                    }
                }
            }

            //Get a list of ClientProfileItems for each panel
            clientProfileItemsVM.ClientProfileItemsClientDetails = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 6);
            clientProfileItemsVM.ClientProfileItemsMidOffice     = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 3);
            clientProfileItemsVM.ClientProfileItemsBackOffice    = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 5);
            clientProfileItemsVM.ClientProfileItemsAirRailPolicy = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 7);
            clientProfileItemsVM.ClientProfileItemsItinerary     = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 9);
            clientProfileItemsVM.ClientProfileItems24Hours       = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 10);
            clientProfileItemsVM.ClientProfileItemsAmadeusTPM    = clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 11);

            /*GDS Integration*/
            //https://docs.google.com/document/d/1TMOvJzZmePKjFTt0qFUC6_JGRz0x508uIiV3jGCa7b0/

            //TLS Update
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

            ClientProfileService lService          = null;
            StringBuilder        clientProfileText = new StringBuilder();

            //Format PCC String
            string formattedPcc = GDSIntegration.FormatPccString(clientProfileGroup.PseudoCityOrOfficeId);

            try
            {
                //This is a singleton, and should be used strictly to retrieve existing profiles from the GDS
                lService = ClientProfileService.getInstance;
            }
            catch (Exception ex)
            {
                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"));
            }

            if (lService != null)
            {
                try
                {
                    //string pGds, string pPcc, string pZeroLevel, string pCompanyProfileName, stringpTravellerProfileName
                    ClientProfileResponse clientProfileResponse = lService.GetProfile(gds.GDSName, formattedPcc, "", clientProfileGroup.ClientProfileGroupName, "");
                    if (clientProfileResponse != null)
                    {
                        if (clientProfileResponse.Result != CWTResponse.ResultStatus.Error)
                        {
                            if (clientProfileResponse.ClientProfile != null)
                            {
                                ClientProfile clientProfile = clientProfileResponse.ClientProfile;
                                if (clientProfile != null)
                                {
                                    if (clientProfile.ProfileLines.Count > 0)
                                    {
                                        //Loop through the profile and write out the lines
                                        foreach (ClientProfileLine line in clientProfile.ProfileLines)
                                        {
                                            //&#13;&#10; is new line
                                            clientProfileText.AppendFormat("{0} {1}&#13;&#10;", line.LineNumber, line.LineText);
                                        }

                                        //Pass content into view if exists
                                        if (!string.IsNullOrEmpty(clientProfileText.ToString()))
                                        {
                                            ViewData["clientProfileText"] = clientProfileText.ToString();
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            //Log Get Profile error messages and show error in GDS window
                            if (clientProfileResponse.MessageList.Count > 0)
                            {
                                string errorMessage = string.Empty;

                                foreach (string message in clientProfileResponse.MessageList)
                                {
                                    errorMessage += string.Format("{0}&#13;&#10;", message);
                                }

                                if (!string.IsNullOrEmpty(errorMessage))
                                {
                                    ViewData["clientProfileText"] = errorMessage;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    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(View(clientProfileItemsVM));
        }
コード例 #14
0
        public static List <ClientProfileItemVM> GetProfileLineItems(int id, bool showMandatoryItems = false)
        {
            List <ClientProfileItemVM>   clientProfileItemsAllList    = new List <ClientProfileItemVM>();
            List <ClientProfileItemVM>   clientProfileItemsList       = new List <ClientProfileItemVM>();
            ClientProfileGroupRepository clientProfileGroupRepository = new ClientProfileGroupRepository();
            ClientProfileGroup           clientProfileGroup           = clientProfileGroupRepository.GetGroup(id);

            if (clientProfileGroup != null)
            {
                ClientProfileItemRepository clientProfileItemRepository = new ClientProfileItemRepository();

                //General (Removed)
                //foreach (ClientProfileItemVM item in clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 1))
                //{
                //	clientProfileItemsAllList.Add(item);
                //}

                //Land Policy (removed)
                //foreach (ClientProfileItemVM item in clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 8))
                //{
                //	clientProfileItemsAllList.Add(item);
                //}

                //1. Client Detail
                foreach (ClientProfileItemVM item in clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 6))
                {
                    clientProfileItemsAllList.Add(item);
                }

                //2. Mid Office
                foreach (ClientProfileItemVM item in clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 3))
                {
                    clientProfileItemsAllList.Add(item);
                }

                //3. Back Office
                foreach (ClientProfileItemVM item in clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 5))
                {
                    clientProfileItemsAllList.Add(item);
                }

                //4. Air/Rail/Land
                foreach (ClientProfileItemVM item in clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 7))
                {
                    clientProfileItemsAllList.Add(item);
                }

                //5. Itinerary
                foreach (ClientProfileItemVM item in clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 9))
                {
                    clientProfileItemsAllList.Add(item);
                }

                //6. 24 Hour
                foreach (ClientProfileItemVM item in clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 10))
                {
                    clientProfileItemsAllList.Add(item);
                }

                //7. Amadeus TPM
                foreach (ClientProfileItemVM item in clientProfileItemRepository.GetClientProfilePanelClientProfileDataElements(id, 11))
                {
                    clientProfileItemsAllList.Add(item);
                }

                foreach (ClientProfileItemVM item in clientProfileItemsAllList)
                {
                    if ((showMandatoryItems && item.ClientProfileItem.MandatoryFlag) || (item.ClientProfileItem.ClientProfileMoveStatusId != null && item.ClientProfileItem.GDSCommandFormat != null && item.ClientProfileItem.Remark != null))
                    {
                        clientProfileItemsList.Add(item);
                    }
                }
            }

            return(clientProfileItemsList);
        }
コード例 #15
0
        public JsonResult IsProfileReadytoPublish(string clientProfileGroupId)
        {
            if (clientProfileGroupId == null)
            {
                return(Json("No Id"));
            }

            int id = Int32.Parse(clientProfileGroupId);

            string retval = "true";

            //Get Item From Database
            ClientProfileGroup clientProfileGroup = new ClientProfileGroup();

            clientProfileGroup = clientProfileGroupRepository.GetGroup(id);

            //Get GDS
            GDS           gds           = new GDS();
            GDSRepository gdsRepository = new GDSRepository();

            gds = gdsRepository.GetGDS(clientProfileGroup.GDSCode);

            //Check Exists
            if (clientProfileGroup == null)
            {
                retval = "RecordDoesNotExistError";
            }

            //Check Access
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientProfileGroup(id))
            {
                retval = "You do not have access to this item";
            }

            List <ClientProfileItemVM> clientProfileItemsList = GDSIntegration.GetProfileLineItems(id, true);

            bool doIncompleteFieldsExists = false;

            //Check if all mandatory fields are complete
            foreach (ClientProfileItemVM clientProfileItemVM in clientProfileItemsList)
            {
                ClientProfileItemRow clientProfileItemRow = clientProfileItemVM.ClientProfileItem;

                if (clientProfileItemRow.MandatoryFlag == true && (
                        clientProfileItemRow.ClientProfileMoveStatusId == null ||
                        string.IsNullOrEmpty(clientProfileItemRow.Remark) ||
                        string.IsNullOrEmpty(clientProfileItemRow.GDSCommandFormat)))
                {
                    doIncompleteFieldsExists = true;
                }
            }

            if (doIncompleteFieldsExists)
            {
                return(Json("There are incomplete mandatory elements.<br/><br/>Please return to the Items page and correct the error."));
            }

            //Check Line Counts
            int lineCount    = clientProfileItemsList.Count();
            int maxLineCount = 0;

            switch (gds.GDSName)
            {
            case "Apollo":
                maxLineCount = 200;
                break;

            case "Amadeus":
                maxLineCount = 100;
                break;

            case "Galileo":
                maxLineCount = 200;
                break;

            case "Sabre":
                maxLineCount = 200;
                break;
            }

            if (lineCount > maxLineCount)
            {
                retval = "The client profile exceeds the maximum number of lines.<br/><br/>Please return to the Items page and correct the error.";
            }

            return(Json(retval));
        }
コード例 #16
0
        public ActionResult Create(ClientProfileGroupVM clientProfileGroupVM)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            //We need to extract group from groupVM
            ClientProfileGroup clientProfileGroup = new ClientProfileGroup();

            clientProfileGroup = clientProfileGroupVM.ClientProfileGroup;
            if (clientProfileGroup == null)
            {
                ViewData["Message"] = "ValidationError : missing item";;
                return(View("Error"));
            }

            //Check Access Rights to Domain Hierarchy
            //if (!hierarchyRepository.AdminHasDomainHierarchyWriteAccess( ClientProfileGroup.HierarchyType, ClientProfileGroup.HierarchyCode, ClientProfileGroup.SourceSystemCode, groupName))
            //{
            //	ViewData["Message"] = "You cannot add to this hierarchy item";
            //	return View("Error");
            //}

            //Update Model From Form + Validate against DB
            try
            {
                UpdateModel <ClientProfileGroup>(clientProfileGroup, "ClientProfileGroup");
            }
            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
            {
                clientProfileGroupRepository.Add(clientProfileGroup);
            }
            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"));
            }

            ViewData["NewSortOrder"] = 0;
            return(RedirectToAction("ListUnDeleted"));
        }
コード例 #17
0
        public string DoPublish([Bind(Exclude = "HierarchyType, HierarchyItem, HierarchyCode")] ClientProfileGroup clientProfileGroup,
                                [Bind(Include = "GDSCode, GDSName")] GDS gds, string gdsName, string formattedPcc, bool verify = false)
        {
            /*GDS Integration*/
            //https://docs.google.com/document/d/1TMOvJzZmePKjFTt0qFUC6_JGRz0x508uIiV3jGCa7b0/

            //TLS Update
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

            ClientProfileService lService    = null;
            CWTResponse          CWTResponse = null;

            string errorMessage = string.Empty;

            try
            {
                //This is a singleton, and should be used strictly to retrieve existing profiles from the GDS
                lService = ClientProfileService.getInstance;

                if (lService == null)
                {
                    return("Service Error");
                }

                ClientProfile clientProfile = null;

                ClientProfileResponse clientProfileResponse = lService.GetProfile(gdsName, formattedPcc, "", clientProfileGroup.ClientProfileGroupName, "");

                if (clientProfileResponse != null && clientProfileResponse.ClientProfile != null)
                {
                    clientProfile = clientProfileResponse.ClientProfile;
                }

                if (clientProfileResponse != null && clientProfileResponse.MessageList != null && clientProfileResponse.MessageList.Count > 0)
                {
                    errorMessage = string.Format("These errors were returned by the GDS for PCC when retrieving profile:");

                    foreach (string message in clientProfileResponse.MessageList)
                    {
                        errorMessage += string.Format("{0}<br/>", message);
                    }

                    LogRepository logRepository = new LogRepository();
                    logRepository.LogError(errorMessage);
                    return(errorMessage);
                }

                //Get Lines
                List <ClientProfileItemVM> clientProfileItemsList = GDSIntegration.GetProfileLineItems(clientProfileGroup.ClientProfileGroupId);
                List <ClientProfileLine>   clientProfileItemLines = GDSIntegration.WriteProfileLines(clientProfileItemsList, gds.GDSCode);

                //Modify Profile
                if (clientProfile != null)
                {
                    //Replace current lines with new lines
                    clientProfile.ProfileLines = clientProfileItemLines;
                    CWTResponse = clientProfile.DeleteProfileLines();
                    CWTResponse = clientProfile.ModifyProfile();
                }
                //Create New
                else
                {
                    clientProfile = new ClientProfile(
                        gds.GDSName,
                        formattedPcc,
                        clientProfileGroup.ClientProfileGroupName,
                        string.Empty,
                        clientProfileItemLines);

                    CWTResponse = clientProfile.SaveProfile();
                }
            }
            catch (Exception 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("There was a problem with your request, please see the log file or contact an administrator for details");
            }

            //Update Client Profile Publish Date
            if (CWTResponse != null && CWTResponse.Result != CWTResponse.ResultStatus.Error)
            {
                try
                {
                    //Don't update timestamp for verify process
                    if (!verify)
                    {
                        clientProfileGroupRepository.UpdateGroupPublishDate(clientProfileGroup);
                    }
                }
                catch (SqlException ex)
                {
                    //Versioning Error
                    if (ex.Message == "SQLVersioningError")
                    {
                        ViewData["ReturnURL"] = "/ClientProfileGroup.mvc/Publish/" + clientProfileGroup.ClientProfileGroupId;
                        return("Version Error");
                    }

                    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("Error");
                }
            }
            else if (CWTResponse != null && CWTResponse.MessageList != null && CWTResponse.MessageList.Count > 0)
            {
                errorMessage = string.Format("These errors were returned by the GDS for PCC when retrieving profile:");

                foreach (string message in CWTResponse.MessageList)
                {
                    errorMessage += string.Format("{0}<br/>", message);
                }

                errorMessage += "<br/>Please correct the profile and try to re-publish again.";

                LogRepository logRepository = new LogRepository();
                logRepository.LogError(errorMessage);
                return(errorMessage);
            }
            else
            {
                errorMessage = "There was a problem with your request, please see the log file or contact an administrator for details.";
                LogRepository logRepository = new LogRepository();
                logRepository.LogError(errorMessage);
                return(errorMessage);
            }

            return("true");
        }
コード例 #18
0
        public JsonResult Verify(int clientProfileGroupId, string sabreStatus, string gdsCode)
        {
            //Get Item From Database
            ClientProfileGroup clientProfileGroup = new ClientProfileGroup();

            clientProfileGroup = clientProfileGroupRepository.GetGroup(clientProfileGroupId);

            //Check Exists in Databsase
            if (clientProfileGroup == null)
            {
                ViewData["ActionMethod"] = "DeletePost";
                return(Json("Record Does Not Exist Error"));
            }

            //Check Access
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientProfileGroup(clientProfileGroup.ClientProfileGroupId))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(Json("Error"));
            }

            GDS           gds           = new GDS();
            GDSRepository gdsRepository = new GDSRepository();

            gds = gdsRepository.GetGDS(clientProfileGroup.GDSCode);

            string verifyPCC = string.Empty;
            string gdsName   = gds.GDSName;

            switch (gdsCode)
            {
            case "1G":
                verifyPCC = ConfigurationManager.AppSettings["VerifyPCC_Galileo"].ToString();
                break;

            case "1V":
                verifyPCC = ConfigurationManager.AppSettings["VerifyPCC_Apollo"].ToString();
                break;

            case "1A":
                verifyPCC = ConfigurationManager.AppSettings["VerifyPCC_Amadeus"].ToString();
                break;

            case "1S":
                verifyPCC = ConfigurationManager.AppSettings["VerifyPCC_Sabre"].ToString();
                gdsName   = sabreStatus;
                break;
            }

            if (string.IsNullOrEmpty(verifyPCC))
            {
                //Need to add values into web config
                LogRepository logRepository = new LogRepository();
                logRepository.LogError("Please ensure verify PCC is present for GDS");
                ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details";
                return(Json("There was a problem with your request, please see the log file or contact an administrator for details"));
            }

            string response = DoPublish(clientProfileGroup, gds, gdsName, verifyPCC, true);

            return(Json(response));
        }
コード例 #19
0
        public ActionResult Edit(ClientProfileGroupVM clientProfileGroupVM)
        {
            //Get Item
            ClientProfileGroup clientProfileGroup = new ClientProfileGroup();

            clientProfileGroup = clientProfileGroupRepository.GetGroup(clientProfileGroupVM.ClientProfileGroup.ClientProfileGroupId);

            //Check Exists
            if (clientProfileGroup == null)
            {
                ViewData["ActionMethod"] = "EditPost";
                return(View("RecordDoesNotExistError"));
            }
            //Check Access Rights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientProfileGroup(clientProfileGroup.ClientProfileGroupId))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            //Update Model From Form + Validate against DB
            try
            {
                UpdateModel <ClientProfileGroup>(clientProfileGroup, "ClientProfileGroup");
            }
            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
            {
                clientProfileGroupRepository.Edit(clientProfileGroup);
            }
            catch (SqlException ex)
            {
                //Versioning Error
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/ClientProfileGroup.mvc/Edit/" + clientProfileGroup.ClientProfileGroupId;
                    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"));
            }

            string redirectAction = (clientProfileGroup.DeletedFlag) ? "ListDeleted" : "ListUnDeleted";

            return(RedirectToAction(redirectAction));
        }