// GET: /ListSubMenu
        public ActionResult ListSubMenu(int id)
        {
            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(id);

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

            ClientDetailClientAccount clientDetailClientAccount = new ClientDetailClientAccount();

            clientDetailClientAccount = clientDetailClientAccountRepository.GetClientDetailClientAccount(id);

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

            ClientAccount clientAccount = new ClientAccount();

            clientAccount = clientAccountRepository.GetClientAccount(clientDetailClientAccount.ClientAccountNumber, clientDetailClientAccount.SourceSystemCode);

            ClientAccountClientDetailVM clientAccountClientDetailVM = new ClientAccountClientDetailVM();

            clientAccountClientDetailVM.ClientAccount = clientAccount;
            clientAccountClientDetailVM.ClientDetail  = clientDetail;

            return(View(clientAccountClientDetailVM));
        }
Пример #2
0
        // GET: /List
        public ActionResult List(int id, int?page)
        {
            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(id);

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

            ClientDetailClientAccount clientDetailClientAccount = new ClientDetailClientAccount();

            clientDetailClientAccount = clientDetailClientAccountRepository.GetClientDetailClientAccount(id);

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

            string can = clientDetailClientAccount.ClientAccountNumber;
            string ssc = clientDetailClientAccount.SourceSystemCode;

            ClientAccount clientAccount = new ClientAccount();

            clientAccount = clientAccountRepository.GetClientAccount(can, ssc);

            //Access Rights
            ViewData["Access"] = "";
            RolesRepository rolesRepository = new RolesRepository();

            if (rolesRepository.HasWriteAccessToClientAccount(can, ssc))
            {
                ViewData["Access"] = "WriteAccess";
            }

            //Populate View Model
            ClientAccountSupplierProductsVM clientAccountSupplierProductsVM = new ClientAccountSupplierProductsVM();

            clientAccountSupplierProductsVM.SupplierProducts = clientDetailRepository.ListClientDetailSupplierProducts(id, page ?? 1);
            clientAccountSupplierProductsVM.ClientAccount    = clientAccount;
            clientAccountSupplierProductsVM.ClientDetail     = clientDetail;

            //Return Form
            return(View(clientAccountSupplierProductsVM));
        }
        // GET: /ListSubMenu
        public ActionResult ListSubMenu(string can, string ssc)
        {
            ClientAccount clientAccount = new ClientAccount();

            clientAccount = clientAccountRepository.GetClientAccount(can, ssc);

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

            return(View(clientAccount));
        }
Пример #4
0
        // GET: /View/5
        public ActionResult View(string id, string csu, string can, string ssc)
        {
            //Check Exists
            ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem();

            clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(id);
            if (clientDefinedReferenceItem == null)
            {
                ViewData["ActionMethod"] = "ViewGet";
                return(View("RecordDoesNotExistError"));
            }

            clientDefinedReferenceItemRepository.EditForDisplay(clientDefinedReferenceItem);

            ClientDefinedReferenceItemVM clientDefinedReferenceItemVM = new ClientDefinedReferenceItemVM();

            //Check Exists (CDR CSU could be null)
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);
            if (clientSubUnit != null)
            {
                clientDefinedReferenceItem.ClientSubUnitGuid = clientSubUnit.ClientSubUnitGuid;
                clientDefinedReferenceItemVM.ClientSubUnit   = clientSubUnit;
            }

            if (can != null && ssc != null)
            {
                ClientSubUnitClientAccount clientSubUnitClientAccount = new ClientSubUnitClientAccount();
                clientSubUnitClientAccount = clientSubUnitClientAccountRepository.GetClientSubUnitClientAccount(can, ssc, csu);
                if (clientSubUnitClientAccount != null)
                {
                    ViewData["ClientSubUnitClientAccountClientAccountName"] = clientSubUnitClientAccount.ClientAccount.ClientAccountName;
                }

                clientDefinedReferenceItem.ClientAccountNumber = clientDefinedReferenceItem.ClientAccountNumber;
                clientDefinedReferenceItem.SourceSystemCode    = clientDefinedReferenceItem.SourceSystemCode;
            }

            clientDefinedReferenceItemVM.ClientDefinedReferenceItem = clientDefinedReferenceItem;

            if (can != null && ssc != null)
            {
                ClientAccount           clientAccount           = new ClientAccount();
                ClientAccountRepository clientAccountRepository = new ClientAccountRepository();
                clientAccount = clientAccountRepository.GetClientAccount(can, ssc);
                if (clientAccount != null)
                {
                    ViewData["ClientAccountName"] = clientAccount.ClientAccountName;
                }

                ViewData["ClientAccountNumber"] = can;
                ViewData["SourceSystemCode"]    = ssc;
            }

            return(View(clientDefinedReferenceItemVM));
        }
