//Contexts private IEnumerable <SelectListItem> GetSelectedContexts(ClientDefinedReferenceItem clientDefinedReferenceItem) { ContextRepository contextRepository = new ContextRepository(); IEnumerable <SelectListItem> defaultContexts = new SelectList(contextRepository.GetAllContexts().ToList(), "ContextId", "ContextName"); List <SelectListItem> selectedContexts = new List <SelectListItem>(); foreach (SelectListItem item in defaultContexts) { bool selected = false; if (clientDefinedReferenceItem.ClientDefinedReferenceItemContextIds != null && clientDefinedReferenceItem.ClientDefinedReferenceItemContextIds.Length > 0) { foreach (string contextId in clientDefinedReferenceItem.ClientDefinedReferenceItemContextIds.Split(',')) { if (item.Value == contextId) { selected = true; } } } selectedContexts.Add( new SelectListItem() { Text = item.Text, Value = item.Value, Selected = selected } ); } return(selectedContexts); }
// GET: Create A Single ClientFee 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")); } ClientFeeVM clientFeeVM = new ClientFeeVM(); ClientFee clientFee = new ClientFee(); FeeType feeType = new FeeType(); clientFee.FeeType = feeType; clientFeeVM.ClientFee = clientFee; FeeTypeRepository feeTypeRepository = new FeeTypeRepository(); clientFeeVM.FeeTypes = feeTypeRepository.GetAllFeeTypes().ToList(); GDSRepository gdsRepository = new GDSRepository(); clientFeeVM.GDSs = new SelectList(gdsRepository.GetAllGDSs().ToList(), "GDSCode", "GDSName"); ContextRepository contextRepository = new ContextRepository(); clientFeeVM.Contexts = new SelectList(contextRepository.GetAllContexts().ToList(), "ContextId", "ContextName"); return(View(clientFeeVM)); }
// GET: Edit A Single ClientFee public ActionResult Edit(int id) { //Check Access Rights to Domain if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } ClientFee clientFee = new ClientFee(); clientFee = clientFeeRepository.GetItem(id); //Check Exists if (clientFee == null) { ViewData["ActionMethod"] = "EditGet"; return(View("RecordDoesNotExistError")); } //Change DisplayText for Transaction Fees FeeType feeType = new FeeType(); feeType = clientFee.FeeType; if (feeType.FeeTypeDescription == "Client Fee") { feeType.FeeTypeDescription = "Transaction Fee"; } ClientFeeVM clientFeeVM = new ClientFeeVM(); clientFeeVM.ClientFee = clientFee; GDSRepository gdsRepository = new GDSRepository(); clientFeeVM.GDSs = new SelectList(gdsRepository.GetAllGDSs().ToList(), "GDSCode", "GDSName", clientFee.GDSCode); ContextRepository contextRepository = new ContextRepository(); clientFeeVM.Contexts = new SelectList(contextRepository.GetAllContexts().ToList(), "ContextId", "ContextName", clientFee.ContextId); //Check for missing GDS if (clientFee.GDS == null) { GDS gds = new GDS(); clientFee.GDS = gds; } ClientFeeOutput clientFeeOutput = new ClientFeeOutput(); if (clientFee.ClientFeeOutputs.Count > 0) { clientFeeOutput = clientFeeOutputRepository.GetItem(clientFee.ClientFeeOutputs[0].ClientFeeOutputId); } clientFeeVM.ClientFeeOutput = clientFeeOutput; return(View(clientFeeVM)); }
// GET: /Create public ActionResult Create(string id, string can, string ssc) { ClientSubUnit clientSubUnit = new ClientSubUnit(); clientSubUnit = clientSubUnitRepository.GetClientSubUnit(id); //Check Exists if (clientSubUnit == null) { ViewData["ActionMethod"] = "ListBySubUnitGet"; 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")); } ClientDefinedReferenceItemVM clientDefinedReferenceItemVM = new ClientDefinedReferenceItemVM(); ClientDefinedReferenceItem clientDefinedReferenceItem = new ClientDefinedReferenceItem(); clientDefinedReferenceItemRepository.EditForDisplay(clientDefinedReferenceItem); if (can != null && ssc != null) { ClientSubUnitClientAccount clientSubUnitClientAccount = new ClientSubUnitClientAccount(); clientSubUnitClientAccount = clientSubUnitClientAccountRepository.GetClientSubUnitClientAccount(can, ssc, clientSubUnit.ClientSubUnitGuid); if (clientSubUnitClientAccount != null) { ViewData["ClientSubUnitClientAccountClientAccountName"] = clientSubUnitClientAccount.ClientAccount.ClientAccountName; } clientDefinedReferenceItem.ClientAccountNumber = can; clientDefinedReferenceItem.SourceSystemCode = ssc; } //Products ProductRepository productRepository = new ProductRepository(); clientDefinedReferenceItemVM.Products = new SelectList(productRepository.GetAllProducts().ToList(), "ProductId", "ProductName"); //Contexts ContextRepository contextRepository = new ContextRepository(); clientDefinedReferenceItemVM.Contexts = new SelectList(contextRepository.GetAllContexts().ToList(), "ContextId", "ContextName"); clientDefinedReferenceItem.ClientSubUnitGuid = clientSubUnit.ClientSubUnitGuid; clientDefinedReferenceItemVM.ClientDefinedReferenceItem = clientDefinedReferenceItem; clientDefinedReferenceItemVM.ClientSubUnit = clientSubUnit; return(View(clientDefinedReferenceItemVM)); }
public ActionResult Create(int id) { //Get QueueMinderGroup QueueMinderGroup queueMinderGroup = new QueueMinderGroup(); queueMinderGroup = queueMinderGroupRepository.GetGroup(id); //Check Exists if (queueMinderGroup == null) { ViewData["ActionMethod"] = "CreateGet"; return(View("RecordDoesNotExistError")); } RolesRepository rolesRepository = new RolesRepository(); if (!rolesRepository.HasWriteAccessToQueueMinderGroup(id)) { ViewData["Message"] = "You do not have access to this item"; return(View("Error")); } QueueMinderItemVM queueMinderItemVM = new QueueMinderItemVM(); QueueMinderItem queueMinderItem = new QueueMinderItem(); queueMinderItem.QueueMinderGroup = queueMinderGroup; queueMinderItemVM.QueueMinderItem = queueMinderItem; GDSRepository gDSRepository = new GDSRepository(); SelectList gDSs = new SelectList(gDSRepository.GetAllGDSs().ToList(), "GDSCode", "GDSName"); queueMinderItemVM.GDSs = gDSs; ContextRepository contextRepository = new ContextRepository(); SelectList contexts = new SelectList(contextRepository.GetAllContexts().ToList(), "ContextId", "ContextName"); queueMinderItemVM.Contexts = contexts; //DONT SHOW 17,18,19 UNLESS ROLE ALLOWS QueueMinderTypeRepository queueMinderTypeRepository = new QueueMinderTypeRepository(); SelectList queueMinderTypes = new SelectList(queueMinderTypeRepository.GetAllQueueMinderTypes().ToList(), "QueueMinderTypeId", "QueueMinderTypeDescription"); queueMinderItemVM.QueueMinderTypes = queueMinderTypes; return(View(queueMinderItemVM)); }