예제 #1
0
        private void uxSave_Click(object sender, EventArgs e)
        {
            WellPads well = new WellPads();

            well.Id       = Convert.ToInt32(uxID.Text);
            well.Province = uxProvince.SelectedItem.ToString();
            well.Location = uxLocation.Text;
            well.Wells    = new List <IWell>();

            FacilityManager.FacilityMng.wellpads.Add(well);
            FacilityManager.FacilityMng.SaveData();

            GridViewRefresh();
        }
예제 #2
0
 public void Add(WellPad wp)
 {
     WellPads.Add(wp);
 }
예제 #3
0
        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;
            }
        }