Пример #5
0
        // GET: /ListBySubUnit/
        public ActionResult ListBySubUnit(string filter, int?page, string id, string sortField, int?sortOrder, string can, string ssc)
        {
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id);

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

            //Set Access Rights
            ViewData["Access"] = "";
            if (hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Access"] = "WriteAccess";
            }

            //Set Create/Order Rights
            ViewData["CreateAccess"] = "";
            RolesRepository rolesRepository = new RolesRepository();

            if (rolesRepository.HasWriteAccessToClientDefinedReferenceItem(id, can, ssc))
            {
                ViewData["CreateAccess"] = "CreateAccess";
            }

            //SortField
            if (string.IsNullOrEmpty(sortField))
            {
                sortField = "SequenceNumber";
            }
            ViewData["CurrentSortField"] = sortField;

            //SortOrder
            if (sortOrder == 1)
            {
                ViewData["NewSortOrder"]     = 0;
                ViewData["CurrentSortOrder"] = 1;
            }
            else
            {
                ViewData["NewSortOrder"]     = 1;
                ViewData["CurrentSortOrder"] = 0;
            }

            clientSubUnitRepository.EditGroupForDisplay(clientSubUnit);
            ViewData["ClientTopUnitGuid"] = clientSubUnit.ClientTopUnitGuid;
            ViewData["ClientTopUnitName"] = clientSubUnit.ClientTopUnitName;
            ViewData["ClientSubUnitGuid"] = clientSubUnit.ClientSubUnitGuid;
            ViewData["ClientSubUnitName"] = clientSubUnit.ClientSubUnitName;

            if (can != null && ssc != null)
            {
                ClientAccount           clientAccount           = new ClientAccount();
                ClientAccountRepository clientAccountRepository = new ClientAccountRepository();
                clientAccount = clientAccountRepository.GetClientAccount(can, ssc);
                if (clientAccount != null)
                {
                    ViewData["ClientAccountName"] = clientAccount.ClientAccountName;
                }

                ViewData["ClientAccountNumber"] = can;
                ViewData["SourceSystemCode"]    = ssc;
            }

            var items = clientDefinedReferenceItemRepository.PageClientDefinedReferenceItems(filter ?? "", id, ssc, can, page ?? 1, sortField, sortOrder ?? 0);

            return(View(items));
        }
Пример #6
0
        // GET: /ListByClientAccount/
        public ActionResult List(int?page, string can, string ssc, string csu, string sortField, int?sortOrder)
        {
            ClientAccount clientAccount = new ClientAccount();

            clientAccount = clientAccountRepository.GetClientAccount(can, ssc);

            //Check Exists
            if (clientAccount == null)
            {
                ViewData["ActionMethod"] = "ListGet";
                return(View("RecordDoesNotExistError"));
            }
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

            //Check AccessRights
            ViewData["Access"] = "";
            RolesRepository rolesRepository = new RolesRepository();

            if (rolesRepository.HasWriteAccessToClientAccountCreditCards(can, ssc))
            {
                ViewData["Access"] = "WriteAccess";
            }

            //Sorting
            if (sortField == null || sortField == "CreditCardTypeDescription")
            {
                sortField = "CreditCardTypeDescription";
            }
            ViewData["CurrentSortField"] = sortField;

            //Ordering
            if (sortOrder == 1)
            {
                ViewData["NewSortOrder"]     = 0;
                ViewData["CurrentSortOrder"] = 1;
            }
            else
            {
                ViewData["NewSortOrder"]     = 1;
                ViewData["CurrentSortOrder"] = 0;
                sortOrder = 0;
            }

            ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
            ClientTopUnit           clientTopUnit           = clientSubUnit.ClientTopUnit;

            ClientAccountCreditCardsVM clientAccountCreditCardsVM = new ClientAccountCreditCardsVM();

            clientAccountCreditCardsVM.CreditCards        = creditCardClientAccountRepository.GetCreditCardsByClientAccount(can, ssc, page ?? 1, sortField, sortOrder ?? 0);
            clientAccountCreditCardsVM.ClientAccount      = clientAccount;
            clientAccountCreditCardsVM.ClientTopUnit      = clientTopUnit;
            clientAccountCreditCardsVM.ClientSubUnit      = clientSubUnit;
            clientAccountCreditCardsVM.CreditCardBehavior = creditCardRepository.GetCreditCardBehavior();

            return(View(clientAccountCreditCardsVM));
        }
