public static List <ViewSite> GetAll(int TYPE = -1) { List <ViewSite> theList = new List <ViewSite>(); Hydro.HydroServiceClient theHydro = new Hydro.HydroServiceClient(); foreach (var theType in theHydro.GetSiteTypes()) { if (TYPE != -1) { if (TYPE != theType.Id) { continue; } } Hydro.Site[] theSites = theHydro.GetSiteList(theType.Id); if (theSites != null) { foreach (var theSite in theHydro.GetSiteList(theType.Id)) { ViewSite theViewSite = new ViewSite(); theViewSite.ID = theSite.SiteId; theViewSite.Code = Convert.ToInt32(theSite.SiteCode); theViewSite.Name = theSite.Name; theViewSite.TypeID = theType.Id; theViewSite.TypeNameFull = theType.Name; theViewSite.TypeNameShort = theType.ShortName; theList.Add(theViewSite); } } } return(theList); }
// // GET: /Map/ public ActionResult Index(int SiteType = -1) { Hydro.HydroServiceClient theHydro = new Hydro.HydroServiceClient(); ViewMap theViewData = new ViewMap(); theViewData.SelectedSiteType = SiteType; theViewData.theSiteTypeCollection = theHydro.GetSiteTypes(); if (theViewData.SelectedSiteType == -1) { theViewData.SelectedSiteType = theViewData.theSiteTypeCollection[0].Id; } theViewData.theSites = theHydro.GetSiteList(theViewData.SelectedSiteType); return(View(theViewData)); }