public GroupLocationMaint(string locationFilterName) { InitializeComponent(); _filterDetail = GroupLocations.GetLocationDetail(locationFilterName); DisplayFilter(); }
/// <summary> /// Get the detail of the specified location filter. /// Note that it must be a filter belonging to the currently active report group. /// </summary> /// <param name="name"></param> /// <returns></returns> public static GroupLocation GetLocationDetail(string name) { LoadLocations(); name.PadRight(50, ' '); EMMADataSet.GroupLocationRow data = locations.FindByReportGroupIDLocationName(loadedGroup, name); GroupLocation retVal = new GroupLocation(data); return retVal; }
public GroupLocationMaint() { InitializeComponent(); _filterDetail = new GroupLocation(); DisplayFilter(); }
/// <summary> /// Store the specified group location filter in the database. /// </summary> /// <param name="data"></param> public static void StoreLocation(GroupLocation data) { LoadLocations(); EMMADataSet.GroupLocationRow rowData = locations.FindByReportGroupIDLocationName(loadedGroup, data.Name); bool newRow = false; if (rowData == null) { rowData = locations.NewGroupLocationRow(); rowData.LocationName = data.Name; newRow = true; } rowData.ReportGroupID = data.ReportGroupID; rowData.Range = data.Range; rowData.StationID = data.StationID; List<long> regions = data.Regions; StringBuilder regionList = new StringBuilder(); foreach (int region in regions) { if (regionList.Length != 0) { regionList.Append(","); } regionList.Append(region); } rowData.RegionIDs = regionList.ToString(); List<long> stations = data.Stations; StringBuilder stationList = new StringBuilder(); foreach (int station in stations) { if (stationList.Length != 0) { stationList.Append(","); } stationList.Append(station); } rowData.StationIDs = stationList.ToString(); if (newRow) { locations.AddGroupLocationRow(rowData); } tableAdapter.Update(locations); locations.AcceptChanges(); }