Пример #7
0
        // GET: /Edit
        public ActionResult Edit(int id, string csu, string can, string ssc)
        {
            ClientDefinedReferenceItemPNROutputVM clientDefinedReferenceItemPNROutputVM = new ClientDefinedReferenceItemPNROutputVM();

            ClientDefinedReferenceItemPNROutput clientDefinedReferenceItemPNROutput = new ClientDefinedReferenceItemPNROutput();

            clientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutputRepository.GetClientDefinedReferenceItemPNROutput(id);
            if (clientDefinedReferenceItemPNROutput == null)
            {
                ViewData["ActionMethod"] = "ViewGet";
                return(View("RecordDoesNotExistError"));
            }

            clientDefinedReferenceItemPNROutputVM.ClientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutput;

            //Check Exists
            ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem();

            clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemId);
            if (clientDefinedReferenceItem == null)
            {
                ViewData["ActionMethod"] = "ViewGet";
                return(View("RecordDoesNotExistError"));
            }

            ViewData["DsplayName"] = !string.IsNullOrEmpty(clientDefinedReferenceItem.DisplayNameAlias) ? clientDefinedReferenceItem.DisplayNameAlias : clientDefinedReferenceItem.DisplayName;

            //Check Exists CSU for VM
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);
            if (clientSubUnit != null)
            {
                clientSubUnitRepository.EditGroupForDisplay(clientSubUnit);
                clientDefinedReferenceItemPNROutputVM.ClientSubUnit = clientSubUnit;
            }

            // Check Exists CDR CSU (can be null)
            ClientSubUnit clientSubUnitCDR = new ClientSubUnit();

            if (clientDefinedReferenceItem.ClientSubUnitGuid != null)
            {
                clientSubUnitCDR = clientSubUnitRepository.GetClientSubUnit(clientDefinedReferenceItem.ClientSubUnitGuid);
                if (clientSubUnit != null)
                {
                    clientSubUnitRepository.EditGroupForDisplay(clientSubUnitCDR);
                    clientDefinedReferenceItem.ClientSubUnitGuid = clientSubUnitCDR.ClientSubUnitGuid;
                }
            }

            if (can != null && ssc != null)
            {
                ClientSubUnitClientAccount clientSubUnitClientAccount = new ClientSubUnitClientAccount();
                clientSubUnitClientAccount = clientSubUnitClientAccountRepository.GetClientSubUnitClientAccount(can, ssc, csu);
                if (clientSubUnitClientAccount != null)
                {
                    ViewData["ClientSubUnitClientAccountClientAccountName"] = clientSubUnitClientAccount.ClientAccount.ClientAccountName;
                }

                clientDefinedReferenceItem.ClientAccountNumber = clientDefinedReferenceItem.ClientAccountNumber;
                clientDefinedReferenceItem.SourceSystemCode    = clientDefinedReferenceItem.SourceSystemCode;
            }

            if (can != null && ssc != null)
            {
                ClientAccount           clientAccount           = new ClientAccount();
                ClientAccountRepository clientAccountRepository = new ClientAccountRepository();
                clientAccount = clientAccountRepository.GetClientAccount(can, ssc);
                if (clientAccount != null)
                {
                    ViewData["ClientAccountName"] = clientAccount.ClientAccountName;
                }

                clientDefinedReferenceItem.ClientAccountNumber = can;
                clientDefinedReferenceItem.SourceSystemCode    = ssc;
                ViewData["ClientDefinedReferenceItemId"]       = clientDefinedReferenceItem.ClientDefinedReferenceItemId;
                ViewData["ClientAccountNumber"] = can;
                ViewData["SourceSystemCode"]    = ssc;
            }

            //ClientDefinedReferenceItem
            clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItem   = clientDefinedReferenceItem;
            clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemId = clientDefinedReferenceItem.ClientDefinedReferenceItemId;

            //GDS
            GDSRepository GDSRepository = new GDSRepository();

            clientDefinedReferenceItemPNROutputVM.GDSList = new SelectList(GDSRepository.GetAllGDSsExceptALL().OrderBy(x => x.GDSName).ToList(), "GDSCode", "GDSName");

            //PNR Output Remark Types
            PNROutputRemarkTypeRepository PNROutputRemarkTypeRepository = new PNROutputRemarkTypeRepository();

            clientDefinedReferenceItemPNROutputVM.PNROutputRemarkTypeCodes = new SelectList(PNROutputRemarkTypeRepository.GetPNROutputRemarkTypes(), "PNROutputRemarkTypeCode", "PNROutputRemarkTypeName");

            //Languages
            LanguageRepository languageRepository = new LanguageRepository();

            clientDefinedReferenceItemPNROutputVM.Languages = new SelectList(languageRepository.GetAllLanguages().ToList(), "LanguageCode", "LanguageName");

            return(View(clientDefinedReferenceItemPNROutputVM));
        }
