public PartialViewResult _subsectorClimateSites(int SubsectorTVItemID, float Radius_km) { ViewBag.MWQMSubsectorClimateSites = null; ViewBag.Radius_km = Radius_km; ViewBag.SubsectorTVItemID = SubsectorTVItemID; ViewBag.TVItemModelList = null; ViewBag.HasSiteAlreadySelected = null; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(SubsectorTVItemID, null, null, null); ViewBag.TVAuth = tvAuth; MWQMSubsectorClimateSites mwqmSubsectorClimateSites = _MWQMSubsectorService.GetMWQMSubsectorClimateSitesDB(SubsectorTVItemID, Radius_km * 1000); ViewBag.MWQMSubsectorClimateSites = mwqmSubsectorClimateSites; bool hasSiteAlreadySelected = mwqmSubsectorClimateSites.ClimateSiteModelUsedAndWithinDistanceModelList.Where(c => c.YearsOfUseText != "").Any(); ViewBag.HasSiteAlreadySelected = hasSiteAlreadySelected; List <TVItemModel> tvItemModelList = _MWQMSubsectorService.GetAdjacentSubsectors(SubsectorTVItemID, 2); ViewBag.TVItemModelList = tvItemModelList; return(PartialView()); }
public PartialViewResult _View(string Q) { SetArgs(Q); ViewBag.URLModel = urlModel; // getting current TVItemModel tvItemModelLocationCurrent = _TVItemService.GetTVItemModelWithTVItemIDDB(urlModel.TVItemIDList[0]); ViewBag.TVItemModelLocationCurrent = tvItemModelLocationCurrent; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = (tvAuth == TVAuthEnum.Error ? TVAuthEnum.NoAccess : tvAuth); // getting children List <TVItemModelAndChildCount> tvItemModelLocationChildrenList = _TVItemService.GetChildrenTVItemModelAndChildCountListWithTVItemIDAndTVTypeDB(urlModel.TVItemIDList[0], GetChildLocation(tvItemModelLocationCurrent.TVType)); ViewBag.TVItemModelLocationChildrenList = tvItemModelLocationChildrenList; // getting parent List <TVItemModel> tvItemModelLocationParentList = _TVItemService.GetParentTVItemModelListWithTVItemIDForLocationDB(urlModel.TVItemIDList[0]); ViewBag.TVItemModelLocationParentList = tvItemModelLocationParentList; ViewBag.HomeController = _HomeController; return(PartialView()); }
public PartialViewResult _contactList(string Q) { SetArgs(Q); ViewBag.URLModel = urlModel; List <TVItemLinkModel> tvItemLinkModelListContact = _ContactService._TVItemLinkService.GetTVItemLinkModelListWithFromTVItemIDDB(urlModel.TVItemIDList[0]).Where(c => c.ToTVType == TVTypeEnum.Contact).ToList(); List <ContactModel> contactModelList = new List <ContactModel>(); foreach (TVItemLinkModel tvItemLinkModelContact in tvItemLinkModelListContact) { contactModelList.Add(_ContactService.GetContactModelWithContactTVItemIDDB(tvItemLinkModelContact.ToTVItemID)); List <TVItemLinkModel> tvITemLinkModelListTel = _ContactService._TVItemLinkService.GetTVItemLinkModelListWithFromTVItemIDDB(tvItemLinkModelContact.ToTVItemID).Where(c => c.ToTVType == TVTypeEnum.Tel).ToList(); List <TelModel> telModelList = new List <TelModel>(); foreach (TVItemLinkModel tvItemLinkModelTel in tvITemLinkModelListTel) { telModelList.Add(_ContactService._TelService.GetTelModelWithTelTVItemIDDB(tvItemLinkModelTel.ToTVItemID)); } contactModelList[contactModelList.Count - 1].TelList = telModelList; } ViewBag.ContactModelList = contactModelList; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = tvAuth; ViewBag.IsShowMoreInfo = (GetURLVarShowEnumStr(URLVarShowEnum.ShowMoreInfo) == "0" ? false : true); return(PartialView()); }
public void DialogController__dialogPermissions_Test() { foreach (CultureInfo culture in setupData.cultureListGood) { // Arrange controllerAction = "_dialogBasic"; contactModel = contactModelListGood[0]; // Act SetupTest(contactModel, culture, controllerAction); using (TransactionScope ts = new TransactionScope()) { // Act PartialViewResult partialViewResult = controller._dialogPermissions(TVAuthEnum.Write) as PartialViewResult; // Assert Assert.IsNotNull(partialViewResult); TVAuthEnum tvAuth = (TVAuthEnum)partialViewResult.ViewBag.TVAuth; Assert.AreEqual(TVAuthEnum.Write, tvAuth); List <ContactModel> contactModelListAdmin = (List <ContactModel>)partialViewResult.ViewBag.AdminContactModelList; Assert.IsTrue(contactModelListAdmin.Count > 0); Assert.IsTrue(contactModelListAdmin.Where(c => c.LastName == "LeBlanc").Any()); DialogController dialogController = (DialogController)partialViewResult.ViewBag.DialogController; Assert.IsNotNull(dialogController); } } }
public void TVTypeUserAuthorizationExtraB_Every_Property_Has_Get_Set_Test() { string val1 = "Some text"; tVTypeUserAuthorizationExtraB.TVTypeUserAuthorizationReportTest = val1; Assert.AreEqual(val1, tVTypeUserAuthorizationExtraB.TVTypeUserAuthorizationReportTest); string val2 = "Some text"; tVTypeUserAuthorizationExtraB.ContactName = val2; Assert.AreEqual(val2, tVTypeUserAuthorizationExtraB.ContactName); string val3 = "Some text"; tVTypeUserAuthorizationExtraB.LastUpdateContactText = val3; Assert.AreEqual(val3, tVTypeUserAuthorizationExtraB.LastUpdateContactText); string val4 = "Some text"; tVTypeUserAuthorizationExtraB.TVTypeText = val4; Assert.AreEqual(val4, tVTypeUserAuthorizationExtraB.TVTypeText); string val5 = "Some text"; tVTypeUserAuthorizationExtraB.TVAuthText = val5; Assert.AreEqual(val5, tVTypeUserAuthorizationExtraB.TVAuthText); int val6 = 45; tVTypeUserAuthorizationExtraB.TVTypeUserAuthorizationID = val6; Assert.AreEqual(val6, tVTypeUserAuthorizationExtraB.TVTypeUserAuthorizationID); int val7 = 45; tVTypeUserAuthorizationExtraB.ContactTVItemID = val7; Assert.AreEqual(val7, tVTypeUserAuthorizationExtraB.ContactTVItemID); TVTypeEnum val8 = (TVTypeEnum)3; tVTypeUserAuthorizationExtraB.TVType = val8; Assert.AreEqual(val8, tVTypeUserAuthorizationExtraB.TVType); TVAuthEnum val9 = (TVAuthEnum)3; tVTypeUserAuthorizationExtraB.TVAuth = val9; Assert.AreEqual(val9, tVTypeUserAuthorizationExtraB.TVAuth); DateTime val10 = new DateTime(2010, 3, 4); tVTypeUserAuthorizationExtraB.LastUpdateDate_UTC = val10; Assert.AreEqual(val10, tVTypeUserAuthorizationExtraB.LastUpdateDate_UTC); int val11 = 45; tVTypeUserAuthorizationExtraB.LastUpdateContactTVItemID = val11; Assert.AreEqual(val11, tVTypeUserAuthorizationExtraB.LastUpdateContactTVItemID); bool val12 = true; tVTypeUserAuthorizationExtraB.HasErrors = val12; Assert.AreEqual(val12, tVTypeUserAuthorizationExtraB.HasErrors); IEnumerable <ValidationResult> val39 = new List <ValidationResult>() { new ValidationResult("First CSSPError Message") }.AsEnumerable(); tVTypeUserAuthorizationExtraB.ValidationResults = val39; Assert.AreEqual(val39, tVTypeUserAuthorizationExtraB.ValidationResults); }
public PartialViewResult _dialogPermissions(TVAuthEnum TVAuth) { ViewBag.TVAuth = TVAuth; List <ContactModel> adminContactModelList = _ContactService.GetAdminContactModelListDB(); ViewBag.AdminContactModelList = adminContactModelList; ViewBag.DialogController = _DialogController; return(PartialView()); }
public PartialViewResult _tideSiteTopPage(int SubsectorTVItemID) { ViewBag.SubsectorTVItemID = SubsectorTVItemID; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(SubsectorTVItemID, null, null, null); ViewBag.TVAuth = tvAuth; ViewBag.IsShowMap = (GetURLVarShowEnumStr(URLVarShowEnum.ShowMap) == "0" ? false : true); return(PartialView()); }
public virtual TVAuthEnum GetTVAuthWithTVItemIDAndLoggedInUser(int TVItemID1, int?TVItemID2, int?TVItemID3, int?TVItemID4) { if (TVItemID1 == 0) { return(TVAuthEnum.Error); } ContactModel contactModel = GetContactLoggedInDB(); TVAuthEnum tvAuth = GetTVAuthWithTVItemIDAndContactID(contactModel.ContactTVItemID, TVItemID1, TVItemID2, TVItemID3, TVItemID4); return(tvAuth); }
public PartialViewResult _selectedRunPrecipitation(int SubsectorTVItemID, int MWQMRunTVItemID) { ViewBag.ClimateSitesAndRainsList = null; ViewBag.MWQMRunModel = null; ViewBag.SubsectorTVItemID = SubsectorTVItemID; ViewBag.MWQMRunTVItemID = MWQMRunTVItemID; ViewBag.UseOfSiteModelList = null; ViewBag.ATL_PYR = ""; ViewBag.MWQMSubsectorClimateSites = null; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = tvAuth; ViewBag.IsShowMap = (GetURLVarShowEnumStr(URLVarShowEnum.ShowMap) == "0" ? false : true); MWQMRunModel mwqmRunModel = _MWQMSubsectorService._MWQMRunService.GetMWQMRunModelWithMWQMRunTVItemIDDB(MWQMRunTVItemID); ViewBag.MWQMRunModel = mwqmRunModel; List <ClimateSitesAndRains> climateSiteAndRainsList = _MWQMSubsectorService.GetMWQMSubsectorClimateSitesAndValuesForAParicularRunsDB(SubsectorTVItemID, MWQMRunTVItemID); ViewBag.ClimateSitesAndRainsList = climateSiteAndRainsList; List <UseOfSiteModel> useOfSiteModelList = _UseOfSiteService.GetUseOfSiteModelListWithTVTypeAndSubsectorTVItemIDDB(TVTypeEnum.ClimateSite, SubsectorTVItemID); ViewBag.UseOfSiteModelList = useOfSiteModelList; if (useOfSiteModelList.Count > 0) { List <MapInfoPointModel> mapInfoPointModelList = _MapInfoService._MapInfoPointService.GetMapInfoPointModelListWithTVItemIDAndTVTypeAndMapInfoDrawTypeDB(useOfSiteModelList[0].SiteTVItemID, TVTypeEnum.ClimateSite, MapInfoDrawTypeEnum.Point); if (mapInfoPointModelList.Count > 0) { if (mapInfoPointModelList[0].Lng < -100) { ViewBag.ATL_PYR = "PYR"; } else { ViewBag.ATL_PYR = "ATL"; } } } MWQMSubsectorClimateSites mwqmSubsectorClimateSites = _MWQMSubsectorService.GetMWQMSubsectorClimateSitesDB(SubsectorTVItemID, 1); ViewBag.MWQMSubsectorClimateSites = mwqmSubsectorClimateSites; return(PartialView()); }
public void TVItemUserAuthorization_Every_Property_Has_Get_Set_Test() { int val1 = 45; tVItemUserAuthorization.TVItemUserAuthorizationID = val1; Assert.AreEqual(val1, tVItemUserAuthorization.TVItemUserAuthorizationID); int val2 = 45; tVItemUserAuthorization.ContactTVItemID = val2; Assert.AreEqual(val2, tVItemUserAuthorization.ContactTVItemID); int val3 = 45; tVItemUserAuthorization.TVItemID1 = val3; Assert.AreEqual(val3, tVItemUserAuthorization.TVItemID1); int val4 = 45; tVItemUserAuthorization.TVItemID2 = val4; Assert.AreEqual(val4, tVItemUserAuthorization.TVItemID2); int val5 = 45; tVItemUserAuthorization.TVItemID3 = val5; Assert.AreEqual(val5, tVItemUserAuthorization.TVItemID3); int val6 = 45; tVItemUserAuthorization.TVItemID4 = val6; Assert.AreEqual(val6, tVItemUserAuthorization.TVItemID4); TVAuthEnum val7 = (TVAuthEnum)3; tVItemUserAuthorization.TVAuth = val7; Assert.AreEqual(val7, tVItemUserAuthorization.TVAuth); DateTime val8 = new DateTime(2010, 3, 4); tVItemUserAuthorization.LastUpdateDate_UTC = val8; Assert.AreEqual(val8, tVItemUserAuthorization.LastUpdateDate_UTC); int val9 = 45; tVItemUserAuthorization.LastUpdateContactTVItemID = val9; Assert.AreEqual(val9, tVItemUserAuthorization.LastUpdateContactTVItemID); bool val10 = true; tVItemUserAuthorization.HasErrors = val10; Assert.AreEqual(val10, tVItemUserAuthorization.HasErrors); IEnumerable <ValidationResult> val33 = new List <ValidationResult>() { new ValidationResult("First CSSPError Message") }.AsEnumerable(); tVItemUserAuthorization.ValidationResults = val33; Assert.AreEqual(val33, tVItemUserAuthorization.ValidationResults); }
public PartialViewResult _MovingTVItem(int TVItemID) { TVItemModel tvItemModelCurrent = _TVItemService.GetTVItemModelWithTVItemIDDB(TVItemID); ViewBag.TVItemModelCurrent = tvItemModelCurrent; ViewBag.TVItemController = _TVItemController; ViewBag.TVTypeNamesAndPathList = null; ViewBag.TVItemModelCountryList = null; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(TVItemID, null, null, null); ViewBag.TVAuth = tvAuth; if (tvAuth < TVAuthEnum.Write) { return(PartialView()); } List <TVItemModel> parentTVItemModelList = _TVItemService.GetParentsTVItemModelList(_TVItemService.GetParentTVPath(tvItemModelCurrent.TVPath)); string TVTypeTVPath = _TVItemService.tvTypeNamesAndPathList.Where(c => c.TVTypeName == tvItemModelCurrent.TVType.ToString()).FirstOrDefault().TVPath; TVTypeTVPath = _TVItemService.GetParentTVPath(TVTypeTVPath); List <TVTypeNamesAndPath> tvTypeNamesAndPathList = new List <TVTypeNamesAndPath>(); Dictionary <string, List <TVItemModel> > tvItemModelDictList = new Dictionary <string, List <TVItemModel> >(); ViewBag.ParentTVItemModelList = parentTVItemModelList; if (string.IsNullOrWhiteSpace(tvItemModelCurrent.Error)) { tvTypeNamesAndPathList = _TVItemService.GetTVTypeNamesAndPathParentsWithTVType(TVTypeTVPath); if (tvTypeNamesAndPathList.Count != parentTVItemModelList.Count) { return(PartialView()); } for (int i = 0, count = parentTVItemModelList.Count - 1; i < count; i++) { tvItemModelDictList.Add(tvTypeNamesAndPathList[i + 1].TVTypeName, _TVItemService.GetChildrenTVItemModelListWithTVItemIDAndTVTypeDB(parentTVItemModelList[i].TVItemID, ((TVTypeEnum)tvTypeNamesAndPathList[i + 1].Index))); } } ViewBag.TVTypeNamesAndPathList = tvTypeNamesAndPathList; ViewBag.TVItemModelDictList = tvItemModelDictList; return(PartialView()); }
public ActionResult _visualPlumesList(string Q) { SetArgs(Q); ViewBag.URLModel = urlModel; List <VPScenarioModel> vpScenarioModelList = _VPScenarioService.GetVPScenarioModelListWithInfrastructureTVItemIDDB(urlModel.TVItemIDList[0]); ViewBag.VPScenarioModelList = vpScenarioModelList; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = tvAuth; return(PartialView()); }
public PartialViewResult _emailDistributionListAddOrModify(int ParentTVItemID, int EmailDistributionListID) { ViewBag.ParentTVItemID = ParentTVItemID; ViewBag.EmailDistributionListModel = null; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = tvAuth; EmailDistributionListModel emailDistributionListModel = _EmailDistributionListService.GetEmailDistributionListModelWithEmailDistributionListIDDB(EmailDistributionListID); ViewBag.EmailDistributionListModel = emailDistributionListModel; return(PartialView()); }
public PartialViewResult _runsAndClimateSitePrecipitation(int SubsectorTVItemID) { ViewBag.SubsectorTVItemID = SubsectorTVItemID; ViewBag.MWQMMRunModelList = null; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(SubsectorTVItemID, null, null, null); ViewBag.TVAuth = tvAuth; List <MWQMRunModel> mwqmRunModelList = _MWQMRunService.GetMWQMRunModelListWithSubsectorTVItemIDDB(SubsectorTVItemID).OrderByDescending(c => c.DateTime_Local).ToList(); ViewBag.MWQMRunModelList = mwqmRunModelList; return(PartialView()); }
public PartialViewResult _boxModelList(string Q) { SetArgs(Q); ViewBag.URLModel = urlModel; List <BoxModelModel> boxModelModelList = _BoxModelService.GetBoxModelModelOrderByScenarioNameDB(urlModel.TVItemIDList[0]); ViewBag.BoxModelModelList = boxModelModelList; ViewBag.BoxModelController = _BoxModelController; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = tvAuth; return(PartialView()); }
public ActionResult _polSourceSite(string Q) { SetArgs(Q); ViewBag.URLModel = urlModel; ViewBag.AddressModel = null; TVItemModel tvItemModelLocationCurrent = _TVItemService.GetTVItemModelWithTVItemIDDB(urlModel.TVItemIDList[0]); ViewBag.TVItemModelLocationCurrent = tvItemModelLocationCurrent; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = tvAuth; List <TabInfo> tabInfoList = GetTab1ViewTVItemInfoDB(tvItemModelLocationCurrent, tvAuth); ViewBag.TabInfoList = tabInfoList; ViewBag.PolSourceController = _PolSourceController; PolSourceSiteModel polSourceSiteModel = _PolSourceSiteService.GetPolSourceSiteModelWithPolSourceSiteTVItemIDDB(urlModel.TVItemIDList[0]); ViewBag.PolSourceSiteModel = polSourceSiteModel; List <PolSourceObservationModel> polSourceObservationModelList = _PolSourceSiteService._PolSourceObservationService.GetPolSourceObservationModelListWithPolSourceSiteIDDB(polSourceSiteModel.PolSourceSiteID).OrderByDescending(c => c.ObservationDate_Local).OrderByDescending(c => c.LastUpdateDate_UTC).ToList(); foreach (PolSourceObservationModel polSourceObservationModel in polSourceObservationModelList) { polSourceObservationModel.PolSourceObservationIssueModelList = _PolSourceSiteService._PolSourceObservationService._PolSourceObservationIssueService.GetPolSourceObservationIssueModelListWithPolSourceObservationIDDB(polSourceObservationModel.PolSourceObservationID); } ViewBag.PolSourceObservationModelList = polSourceObservationModelList; List <MapInfoPointModel> mapInfoPointModelList = _MapInfoService._MapInfoPointService.GetMapInfoPointModelListWithTVItemIDAndTVTypeAndMapInfoDrawTypeDB(urlModel.TVItemIDList[0], TVTypeEnum.PolSourceSite, MapInfoDrawTypeEnum.Point); ViewBag.MapInfoPointModel = mapInfoPointModelList[0]; if (polSourceSiteModel.CivicAddressTVItemID != null) { AddressModel addressModel = _AddressService.GetAddressModelWithAddressTVItemIDDB((int)polSourceSiteModel.CivicAddressTVItemID); ViewBag.AddressModel = addressModel; } return(PartialView()); }
public PartialViewResult _exportArcGIS(string Q) { ViewBag.URLModel = null; ViewBag.TVFileModelList = null; ViewBag.FilePurposeAndTextList = null; ViewBag.TVItemModel = null; ViewBag.TVAuth = null; ViewBag.NumberOfSample = null; ViewBag.IsShowMoreInfo = null; ViewBag.TVItemModelProvList = null; SetArgs(Q); ViewBag.URLModel = urlModel; List <TVFileModel> tvFileModelList = _TVFileService.GetTVFileModelListWithParentTVItemIDDB(urlModel.TVItemIDList[0]); ViewBag.TVFileModelList = tvFileModelList; List <FilePurposeAndText> filePurposeAndTextList = FillFilePurposeAndTextList(); ViewBag.FilePurposeAndTextList = filePurposeAndTextList.OrderBy(c => c.FilePurposeText).ToList(); TVItemModel tvItemModel = _TVItemService.GetTVItemModelWithTVItemIDDB(urlModel.TVItemIDList[0]); ViewBag.TVItemModel = tvItemModel; if (string.IsNullOrWhiteSpace(tvItemModel.Error)) { List <TVItemModel> tvItemModelProvList = _TVItemService.GetChildrenTVItemModelListWithTVItemIDAndTVTypeDB(tvItemModel.TVItemID, TVTypeEnum.Province).OrderBy(c => c.TVText).ToList(); ViewBag.TVItemModelProvList = tvItemModelProvList; } TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = tvAuth; ViewBag.NumberOfSample = int.Parse(GetURLVarShowEnumStr(URLVarShowEnum.NumberOfSampleDecade) + GetURLVarShowEnumStr(URLVarShowEnum.NumberOfSampleUnit)); ViewBag.IsShowMoreInfo = (GetURLVarShowEnumStr(URLVarShowEnum.ShowMoreInfo) == "0" ? false : true); return(PartialView()); }
public PartialViewResult _rainExceedance(string Q) { SetArgs(Q); ViewBag.URLModel = urlModel; ViewBag.ParentTVItemID = urlModel.TVItemIDList[0]; ViewBag.RainExceedanceModelList = null; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = tvAuth; ViewBag.IsShowMap = (GetURLVarShowEnumStr(URLVarShowEnum.ShowMap) == "0" ? false : true); List <RainExceedanceModel> rainExceedanceModelList = _RainExceedanceService.GetRainExceedanceModelListDB(); ViewBag.RainExceedanceModelList = rainExceedanceModelList; return(PartialView()); }
public void FileController__fileList_Test() { foreach (CultureInfo culture in setupData.cultureListGood) { controllerAction = "_fileList"; contactModel = contactModelListGood[0]; SetupTest(contactModel, culture, controllerAction); using (TransactionScope ts = new TransactionScope()) { TVItemModel tvItemModel = tvItemService.GetRootTVItemModelDB(); Assert.AreEqual("", tvItemModel.Error); string Q = "!View/All Location|||" + tvItemModel.TVItemID; PartialViewResult partialViewResult = controller._fileList(Q) as PartialViewResult; Assert.IsNotNull(partialViewResult); URLModel urlModelRet = (URLModel)partialViewResult.ViewBag.URLModel; Assert.IsNotNull(urlModelRet); List <TVFileModel> tvFileModelList = (List <TVFileModel>)partialViewResult.ViewBag.TVFileModelList; Assert.IsNotNull(tvFileModelList); List <FilePurposeAndText> filePurposeAndTextList = (List <FilePurposeAndText>)partialViewResult.ViewBag.FilePurposeAndTextList; Assert.IsNotNull(filePurposeAndTextList); TVItemModel tvItemModelRet = (TVItemModel)partialViewResult.ViewBag.TVItemModel; Assert.AreEqual("", tvItemModelRet.Error); TVAuthEnum TVAuthRet = (TVAuthEnum)partialViewResult.ViewBag.TVAuth; Assert.AreEqual(TVAuthEnum.Admin, TVAuthRet); int NumberOfSampleRet = (int)partialViewResult.ViewBag.NumberOfSample; Assert.AreEqual(30, NumberOfSampleRet); bool IsShowMoreInfoRet = (bool)partialViewResult.ViewBag.IsShowMoreInfo; Assert.IsFalse(IsShowMoreInfoRet); } } }
public PartialViewResult _infrastructureList(string Q) { SetArgs(Q); ViewBag.URLModel = urlModel; List <TVItemModelInfrastructureTypeTVItemLinkModel> tvItemModelInfrastructureTypeTVItemLinkList = _InfrastructureService.GetInfrastructureTVItemAndTVItemLinkAndInfrastructureTypeListWithMunicipalityTVItemIDDB(urlModel.TVItemIDList[0]); ViewBag.TVItemModelInfrastructureTypeTVItemLinkModelList = tvItemModelInfrastructureTypeTVItemLinkList; ViewBag.InfrastructureController = _InfrastructureController; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = tvAuth; ViewBag.IsShowMoreInfo = (GetURLVarShowEnumStr(URLVarShowEnum.ShowMoreInfo) == "0" ? false : true); ViewBag.IsShowMap = (GetURLVarShowEnumStr(URLVarShowEnum.ShowMap) == "0" ? false : true); return(PartialView()); }
public PartialViewResult _subsectorMunicipalities(int SubsectorTVItemID, float Radius_km) { ViewBag.MWQMSubsectorMunicipalities = null; ViewBag.Radius_km = Radius_km; ViewBag.SubsectorTVItemID = SubsectorTVItemID; ViewBag.TVItemModelList = null; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(SubsectorTVItemID, null, null, null); ViewBag.TVAuth = tvAuth; MWQMSubsectorMunicipalities mwqmSubsectorMunicipalities = _MWQMSubsectorService.GetMWQMSubsectorMunicipalitiesDB(SubsectorTVItemID, Radius_km * 1000); ViewBag.MWQMSubsectorMunicipalities = mwqmSubsectorMunicipalities; List <TVItemModel> tvItemModelList = _MWQMSubsectorService.GetAdjacentSubsectors(SubsectorTVItemID, 2); ViewBag.TVItemModelList = tvItemModelList; return(PartialView()); }
public PartialViewResult _emailDistributionList(string Q) { SetArgs(Q); ViewBag.URLModel = urlModel; ViewBag.ParentTVItemID = urlModel.TVItemIDList[0]; ViewBag.EmailDistributionListController = _EmailDistributionListController; ViewBag.EmailDistributionListModelList = null; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = tvAuth; ViewBag.IsShowMap = (GetURLVarShowEnumStr(URLVarShowEnum.ShowMap) == "0" ? false : true); List <EmailDistributionListModel> emailDistributionListModelList = _EmailDistributionListService.GetEmailDistributionListModelWithParentTVItemIDDB(urlModel.TVItemIDList[0]); ViewBag.EmailDistributionListModelList = emailDistributionListModelList; return(PartialView()); }
public PartialViewResult _tabContent(string Q) { SetArgs(Q); ViewBag.URLModel = urlModel; TVItemModel tvItemModelLocationCurrent = _TVItemService.GetTVItemModelWithTVItemIDDB(urlModel.TVItemIDList[0]); ViewBag.TVItemModelLocationCurrent = tvItemModelLocationCurrent; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = tvAuth; List <TabInfo> tabInfoList = GetTab1ViewTVItemInfoDB(tvItemModelLocationCurrent, tvAuth); ViewBag.TabInfoList = tabInfoList; ViewBag.TVItemController = _TVItemController; return(PartialView()); }
public JsonResult GetMapInfoJSON(string Q) { SetArgs(Q); ViewBag.URLModel = urlModel; bool AllSites = (GetURLVarShowEnumStr(URLVarShowEnum.ShowAll) == "1" ? false : true); TVItemModel tvItemModelLocationCurrent = _TVItemService.GetTVItemModelWithTVItemIDDB(urlModel.TVItemIDList[0]); TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); List <TabInfo> Tab1ViewTVItemInfoList = GetTab1ViewTVItemInfoDB(tvItemModelLocationCurrent, tvAuth); TVTypeEnum ShowTVType = Tab1ViewTVItemInfoList[int.Parse(Tab1ViewTVItemInfoList[0].Active)].ShowTVType; // Year, Month, Day not used int NumberOfSamples = int.Parse(GetURLVarShowEnumStr(URLVarShowEnum.NumberOfSampleDecade) + GetURLVarShowEnumStr(URLVarShowEnum.NumberOfSampleUnit)); List <TVLocation> tvLocationList = _MapInfoService.GetMapInfoDB(urlModel.TVItemIDList[0], ShowTVType, 2000, 1, 1, NumberOfSamples, AllSites); return(Json(tvLocationList, JsonRequestBehavior.AllowGet)); }
public PartialViewResult _climateSitePriorities(int SubsectorTVItemID) { ViewBag.SubsectorTVItemID = SubsectorTVItemID; ViewBag.SmallestYearOfSampling = null; ViewBag.ClimateSiteYearsOrderList = null; ViewBag.SmallestYearOfSampling = null; ViewBag.ClimateSiteUseOfSiteModelList = null; ViewBag.RunYears = null; ViewBag.MWQMSubsectorClimateSites = null; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(SubsectorTVItemID, null, null, null); ViewBag.TVAuth = tvAuth; int SmallestYearOfSampling = DateTime.Now.Year; ViewBag.SmallestYearOfSampling = SmallestYearOfSampling; List <MWQMRunModel> mwqmRunModelList = _MWQMRunService.GetMWQMRunModelListWithSubsectorTVItemIDDB(SubsectorTVItemID); if (mwqmRunModelList.Count > 0) { SmallestYearOfSampling = mwqmRunModelList.OrderBy(c => c.DateTime_Local).FirstOrDefault().DateTime_Local.Year; ViewBag.SmallestYearOfSampling = SmallestYearOfSampling; int CurrentYear = DateTime.Now.Year; } List <ClimateSiteUseOfSiteModel> climateSiteUseOfSiteModelList = _MWQMSubsectorService.GetClimateSiteUseOfSiteModelList(SubsectorTVItemID, SmallestYearOfSampling); ViewBag.ClimateSiteUseOfSiteModelList = climateSiteUseOfSiteModelList; List <int> runYears = _MWQMSubsectorService.GetMWQMSubsectorRunsYears(SubsectorTVItemID); ViewBag.RunYears = runYears; MWQMSubsectorClimateSites mwqmSubsectorClimateSites = _MWQMSubsectorService.GetMWQMSubsectorClimateSitesDB(SubsectorTVItemID, 1); ViewBag.MWQMSubsectorClimateSites = mwqmSubsectorClimateSites; return(PartialView()); }
public PartialViewResult _fileList(string Q) { ViewBag.URLModel = null; ViewBag.TVFileModelList = null; ViewBag.FilePurposeAndTextList = null; ViewBag.TVItemModel = null; ViewBag.TVAuth = null; //ViewBag.Tab1ViewTVItemInfoList = null; ViewBag.NumberOfSample = null; ViewBag.IsShowMoreInfo = null; SetArgs(Q); ViewBag.URLModel = urlModel; List <TVFileModel> tvFileModelList = _TVFileService.GetTVFileModelListWithParentTVItemIDDB(urlModel.TVItemIDList[0]); ViewBag.TVFileModelList = tvFileModelList; List <FilePurposeAndText> filePurposeAndTextList = FillFilePurposeAndTextList(); ViewBag.FilePurposeAndTextList = filePurposeAndTextList.OrderBy(c => c.FilePurposeText).ToList(); TVItemModel tvItemModel = _TVItemService.GetTVItemModelWithTVItemIDDB(urlModel.TVItemIDList[0]); ViewBag.TVItemModel = tvItemModel; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = tvAuth; //List<TabInfo> Tab1ViewTVItemInfoList = GetTab1ViewTVItemInfoDB(tvItemModel, tvAuth); //ViewBag.Tab1ViewTVItemInfoList = Tab1ViewTVItemInfoList; ViewBag.NumberOfSample = int.Parse(GetURLVarShowEnumStr(URLVarShowEnum.NumberOfSampleDecade) + GetURLVarShowEnumStr(URLVarShowEnum.NumberOfSampleUnit)); ViewBag.IsShowMoreInfo = (GetURLVarShowEnumStr(URLVarShowEnum.ShowMoreInfo) == "0" ? false : true); return(PartialView()); }
public void TVItemTVAuth_Every_Property_Has_Get_Set_Test() { int val1 = 45; tVItemTVAuth.TVItemUserAuthID = val1; Assert.AreEqual(val1, tVItemTVAuth.TVItemUserAuthID); string val2 = "Some text"; tVItemTVAuth.TVText = val2; Assert.AreEqual(val2, tVItemTVAuth.TVText); int val3 = 45; tVItemTVAuth.TVItemID1 = val3; Assert.AreEqual(val3, tVItemTVAuth.TVItemID1); string val4 = "Some text"; tVItemTVAuth.TVTypeStr = val4; Assert.AreEqual(val4, tVItemTVAuth.TVTypeStr); TVAuthEnum val5 = (TVAuthEnum)3; tVItemTVAuth.TVAuth = val5; Assert.AreEqual(val5, tVItemTVAuth.TVAuth); string val6 = "Some text"; tVItemTVAuth.TVAuthText = val6; Assert.AreEqual(val6, tVItemTVAuth.TVAuthText); bool val7 = true; tVItemTVAuth.HasErrors = val7; Assert.AreEqual(val7, tVItemTVAuth.HasErrors); IEnumerable <ValidationResult> val24 = new List <ValidationResult>() { new ValidationResult("First CSSPError Message") }.AsEnumerable(); tVItemTVAuth.ValidationResults = val24; Assert.AreEqual(val24, tVItemTVAuth.ValidationResults); }
public virtual TVAuthEnum GetTVAuthWithTVItemIDAndContactID(int ContactTVItemID, int TVItemID1, int?TVItemID2, int?TVItemID3, int?TVItemID4) { if (TVItemID1 == 0) { return(TVAuthEnum.Error); } if (ContactTVItemID == 0) { return(TVAuthEnum.Error); } TVItemService tvItemService = new TVItemService(LanguageRequest, User); TVTypeUserAuthorizationService tvTypeUserAuthorizationService = new TVTypeUserAuthorizationService(LanguageRequest, User); TVItemUserAuthorizationService tvItemUserAuthorizationService = new TVItemUserAuthorizationService(LanguageRequest, User); TVItemModel tvItemModel = tvItemService.GetTVItemModelWithTVItemIDDB(TVItemID1); if (!string.IsNullOrWhiteSpace(tvItemModel.Error)) { return(TVAuthEnum.Error); } List <TVTypeUserAuthorizationModel> tvTypeUserAuthorizationModelList = tvTypeUserAuthorizationService.GetTVTypeUserAuthorizationModelListWithContactTVItemIDDB(ContactTVItemID); if (tvTypeUserAuthorizationModelList.Count == 0) { return(TVAuthEnum.Error); } if (tvTypeUserAuthorizationModelList[0].TVType != TVTypeEnum.Root) { return(TVAuthEnum.Error); } List <TVItemUserAuthorizationModel> tvItemUserAuthorizationModelList = tvItemUserAuthorizationService.GetTVItemUserAuthorizationModelListWithContactTVItemIDDB(ContactTVItemID); if (tvItemModel.TVType == TVTypeEnum.File) { tvItemModel = tvItemService.GetTVItemModelWithTVItemIDDB(tvItemModel.ParentID); } int TVLevelCurrent = tvItemModel.TVLevel; string TVPathType = tvItemService.tvTypeNamesAndPathList.Where(c => c.Index == (int)tvItemModel.TVType).FirstOrDefault().TVPath; TVAuthEnum tvAuth = TVAuthEnum.Error; foreach (TVTypeUserAuthorizationModel tvTypeUserAuthorizationModel in tvTypeUserAuthorizationModelList) { if (TVPathType.Length >= tvTypeUserAuthorizationModel.TVPath.Length) { if (TVPathType.StartsWith(tvTypeUserAuthorizationModel.TVPath)) { tvAuth = tvTypeUserAuthorizationModel.TVAuth; } } } foreach (TVItemUserAuthorizationModel tvItemUserAuthorizationModel in tvItemUserAuthorizationModelList) { if (tvItemModel.TVPath.Length >= tvItemUserAuthorizationModel.TVPath1.Length) { if (tvItemModel.TVPath.StartsWith(tvItemUserAuthorizationModel.TVPath1)) { tvAuth = tvItemUserAuthorizationModel.TVAuth; } } } return(tvAuth); }
public PartialViewResult _content(string Q) { TVTypeEnum tvType = TVTypeEnum.Error; List <string> OptionListTxt = new List <string>() { "10", "15", "20", "25", "30", "35", "40" }; SetArgs(Q); ViewBag.URLModel = urlModel; if (!OptionListTxt.Contains(urlModel.VariableShow.Substring(0, 2))) { urlModel.VariableShow = "30" + urlModel.VariableShow.Substring(2); } string url = ""; List <int> OptionList = new List <int>() { 10, 15, 20, 25, 30, 35, 40 }; List <URLNumberOfSamples> urlNumberOfSamplesList = new List <URLNumberOfSamples>(); foreach (int option in OptionList) { SetVariableShow(URLVarShowEnum.NumberOfSampleDecade, option.ToString().Substring(0, 1)); SetVariableShow(URLVarShowEnum.NumberOfSampleUnit, option.ToString().Substring(1, 1)); url = CreateHashURL(urlModel.TVItemIDList[0]); urlNumberOfSamplesList.Add(new URLNumberOfSamples() { NumberOfSamples = option, url = CreateHashURL(urlModel.TVItemIDList[0]) }); } SetArgs(Q); ViewBag.URLModel = urlModel; if (!OptionListTxt.Contains(urlModel.VariableShow.Substring(0, 2))) { urlModel.VariableShow = "30" + urlModel.VariableShow.Substring(2); } ViewBag.URLNumberOfSamplesList = urlNumberOfSamplesList; TVAuthEnum tvAuth = _TVItemService.GetTVAuthWithTVItemIDAndLoggedInUser(urlModel.TVItemIDList[0], null, null, null); ViewBag.TVAuth = tvAuth; TVItemModel tvItemModelLocationCurrent = _TVItemService.GetTVItemModelWithTVItemIDDB(urlModel.TVItemIDList[0]); ViewBag.TVItemModelLocationCurrent = tvItemModelLocationCurrent; List <TabInfo> tabInfoList = GetTab1ViewTVItemInfoDB(tvItemModelLocationCurrent, tvAuth); ViewBag.TabInfoList = tabInfoList; ViewBag.NumberOfSample = int.Parse(GetURLVarShowEnumStr(URLVarShowEnum.NumberOfSampleDecade) + GetURLVarShowEnumStr(URLVarShowEnum.NumberOfSampleUnit)); ContentActionAndController contentActionAndController = GetContentActionAndController(tvItemModelLocationCurrent, tabInfoList); ViewBag.ContentActionAndController = contentActionAndController; ViewBag.IsShowMoreInfo = (GetURLVarShowEnumStr(URLVarShowEnum.ShowMoreInfo) == "0" ? false : true); ViewBag.IsShowMap = (GetURLVarShowEnumStr(URLVarShowEnum.ShowMap) == "0" ? false : true); ViewBag.AllSites = (GetURLVarShowEnumStr(URLVarShowEnum.ShowAll) == "0" ? false : true); if (ViewBag.AllSites) { ViewBag.ActiveURL = CreateTempVariableShowHashURL(URLVarShowEnum.ShowAll, "0", "1"); } else { ViewBag.ActiveURL = CreateTempVariableShowHashURL(URLVarShowEnum.ShowAll, "1", "0"); } ViewBag.OrderByDateModified = false; List <TVTypeEnum> tvTypeWithMunicipalityList = new List <TVTypeEnum>() { TVTypeEnum.Province }; List <TVItemModelAndChildCount> tvItemModelLocationChildrenList = new List <TVItemModelAndChildCount>(); List <int> TVItemIDWithInfrastructureList = new List <int>(); if (tvTypeWithMunicipalityList.Contains(tvItemModelLocationCurrent.TVType) && tabInfoList.FirstOrDefault().Active == "1") { tvItemModelLocationChildrenList = _TVItemService.GetChildrenTVItemModelAndChildCountListWithTVItemIDAndTVTypeDB(urlModel.TVItemIDList[0], TVTypeEnum.Municipality); tvType = TVTypeEnum.Municipality; TVItemIDWithInfrastructureList = _TVItemService.GetMunicipalityTVItemIDListWithInfrastructureUnder(urlModel.TVItemIDList[0]); } else if (tvItemModelLocationCurrent.TVType == TVTypeEnum.Municipality && tabInfoList.FirstOrDefault().Active == "1") { List <TVItemModelAndChildCount> tvItemModelLocationChildrenTempList = _TVItemService.GetChildrenTVItemModelAndChildCountListWithTVItemIDAndTVTypeDB(urlModel.TVItemIDList[0], TVTypeEnum.MikeScenario); tvType = TVTypeEnum.MikeScenario; ViewBag.MikeScenarioModelList = new List <MikeScenarioModel>(); if (ViewBag.AllSites) { List <MikeScenarioModel> mikeScenarioModelTempList = _MikeScenarioService.GetMikeScenarioModelListWithParentTVItemIDDB(urlModel.TVItemIDList[0]); if (mikeScenarioModelTempList.Count > 0) { if (string.IsNullOrWhiteSpace(mikeScenarioModelTempList[0].Error)) { List <MikeScenarioModel> mikeScenarioModelList = mikeScenarioModelTempList.OrderByDescending(c => c.MikeScenarioStartDateTime_Local).ToList(); foreach (MikeScenarioModel mikeScenarioModel in mikeScenarioModelList) { TVItemModelAndChildCount tvItemModelAndChildCount = tvItemModelLocationChildrenTempList.Where(c => c.TVItemID == mikeScenarioModel.MikeScenarioTVItemID).FirstOrDefault(); if (tvItemModelAndChildCount != null) { tvItemModelLocationChildrenList.Add(tvItemModelAndChildCount); } } ViewBag.MikeScenarioModelList = mikeScenarioModelList; } } } else { tvItemModelLocationChildrenList = tvItemModelLocationChildrenTempList; } } else if (tvItemModelLocationCurrent.TVType == TVTypeEnum.Sector && tabInfoList.FirstOrDefault().Active == "2") { List <TVItemModelAndChildCount> tvItemModelLocationChildrenTempList = _TVItemService.GetChildrenTVItemModelAndChildCountListWithTVItemIDAndTVTypeOnlyOneLevelDownDB(urlModel.TVItemIDList[0], TVTypeEnum.MikeScenario); tvType = TVTypeEnum.MikeScenario; ViewBag.MikeScenarioModelList = new List <MikeScenarioModel>(); if (ViewBag.AllSites) { List <MikeScenarioModel> mikeScenarioModelTempList = _MikeScenarioService.GetMikeScenarioModelListWithParentTVItemIDDB(urlModel.TVItemIDList[0]); if (mikeScenarioModelTempList.Count > 0) { if (string.IsNullOrWhiteSpace(mikeScenarioModelTempList[0].Error)) { List <MikeScenarioModel> mikeScenarioModelList = mikeScenarioModelTempList.OrderByDescending(c => c.MikeScenarioStartDateTime_Local).ToList(); foreach (MikeScenarioModel mikeScenarioModel in mikeScenarioModelList) { TVItemModelAndChildCount tvItemModelAndChildCount = tvItemModelLocationChildrenTempList.Where(c => c.TVItemID == mikeScenarioModel.MikeScenarioTVItemID).FirstOrDefault(); if (tvItemModelAndChildCount != null) { tvItemModelLocationChildrenList.Add(tvItemModelAndChildCount); } } ViewBag.MikeScenarioModelList = mikeScenarioModelList; } } } else { tvItemModelLocationChildrenList = tvItemModelLocationChildrenTempList; } } else if (tvItemModelLocationCurrent.TVType == TVTypeEnum.MWQMSite && tabInfoList.FirstOrDefault().Active == "0") { tvItemModelLocationChildrenList = _TVItemService.GetChildrenTVItemModelAndChildCountListWithTVItemIDAndTVTypeDB(urlModel.TVItemIDList[0], TVTypeEnum.MWQMSiteSample); tvType = TVTypeEnum.MWQMSiteSample; } else if (tvItemModelLocationCurrent.TVType == TVTypeEnum.Subsector && tabInfoList.FirstOrDefault().Active == "2") { tvItemModelLocationChildrenList = _TVItemService.GetChildrenTVItemModelAndChildCountListWithTVItemIDAndTVTypeDB(urlModel.TVItemIDList[0], TVTypeEnum.MWQMRun).OrderByDescending(c => c.TVText).ToList(); tvType = TVTypeEnum.MWQMRun; } else if (tvItemModelLocationCurrent.TVType == TVTypeEnum.Subsector && tabInfoList.FirstOrDefault().Active == "3") { tvItemModelLocationChildrenList = _TVItemService.GetChildrenTVItemModelAndChildCountListWithTVItemIDAndTVTypeDB(urlModel.TVItemIDList[0], TVTypeEnum.PolSourceSite); tvType = TVTypeEnum.PolSourceSite; ViewBag.OrderByDateModified = (GetURLVarShowEnumStr(URLVarShowEnum.ShowOrderByDateModified) == "0" ? false : true); if (ViewBag.OrderByDateModified) { ViewBag.OrderByDateModifiedURL = CreateTempVariableShowHashURL(URLVarShowEnum.ShowOrderByDateModified, "0", "1"); } else { ViewBag.OrderByDateModifiedURL = CreateTempVariableShowHashURL(URLVarShowEnum.ShowOrderByDateModified, "1", "0"); } if (ViewBag.OrderByDateModified) { tvItemModelLocationChildrenList = tvItemModelLocationChildrenList.OrderByDescending(c => c.LastUpdateDate_UTC).ToList(); } } //else if (tvItemModelLocationCurrent.TVType == TVTypeEnum.Subsector && tabInfoList.FirstOrDefault().Active == "4") //{ // tvItemModelLocationChildrenList = _TVItemService.GetChildrenTVItemModelAndChildCountListWithTVItemIDAndTVTypeDB(urlModel.TVItemIDList[0], TVTypeEnum.Municipality); // tvType = TVTypeEnum.Municipality; //} else { tvItemModelLocationChildrenList = _TVItemService.GetChildrenTVItemModelAndChildCountListWithTVItemIDAndTVTypeDB(urlModel.TVItemIDList[0], GetChildLocation(tvItemModelLocationCurrent.TVType)); tvType = GetChildLocation(tvItemModelLocationCurrent.TVType); } if (!ViewBag.AllSites) { tvItemModelLocationChildrenList = tvItemModelLocationChildrenList.Where(c => c.IsActive).ToList(); } ViewBag.TVItemModelLocationChildrenList = tvItemModelLocationChildrenList; ViewBag.TVItemIDWithInfrastructureList = TVItemIDWithInfrastructureList; ViewBag.TVItemController = _TVItemController; ViewBag.TVType = tvType; return(PartialView()); }
public void TVItemController__MovingTVItem_Test() { foreach (CultureInfo culture in setupData.cultureListGood) { // Arrange controllerAction = "_MovingTVItem"; contactModel = contactModelListGood[0]; // Act SetupTest(contactModel, culture, controllerAction); using (TransactionScope ts = new TransactionScope()) { // Act TVItemModel tvItemModelRoot = controller._TVItemService.GetRootTVItemModelDB(); // Assert Assert.AreEqual("", tvItemModelRoot.Error); // Act TVItemModel tvItemModelBouctouche = controller._TVItemService.GetChildTVItemModelWithTVItemIDAndTVTextStartWithAndTVTypeDB(tvItemModelRoot.TVItemID, "Bouctouche", TVTypeEnum.Municipality); // Assert Assert.AreEqual("", tvItemModelBouctouche.Error); // Act PartialViewResult partialViewResult = controller._MovingTVItem(tvItemModelBouctouche.TVItemID) as PartialViewResult; // Assert Assert.IsNotNull(partialViewResult); TVAuthEnum tvAuth = (TVAuthEnum)partialViewResult.ViewBag.TVAuth; Assert.AreEqual(TVAuthEnum.Admin, tvAuth); TVItemModel tvItemModelCurrent = (TVItemModel)partialViewResult.ViewBag.TVItemModelCurrent; Assert.IsNotNull(tvItemModelCurrent); Assert.AreEqual(tvItemModelBouctouche.TVItemID, tvItemModelCurrent.TVItemID); TVItemController tvItemController = (TVItemController)partialViewResult.ViewBag.TVItemController; Assert.IsNotNull(tvItemController); List <TVItemModel> parentTVItemModelList = (List <TVItemModel>)partialViewResult.ViewBag.ParentTVItemModelList; Assert.IsNotNull(parentTVItemModelList); Assert.AreEqual(6, parentTVItemModelList.Count); Assert.AreEqual(tvItemModelRoot.TVItemID, parentTVItemModelList[0].TVItemID); List <TVTypeNamesAndPath> tvTypeNamesAndPathList = (List <TVTypeNamesAndPath>)partialViewResult.ViewBag.TVTypeNamesAndPathList; Assert.IsNotNull(tvTypeNamesAndPathList); Assert.AreEqual(6, tvTypeNamesAndPathList.Count); Assert.AreEqual(TVTypeEnum.Root.ToString(), tvTypeNamesAndPathList[0].TVTypeName); Assert.AreEqual(TVTypeEnum.Country.ToString(), tvTypeNamesAndPathList[1].TVTypeName); Assert.AreEqual(TVTypeEnum.Province.ToString(), tvTypeNamesAndPathList[2].TVTypeName); Assert.AreEqual(TVTypeEnum.Area.ToString(), tvTypeNamesAndPathList[3].TVTypeName); Assert.AreEqual(TVTypeEnum.Sector.ToString(), tvTypeNamesAndPathList[4].TVTypeName); Assert.AreEqual(TVTypeEnum.Subsector.ToString(), tvTypeNamesAndPathList[5].TVTypeName); Dictionary <string, List <TVItemModel> > tvItemModelDictList = (Dictionary <string, List <TVItemModel> >)partialViewResult.ViewBag.TVItemModelDictList; Assert.IsNotNull(tvItemModelDictList); Assert.IsTrue(tvItemModelDictList[TVTypeEnum.Country.ToString()].Count > 0); Assert.IsTrue(tvItemModelDictList[TVTypeEnum.Province.ToString()].Count > 0); Assert.IsTrue(tvItemModelDictList[TVTypeEnum.Area.ToString()].Count > 0); Assert.IsTrue(tvItemModelDictList[TVTypeEnum.Sector.ToString()].Count > 0); Assert.IsTrue(tvItemModelDictList[TVTypeEnum.Subsector.ToString()].Count > 0); } } }