public static void GetWellPadsByProvince(wellpad_listview well) { var Wellpads = FacilityManager.FacilityMng.GetData(); foreach (WellPads Well in Wellpads) { if (Well.Province == well.Province) { well.wells.Add(Well); //group together all wellpads locate in the same province } } }
public static List <wellpad_listview> Getwells() { List <wellpad_listview> wells = new List <wellpad_listview>(); wellpad_listview well = null; string[] provinces = File.ReadAllLines(path); foreach (string items in provinces) { well = new wellpad_listview(); string[] item = items.Split(','); well.Province = item[0]; well.wells = new List <WellPads>(); wells.Add(well); GetWellPadsByProvince(well); } return(wells); }
private void PopulateListView(TreeNode node) { uxListView.Items.Clear(); switch (node.Level) { case 0: List <wellpad_listview> wells_list = node.Tag as List <wellpad_listview>; int producwellcount = 0, injectcount = 0; foreach (wellpad_listview wellpads in wells_list) { foreach (WellPads Well in wellpads.wells) { injectcount = Well.Wells .Where(o => o.GetType() == typeof(InjectionWell)) .Count(); producwellcount = Well.Wells .Where(o => o.GetType() == typeof(ProductionWell)) .Count(); } string[] datas = new string[] { wellpads.Province.ToString(), producwellcount.ToString(), injectcount.ToString() }; ListViewItem items = new ListViewItem(datas); uxListView.Items.Add(items); } break; case 1: wellpad_listview locations = node.Tag as wellpad_listview; foreach (WellPads Well in locations.wells) { var productionCount = Well.Wells .Where(o => o.GetType() == typeof(ProductionWell)) .Count() .ToString(); var injectionCount = Well.Wells .Where(o => o.GetType() == typeof(InjectionWell)) .Count() .ToString(); string[] datas = new string[] { Well.Location, productionCount, injectionCount }; ListViewItem items = new ListViewItem(datas); uxListView.Items.Add(items); } break; case 2: WellPads well = node.Tag as WellPads; var productionWells = well.Wells .OrderByDescending(o => o.SpudDate) .Where(o => o.GetType() == typeof(ProductionWell)) .ToList(); var InjectionWells = well.Wells .OrderByDescending(o => o.SpudDate) .Where(o => o.GetType() == typeof(InjectionWell)) .ToList(); foreach (ProductionWell productionWell in productionWells) { string[] Datas = new string[] { productionWell.SpudDate.ToShortDateString(), productionWell.DailyProduction .Select(o => o.BarrelsProduced) .Sum() .ToString() }; ListViewItem Items = new ListViewItem(Datas); uxListView.Items.Add(Items); } foreach (InjectionWell injectionWell in InjectionWells) { string[] Datas = new string[] { injectionWell.SpudDate.ToShortDateString(), "0 barrels (Injection Well)" }; ListViewItem Items = new ListViewItem(Datas); uxListView.Items.Add(Items); } break; case 3: IWell iwells = node.Tag as IWell; ProductionWell productwells = iwells as ProductionWell; try { //get a collection of oil production from production wells (with production dates sorted in descending order) var Production = productwells.DailyProduction.OrderByDescending(o => o.ProductionDate).ToList(); foreach (OilProduction production in Production) { string[] productions = new string[] { production.ProductionDate.ToShortDateString(), production.BarrelsProduced.ToString() }; ListViewItem producItems = new ListViewItem(productions); uxListView.Items.Add(producItems); } } catch { string[] InjectionData = new string[] { "N/A", "0 barrels" }; ListViewItem items = new ListViewItem(InjectionData); uxListView.Items.Add(items); return; } break; } }