Пример #8
0
        public ActionResult Delete(string id, string csu, string can, string ssc)
        {
            //Check Exists
            ClientDefinedReferenceItemValue clientDefinedReferenceItemValue = new ClientDefinedReferenceItemValue();

            clientDefinedReferenceItemValue = clientDefinedReferenceItemValueRepository.GetClientDefinedReferenceItemValue(id);
            if (clientDefinedReferenceItemValue == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }

            //Check Exists
            ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem();

            clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(clientDefinedReferenceItemValue.ClientDefinedReferenceItemId);
            if (clientDefinedReferenceItem == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

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

            ClientDefinedReferenceItemValueVM clientDefinedReferenceItemValueVM = new ClientDefinedReferenceItemValueVM();

            clientDefinedReferenceItemValueVM.ClientDefinedReferenceItemValue = clientDefinedReferenceItemValue;

            ClientSubUnitClientAccount clientSubUnitClientAccount = new ClientSubUnitClientAccount();

            clientSubUnitClientAccount = clientSubUnitClientAccountRepository.GetClientSubUnitClientAccount(clientDefinedReferenceItem.ClientAccountNumber, clientDefinedReferenceItem.SourceSystemCode, clientSubUnit.ClientSubUnitGuid);
            if (clientSubUnitClientAccount != null)
            {
                clientDefinedReferenceItemValueVM.ClientSubUnitClientAccount = clientSubUnitClientAccount;
                ViewData["ClientSubUnitClientAccountClientAccountName"]      = clientSubUnitClientAccount.ClientAccount.ClientAccountName;
            }

            clientDefinedReferenceItemValueVM.ClientDefinedReferenceItem = clientDefinedReferenceItem;
            clientDefinedReferenceItemValueVM.ClientSubUnit = clientSubUnit;
            clientDefinedReferenceItemValueVM.ClientDefinedReferenceItemValue = clientDefinedReferenceItemValue;

            if (can != null && ssc != null)
            {
                ClientAccount           clientAccount           = new ClientAccount();
                ClientAccountRepository clientAccountRepository = new ClientAccountRepository();
                clientAccount = clientAccountRepository.GetClientAccount(can, ssc);
                if (clientAccount != null)
                {
                    ViewData["ClientAccountName"]   = clientAccount.ClientAccountName;
                    ViewData["ClientAccountNumber"] = clientDefinedReferenceItem.ClientAccountNumber;
                    ViewData["SourceSystemCode"]    = clientDefinedReferenceItem.SourceSystemCode;
                }
            }

            return(View(clientDefinedReferenceItemValueVM));
        }
Пример #9
0
        // GET: /List/
        public ActionResult List(string filter, int?page, string id, string csu, string can, string ssc, string sortField, int?sortOrder)
        {
            //Check Exists
            ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem();

            clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(id);
            if (clientDefinedReferenceItem == null)
            {
                ViewData["ActionMethod"] = "ViewGet";
                return(View("RecordDoesNotExistError"));
            }

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

            //Set Access Rights
            ViewData["Access"] = "";
            if (hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Access"] = "WriteAccess";
            }

            //Set Create/Order Rights
            ViewData["CreateAccess"] = "";
            RolesRepository rolesRepository = new RolesRepository();

            if (clientDefinedReferenceItem.BackOfficeDataSourceId == 2)
            {
                ViewData["CreateAccess"] = "CreateAccess";
            }

            //SortField
            if (string.IsNullOrEmpty(sortField))
            {
                sortField = "Value";
            }
            ViewData["CurrentSortField"] = sortField;

            //SortOrder
            if (sortOrder == 1)
            {
                ViewData["NewSortOrder"]     = 0;
                ViewData["CurrentSortOrder"] = 1;
            }
            else
            {
                ViewData["NewSortOrder"]     = 1;
                ViewData["CurrentSortOrder"] = 0;
            }

            clientSubUnitRepository.EditGroupForDisplay(clientSubUnit);
            ViewData["ClientTopUnitGuid"] = clientSubUnit.ClientTopUnitGuid;
            ViewData["ClientTopUnitName"] = clientSubUnit.ClientTopUnitName;
            ViewData["ClientSubUnitGuid"] = clientSubUnit.ClientSubUnitGuid;
            ViewData["ClientSubUnitName"] = clientSubUnit.ClientSubUnitName;

            if (clientDefinedReferenceItem.ClientAccountNumber != null && clientDefinedReferenceItem.SourceSystemCode != null)
            {
                ClientAccount           clientAccount           = new ClientAccount();
                ClientAccountRepository clientAccountRepository = new ClientAccountRepository();
                clientAccount = clientAccountRepository.GetClientAccount(
                    clientDefinedReferenceItem.ClientAccountNumber,
                    clientDefinedReferenceItem.SourceSystemCode
                    );
                if (clientAccount != null)
                {
                    ViewData["ClientAccountName"]   = clientAccount.ClientAccountName;
                    ViewData["ClientAccountNumber"] = clientDefinedReferenceItem.ClientAccountNumber;
                    ViewData["SourceSystemCode"]    = clientDefinedReferenceItem.SourceSystemCode;
                }
            }

            ViewData["ClientDefinedReferenceItemId"] = clientDefinedReferenceItem.ClientDefinedReferenceItemId ?? "";
            ViewData["ClientDefinedReferenceItemDisplayNameAlias"] = clientDefinedReferenceItem.DisplayNameAlias ?? "";

            var items = clientDefinedReferenceItemValueRepository.PageClientDefinedReferenceItemValues(filter ?? "", id, page ?? 1, sortField, sortOrder ?? 0);

            return(View(items));
        }
Пример #10
0
        public ActionResult Delete(int id, string languageCode, string csu, string can, string ssc)
        {
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

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

            ClientDefinedReferenceItemPNROutputLanguageVM clientDefinedReferenceItemPNROutputLanguageVM = new ClientDefinedReferenceItemPNROutputLanguageVM();

            ClientDefinedReferenceItemPNROutput clientDefinedReferenceItemPNROutput = new ClientDefinedReferenceItemPNROutput();

            clientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutputRepository.GetClientDefinedReferenceItemPNROutput(id);

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

            ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem();

            clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemId);

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

            clientSubUnitRepository.EditGroupForDisplay(clientSubUnit);
            ViewData["ClientTopUnitGuid"]                                = clientSubUnit.ClientTopUnitGuid;
            ViewData["ClientTopUnitName"]                                = clientSubUnit.ClientTopUnitName;
            ViewData["ClientSubUnitGuid"]                                = clientSubUnit.ClientSubUnitGuid;
            ViewData["ClientSubUnitName"]                                = clientSubUnit.ClientSubUnitName;
            ViewData["ClientDefinedReferenceItemId"]                     = clientDefinedReferenceItem.ClientDefinedReferenceItemId;
            ViewData["ClientDefinedReferenceItemPNROutputId"]            = clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemPNROutputId;
            ViewData["ClientDefinedReferenceItemPNROutputDefaultRemark"] = clientDefinedReferenceItemPNROutput.DefaultRemark;
            ViewData["DisplayNameAlias"] = clientDefinedReferenceItem.DisplayNameAlias != null ? clientDefinedReferenceItem.DisplayNameAlias : clientDefinedReferenceItem.DisplayName;

            if (can != null && ssc != null)
            {
                ClientAccount           clientAccount           = new ClientAccount();
                ClientAccountRepository clientAccountRepository = new ClientAccountRepository();
                clientAccount = clientAccountRepository.GetClientAccount(can, ssc);
                if (clientAccount != null)
                {
                    ViewData["ClientAccountName"] = clientAccount.ClientAccountName;
                }

                ViewData["ClientAccountNumber"] = can;
                ViewData["SourceSystemCode"]    = ssc;
            }

            ClientDefinedReferenceItemPNROutputLanguage clientDefinedReferenceItemPNROutputLanguage = new ClientDefinedReferenceItemPNROutputLanguage();

            clientDefinedReferenceItemPNROutputLanguage = clientDefinedReferenceItemPNROutputLanguageRepository.GetClientDefinedReferenceItemPNROutputLanguage(id, languageCode);

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

            clientDefinedReferenceItemPNROutputLanguageVM.ClientDefinedReferenceItemPNROutputLanguage = clientDefinedReferenceItemPNROutputLanguage;
            clientDefinedReferenceItemPNROutputLanguageVM.ClientDefinedReferenceItemPNROutput         = clientDefinedReferenceItemPNROutput;
            clientDefinedReferenceItemPNROutputLanguageVM.ClientSubUnit = clientSubUnit;
            clientDefinedReferenceItem.ClientSubUnitGuid = clientSubUnit.ClientSubUnitGuid;

            //Languages
            LanguageRepository languageRepository = new LanguageRepository();
            List <Language>    languages          = clientDefinedReferenceItemPNROutputLanguageRepository.GetAvailableLanguages(clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemPNROutputId).ToList();
            Language           language           = languageRepository.GetLanguage(clientDefinedReferenceItemPNROutputLanguage.LanguageCode);

            if (language != null)
            {
                languages.Add(language);
            }

            clientDefinedReferenceItemPNROutputLanguageVM.Languages = new SelectList(languages, "LanguageCode", "LanguageName", clientDefinedReferenceItemPNROutputLanguage.LanguageCode);

            return(View(clientDefinedReferenceItemPNROutputLanguageVM));
        }
        // GET: /List/
        public ActionResult List(int id, string filter, int?page, string sortField, int?sortOrder, string csu, string can, string ssc)
        {
            ClientDefinedReferenceItemPNROutput clientDefinedReferenceItemPNROutput = new ClientDefinedReferenceItemPNROutput();

            clientDefinedReferenceItemPNROutput = clientDefinedReferenceItemPNROutputRepository.GetClientDefinedReferenceItemPNROutput(id);

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

            //Set Access Rights
            ViewData["Access"] = "";
            if (hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Access"] = "WriteAccess";
            }

            //SortField
            if (string.IsNullOrEmpty(sortField))
            {
                sortField = "LanguageName";
            }
            ViewData["CurrentSortField"] = sortField;

            //SortOrder
            if (sortOrder == 1)
            {
                ViewData["NewSortOrder"]     = 0;
                ViewData["CurrentSortOrder"] = 1;
            }
            else
            {
                ViewData["NewSortOrder"]     = 1;
                ViewData["CurrentSortOrder"] = 0;
            }

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

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

            ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem();

            clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemId);

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

            clientSubUnitRepository.EditGroupForDisplay(clientSubUnit);
            ViewData["ClientTopUnitGuid"]                                = clientSubUnit.ClientTopUnitGuid;
            ViewData["ClientTopUnitName"]                                = clientSubUnit.ClientTopUnitName;
            ViewData["ClientSubUnitGuid"]                                = clientSubUnit.ClientSubUnitGuid;
            ViewData["ClientSubUnitName"]                                = clientSubUnit.ClientSubUnitName;
            ViewData["ClientDefinedReferenceItemId"]                     = clientDefinedReferenceItem.ClientDefinedReferenceItemId;
            ViewData["ClientDefinedReferenceItemPNROutputId"]            = clientDefinedReferenceItemPNROutput.ClientDefinedReferenceItemPNROutputId;
            ViewData["ClientDefinedReferenceItemPNROutputDefaultRemark"] = clientDefinedReferenceItemPNROutput.DefaultRemark;
            ViewData["DisplayNameAlias"] = !string.IsNullOrEmpty(clientDefinedReferenceItem.DisplayNameAlias) ? clientDefinedReferenceItem.DisplayNameAlias : clientDefinedReferenceItem.DisplayName;

            if (can != null && ssc != null)
            {
                ClientAccount           clientAccount           = new ClientAccount();
                ClientAccountRepository clientAccountRepository = new ClientAccountRepository();
                clientAccount = clientAccountRepository.GetClientAccount(can, ssc);
                if (clientAccount != null)
                {
                    ViewData["ClientAccountName"] = clientAccount.ClientAccountName;
                }

                ViewData["ClientAccountNumber"] = can;
                ViewData["SourceSystemCode"]    = ssc;
            }

            var items = clientDefinedReferenceItemPNROutputLanguageRepository.PageClientDefinedReferenceItemPNROutputLanguages(id, filter ?? "", page ?? 1, sortField, sortOrder ?? 0);

            return(View(items));
        }
