コード例 #1
0
        public ActionResult Delete(string id, string csu)
        {
            //Check Exists
            ClientDefinedReferenceItemValue clientDefinedReferenceItemValue = new ClientDefinedReferenceItemValue();

            clientDefinedReferenceItemValue = clientSubUnitClientDefinedReferenceItemValueRepository.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;
            clientDefinedReferenceItemValueVM.ClientDefinedReferenceItem      = clientDefinedReferenceItem;
            clientDefinedReferenceItemValueVM.ClientSubUnit = clientSubUnit;
            clientDefinedReferenceItemValueVM.ClientDefinedReferenceItemValue = clientDefinedReferenceItemValue;

            clientSubUnitRepository.EditGroupForDisplay(clientSubUnit);
            ViewData["ClientTopUnitGuid"]            = clientSubUnit.ClientTopUnitGuid;
            ViewData["ClientTopUnitName"]            = clientSubUnit.ClientTopUnitName;
            ViewData["ClientSubUnitGuid"]            = clientSubUnit.ClientSubUnitGuid;
            ViewData["ClientSubUnitName"]            = clientSubUnit.ClientSubUnitName;
            ViewData["ClientDefinedReferenceItemId"] = clientDefinedReferenceItem.ClientDefinedReferenceItemId ?? "";
            ViewData["ClientDefinedReferenceItemDisplayNameAlias"] = clientDefinedReferenceItem.DisplayNameAlias ?? "";

            return(View(clientDefinedReferenceItemValueVM));
        }
コード例 #2
0
        //Delete Item
        public void Delete(ClientDefinedReferenceItemValue clientDefinedReferenceItemValue)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            db.spDesktopDataAdmin_DeleteClientDefinedReferenceItemValue_v1(
                clientDefinedReferenceItemValue.ClientDefinedReferenceItemValueId,
                clientDefinedReferenceItemValue.VersionNumber,
                adminUserGuid
                );
        }
コード例 #3
0
        //Add Item
        public void Add(ClientDefinedReferenceItemValue clientDefinedReferenceItemValue)
        {
            string adminUserGuid = HttpContext.Current.User.Identity.Name.Split(new[] { '|' })[0];

            db.spDesktopDataAdmin_InsertClientSubUnitClientDefinedReferenceItemValue_v1(
                clientDefinedReferenceItemValue.ClientDefinedReferenceItemId,
                clientDefinedReferenceItemValue.Value,
                clientDefinedReferenceItemValue.ValueDescription,
                adminUserGuid
                );
        }
 public ClientDefinedReferenceItemValueVM(
     ClientDefinedReferenceItemValue clientDefinedReferenceItemValue,
     ClientDefinedReferenceItem clientDefinedReferenceItem,
     ClientSubUnit clientSubUnit,
     ClientSubUnitClientAccount clientSubUnitClientAccount)
 {
     ClientDefinedReferenceItemValue = clientDefinedReferenceItemValue;
     ClientDefinedReferenceItem      = clientDefinedReferenceItem;
     ClientSubUnit = clientSubUnit;
     ClientSubUnitClientAccount = clientSubUnitClientAccount;
 }
コード例 #5
0
        public ActionResult Delete(ClientDefinedReferenceItemValueVM clientDefinedReferenceItemValueVM)
        {
            //Check Access Rights to Domain
            if (!hierarchyRepository.AdminHasDomainWriteAccess(groupName))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            //Check Exists
            ClientDefinedReferenceItemValue clientDefinedReferenceItemValue = new ClientDefinedReferenceItemValue();

            clientDefinedReferenceItemValue = clientSubUnitClientDefinedReferenceItemValueRepository.GetClientDefinedReferenceItemValue(
                clientDefinedReferenceItemValueVM.ClientDefinedReferenceItemValue.ClientDefinedReferenceItemValueId
                );
            if (clientDefinedReferenceItemValue == null)
            {
                ViewData["ActionMethod"] = "DeleteGet";
                return(View("RecordDoesNotExistError"));
            }

            //Delete Item
            try
            {
                clientSubUnitClientDefinedReferenceItemValueRepository.Delete(clientDefinedReferenceItemValue);
            }
            catch (SqlException ex)
            {
                //Versioning Error - go to standard versionError page
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/ClientDefinedReferenceItem.mvc/Delete/" + clientDefinedReferenceItemValue.ClientDefinedReferenceItemValueId.ToString();
                    return(View("VersionError"));
                }
                //Restraint Error - go to standard DeleteError page
                if (ex.Message == "SQLDeleteError")
                {
                    ViewData["ReturnURL"] = "/ClientDefinedReferenceItem.mvc/Delete/" + clientDefinedReferenceItemValue.ClientDefinedReferenceItemValueId.ToString();
                    return(View("DeleteError"));
                }
                //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(RedirectToAction("List", new
            {
                id = clientDefinedReferenceItemValueVM.ClientDefinedReferenceItemValue.ClientDefinedReferenceItemId,
                csu = clientDefinedReferenceItemValueVM.ClientSubUnit.ClientSubUnitGuid
            }));
        }
コード例 #6
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));
        }