Пример #12
0
        public ActionResult Create(ClientSubUnitCDRVM clientSubUnitCDRVM)
        {
            //Validate data against Tables
            if (!ModelState.IsValid)
            {
                string clientSubUnitGuid = clientSubUnitCDRVM.ClientSubUnit.ClientSubUnitGuid;

                //Get ClientSubUnit
                ClientSubUnit clientSubUnit = new ClientSubUnit();
                clientSubUnit = clientSubUnitRepository.GetClientSubUnit(clientSubUnitGuid);

                ClientTopUnit           clientTopUnit           = new ClientTopUnit();
                ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
                clientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientSubUnit.ClientTopUnitGuid);

                clientSubUnit.ClientTopUnit      = clientTopUnit;
                clientSubUnitCDRVM.ClientSubUnit = clientSubUnit;
                clientSubUnitCDRVM.ClientSubUnit = clientSubUnit;

                CreditCardClientSubUnitRepository creditCardClientSubUnitRepository = new CreditCardClientSubUnitRepository();
                clientSubUnitCDRVM.CreditCardSelectList = new SelectList(creditCardClientSubUnitRepository.GetAllCreditCardsBySubUnit(clientSubUnitGuid).ToList(), "CreditCardId", "MaskedCreditCardNumber");

                ClientSubUnitClientAccountRepository clientSubUnitClientAccountRepository = new ClientSubUnitClientAccountRepository();
                clientSubUnitCDRVM.ClientAccountSelectList = clientSubUnitClientAccountRepository.GetClientAccountsBySubUnit(clientSubUnitGuid, "");

                //ClientTopUnitRepository clientTopUnitRepository = new ClientTopUnitRepository();
                //clientSubUnitCDRVM.ClientSubUnit.ClientTopUnit = clientTopUnitRepository.GetClientTopUnit(clientSubUnitCDRVM.ClientSubUnit.ClientSubUnitGuid);
                return(View(clientSubUnitCDRVM));
            }
            CreditCard creditCard   = new CreditCard();
            int?       creditCardId = clientSubUnitCDRVM.ClientSubUnitClientDefinedReference.CreditCardId;

            if (creditCardId != null)
            {
                creditCard = creditCardRepository.GetCreditCard((int)creditCardId, false);
            }

            ClientAccount clientAccount       = new ClientAccount();
            string        clientAccountNumber = null;
            string        sourceSystemCode    = null;

            if (!String.IsNullOrEmpty(clientSubUnitCDRVM.ClientSubUnitClientDefinedReference.ClientAccountNumberSourceSystemCode))
            {
                clientAccountNumber = clientSubUnitCDRVM.ClientSubUnitClientDefinedReference.ClientAccountNumberSourceSystemCode.Split(new[] { '|' })[0];
                sourceSystemCode    = clientSubUnitCDRVM.ClientSubUnitClientDefinedReference.ClientAccountNumberSourceSystemCode.Split(new[] { '|' })[1];
                clientAccount       = clientAccountRepository.GetClientAccount(clientAccountNumber, sourceSystemCode);
            }

            //Check Exists (at least one
            if (creditCard == null && clientAccount == null)
            {
                ViewData["ActionMethod"] = "CreatePost";
                return(View("RecordDoesNotExistError"));
            }

            RolesRepository rolesRepository = new RolesRepository();

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

            //Update  Model from Form
            ClientSubUnitClientDefinedReference clientSubUnitClientDefinedReference = new ClientSubUnitClientDefinedReference();

            clientSubUnitClientDefinedReference.ClientSubUnitGuid = clientSubUnitCDRVM.ClientSubUnit.ClientSubUnitGuid;

            clientSubUnitClientDefinedReference.Value = clientSubUnitCDRVM.ClientSubUnitClientDefinedReference.Value;
            clientSubUnitClientDefinedReference.ClientAccountNumber = clientAccountNumber;
            clientSubUnitClientDefinedReference.SourceSystemCode    = sourceSystemCode;
            clientSubUnitClientDefinedReference.CreditCardId        = creditCardId;

            ClientDefinedReferenceItem           clientDefinedReferenceItem           = new ClientDefinedReferenceItem();
            ClientDefinedReferenceItemRepository clientDefinedReferenceItemRepository = new ClientDefinedReferenceItemRepository();

            //clientDefinedReferenceItem = clientDefinedReferenceItemRepository.GetClientDefinedReferenceItem(clientSubUnitCDRVM.ClientDefinedReferenceItemId);
            //if(clientDefinedReferenceItem != null){
            clientSubUnitClientDefinedReference.DisplayName = clientSubUnitCDRVM.DisplayName;
            //}


            try
            {
                clientSubUnitCDRRepository.Add(clientSubUnitClientDefinedReference);
            }
            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", new { id = clientSubUnitCDRVM.ClientSubUnit.ClientSubUnitGuid }));
        }
Пример #13
0
        public JsonResult CreateAccount(string id, ClientWizardVM updatedClient)
        {
            //Check Exists
            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id);
            if (clientSubUnit == null)
            {
                ViewData["ActionMethod"] = "CreateGet";
                return(Json("RecordDoesNotExistError"));
            }

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

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

            // Create the xml document container
            XmlDocument    doc = new XmlDocument();         // Create the XML Declaration, and append it to XML document
            XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", null, null);

            doc.AppendChild(dec);
            XmlElement root = doc.CreateElement("ClientSubUnitClientAccounts");

            doc.AppendChild(root);

            bool changesExist = false;
            ClientAccountRepository clientAccountRepository = new ClientAccountRepository();

            if (updatedClient.ClientAccountsAdded != null)
            {
                if (updatedClient.ClientAccountsAdded.Count > 0)
                {
                    changesExist = true;
                    XmlElement xmlClientAccountsAdded = doc.CreateElement("ClientAccountsAdded");

                    foreach (ClientSubUnitClientAccount item in updatedClient.ClientAccountsAdded)
                    {
                        ClientAccount clientAccount = new ClientAccount();
                        clientAccount = clientAccountRepository.GetClientAccount(item.ClientAccountNumber, item.SourceSystemCode);

                        XmlElement xmlClientAccount = doc.CreateElement("ClientAccount");
                        xmlClientAccountsAdded.AppendChild(xmlClientAccount);

                        XmlElement xmlSourceSystemCode = doc.CreateElement("SourceSystemCode");
                        xmlSourceSystemCode.InnerText = item.SourceSystemCode;
                        xmlClientAccount.AppendChild(xmlSourceSystemCode);

                        XmlElement xmlClientAccountNumber = doc.CreateElement("ClientAccountNumber");
                        xmlClientAccountNumber.InnerText = item.ClientAccountNumber;
                        xmlClientAccount.AppendChild(xmlClientAccountNumber);

                        XmlElement xmlClientAccountName = doc.CreateElement("ClientAccountName");
                        xmlClientAccountName.InnerText = clientAccount.ClientAccountName;
                        xmlClientAccount.AppendChild(xmlClientAccountName);

                        XmlElement xmlConfidenceLevelForLoadId = doc.CreateElement("ConfidenceLevelForLoadId");
                        xmlConfidenceLevelForLoadId.InnerText = item.ConfidenceLevelForLoadId.ToString();
                        xmlClientAccount.AppendChild(xmlConfidenceLevelForLoadId);
                    }
                    root.AppendChild(xmlClientAccountsAdded);
                }
            }
            if (updatedClient.ClientAccountsRemoved != null)
            {
                if (updatedClient.ClientAccountsRemoved.Count > 0)
                {
                    changesExist = true;
                    XmlElement xmlClientAccountsRemoved = doc.CreateElement("ClientAccountsRemoved");

                    foreach (ClientSubUnitClientAccount item in updatedClient.ClientAccountsRemoved)
                    {
                        ClientAccount clientAccount = new ClientAccount();
                        clientAccount = clientAccountRepository.GetClientAccount(item.ClientAccountNumber, item.SourceSystemCode);

                        XmlElement xmlClientAccount = doc.CreateElement("ClientAccount");
                        xmlClientAccountsRemoved.AppendChild(xmlClientAccount);

                        XmlElement xmlSourceSystemCode = doc.CreateElement("SourceSystemCode");
                        xmlSourceSystemCode.InnerText = item.SourceSystemCode;
                        xmlClientAccount.AppendChild(xmlSourceSystemCode);

                        XmlElement xmlClientAccountNumber = doc.CreateElement("ClientAccountNumber");
                        xmlClientAccountNumber.InnerText = item.ClientAccountNumber;
                        xmlClientAccount.AppendChild(xmlClientAccountNumber);

                        XmlElement xmlClientAccountName = doc.CreateElement("ClientAccountName");
                        xmlClientAccountName.InnerText = clientAccount.ClientAccountName;
                        xmlClientAccount.AppendChild(xmlClientAccountName);

                        XmlElement xmlVersionNumber = doc.CreateElement("VersionNumber");
                        xmlVersionNumber.InnerText = item.VersionNumber.ToString();
                        xmlClientAccount.AppendChild(xmlVersionNumber);
                    }
                    root.AppendChild(xmlClientAccountsRemoved);
                }
            }

            string response = string.Empty;

            if (changesExist)
            {
                string adminUserGuid = User.Identity.Name.Split(new[] { '|' })[0];

                var output = (from n in db.spDDAWizard_UpdateClientSubUnitClientAccounts_v1(
                                  clientSubUnit.ClientSubUnitGuid,
                                  System.Xml.Linq.XElement.Parse(doc.OuterXml),
                                  adminUserGuid)
                              select n).ToList();

                foreach (spDDAWizard_UpdateClientSubUnitClientAccounts_v1Result message in output)
                {
                    response += string.Format("{0} {0}", message.MessageText.ToString(), (bool)message.Success);
                }
            }
            return(Json(new
            {
                html = response,
                message = "Success",
                success = true
            }));
        }