Tuesday, 28 June 2016

Tangerine net new deposit in saving

“Additional Interest” is 2.20%. During the Offer Period, the Bank will calculate Additional Interest to Applicable Accounts each time the sum of the daily balances in each new or existing Applicable Account exceeds the sum of the balances as at April 4, 2016 in all Applicable Accounts combined, up to a maximum of $500,000 in all Applicable Accounts combined, subject to the limitations in section 10 below (“Eligible Deposits”).

Additional Interest is added to the Posted Rate to calculate the total amount of interest payable under this Offer (Example: Posted Rate of 0.80% + Additional Interest of 2.20% = Offer of 3.00%). Any change to the Posted Rate will result in a corresponding change to the Offer. Additional Interest and/or Posted Rates may change at any time without prior notice. Eligible Clients will receive the Offer in two separate interest payments, one based on the Posted Rate and a second based on the Additional Interest rate.

Example 1:  Eligible Client has $10,000 in his/her existing RSP Savings Account on January 5, 2016. On January 10, 2016, he/she transfers $5,000 to a new RSP Savings Account from their Tangerine Savings Account. They also transfer $5,000 from his/her existing RSP Savings Account to an RSP GIC. The total of the balances in the RSP Savings Accounts remains $10,000 after completing the transfers. Therefore Additional Interest doesn’t apply to the RSP Savings Accounts for January 10.

Example 2: Eligible Client has $10,000 in his/her existing RSP Savings Account on January 5, 2016. On January 10, 2016, he/she deposits $10,000 to their existing RSP Savings Account from their Tangerine Savings Account. They also transfer $5,000 from his/her existing RSP Savings Account to an RSP GIC. His/her balance in the RSP Savings Account is $15,000 after completing the transfer. Additional Interest will apply to $5,000 of the new deposit to the existing RSP Savings Account.

Example 3: Eligible Client has $10,000 in his/her existing RSP Savings Account on January 5, 2016. On January 10, 2016, he/she opens an additional RSP Savings Account and transfers $5,000 from his/her existing RSP Savings Account. His/her Applicable Account Type balance remains $10,000 in total between both RSP Savings Accounts. The transfer to the new RSP Savings is not eligible for the Additional Interest because it does not qualify as a net new Eligible Deposit.

Get up to $400* when you switch to BMO.

https://www.bmo.com/main/personal/bank-accounts/smile400?ecid=da-US449EDB4-AKBMO20

Get 2% cash back for the first six months, No Annual Fee
http://www.bmo.com/main/personal/credit-cards/bmo-cashback-mastercard?icid=ba-FEAT166CC4-EYBMO16#

Sunday, 26 June 2016

加拿大政府宣布:所有国家公园免费开放

这个消息对全世界爱好旅游的你来说,绝对是个重磅大利好!

  加拿大联邦政府宣布:"庆祝加拿大的150岁生日,加拿大的所有国家公园将对所有人免收门票!"


  也就是说,无论你是加拿大华裔,还是一名游客,你现在都可以计划一下去加拿大旅游啦!因为,明年这个美丽的国家所有46个国家公园都全免费一整年!(全世界范围都可以说是史无前例的~~)
  这对你来说是一场真正说走就走的旅行。

  "加拿大日"是加拿大的全国公众假日,定于每年的7月1日。全部国家公园免票决定就是为了庆祝150年前的这个日子。。。

  1879年此日被正式定为节日,最初被称为"自治领日",纪念代表政治联盟的加拿大自治领。1982年10月27日根据《加拿大法案》改名为加拿大日。

  自由党环境部长Catherine McKenna在解释这一计划中说道:

  "是的!在加拿大联邦成立150周年之际,国家公园将对所有游客免费(包括外国旅客)。不仅如此,我们确认从2018年以后,加拿大的所有国家公园将对18岁以下者免费。。。"


266.jpg

  要知道,加拿大的旅游资源独步天下!很少有国家拥有如此大面积的湖光山色。

  这里有45%的森林覆盖率,稳定的生态系统造就了大量的绝世美景。46个分布在各省国家公园,每个都有其独特的魅力和令人叫绝的风光。

  下面就让我们记住这46个国家公园!你人生最美好的一段时光很可能就要发生在这里了~~

  1、Banff National Park(班芙国家公园)


276.jpg

  2、Cape Breton Highlands National Park

2410.jpg

  (布雷顿海岬高地国家公园)

  3、Gros Morne National Park

  (格罗莫讷国家公园)

  4、Jasper National Park

  (贾斯伯国家公园)

  5、Mingan Archipelago National Park

  (明安群岛国家公园)

  6、Nahanni National Park

  (纳翰尼国家公园)

  7、Pacific Rim National Park Reserve

  (太平洋沿岸地区国家公园)

  8、St. Lawrence Islands National Park

  (圣·劳伦斯群岛海洋公园)

  9、Wapusk National Park

  (瓦普斯克国家公园)

  10、Waterton National Park

0KA93J1-0.jpg

  (瓦特顿湖国家公园)

  其它36个加拿大国家公园:

  优鹤国家公园(Yoho National Park)

  冰川国家公园(Glacier National Park)

  Ukkusiksalik国家公园(Ukkusiksalik National Park)

  瓜依哈纳斯国家公园保护区(Gwaii Haanas National Park Reserve)

  草原国家公园(Grasslands National Park)

  五尺深国家海洋公园(Fathom Five National Marine Park)

  库特尼国家公园(Kootenay National Park)

  瓦普斯克国家公园 (Wapusk National Park)

  Quttinirpaaq 国家公园(Quttinirpaaq National Park)

  佛罗伦国家公园(Forillon National Park)

  Sirmilik国家公园(Sirmilik National Park)

  奥伊特克国家公园 (Auyuittuq National Park)

  Ivvavik国家公园(Ivvavik National Park)

  雷夫尔斯托克山国家公园(Mount Revelstoke National Park)

  瓜依哈纳斯国家海洋保护区(Gwaii Haanas National Marine Conservation Area Reserve)

  苏必利尔湖国家海洋保护区(Lake Superior National Marine Conservation Area)

  特拉诺瓦国家公园(Terra Nova National Park)

  克吉姆库吉克国家公园 (Kejimkujik National Park)

  Aulavik加拿大国家公园(Aulavik Canada National Park)

  布鲁斯半岛国家公园(Bruce Peninsula National Park )

  芬迪国家公园(Fundy National Park)

  海湾群岛国家公园保护区(Gulf Islands National Park Reserve)

  克卢恩国家公园及保护区(Kluane National Park and Reserve)

  摩丽斯国家公园(La Mauricie National Park)

  霹雳角国家公园(Point Pelee National Park)

  爱德华王子岛国家公园(Prince Edward Island National Park)

  帕卡斯夸国家公园(Pukaskwa National Park)

  麋鹿岛国家公园 (Elk Island National Park)

  骑山国家公园(Riding Mountain National Park)

  托恩盖特山脉国家公园(Torngat Mountains National Park)

  Tuktut Nogait国家公园(Tuktut Nogait National Park)

  Vuntut国家公园(Vuntut National Park)

  木水牛城国家公园(Wood Buffalo National Park)

  阿尔伯特王子国家公园(Prince Albert National Park)

  Kouchibouguac国家公园(Kouchibouguac National Park)

  乔治亚湾群岛国家公园(Georgian Bay Islands National Park)

  还等什么?!现在还不快拿出你的护照,准备一下你最美好的加拿大之旅~~

.net iii final







main form

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using class_library;

namespace oil_business
{
    public partial class Main_Form : Form
    {
        File_Access_Object access_object;

        public Main_Form()
        {
            InitializeComponent();

            access_object = new File_Access_Object();

            //display message if serialization file not found
            access_object.show_message += Access_object_show_message;
        }

        private void Access_object_show_message(object sender, EventArgs e)
        {
            MessageBox.Show("specified serialization file not found");
        }

        private void addWellPadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            open_form<Add_Well_Pad> new_form = new open_form<Add_Well_Pad>(this);
        }

        private void explorerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            open_form<Explorer> new_form = new open_form<Explorer>(this);
        }

        private void addProductionWellToolStripMenuItem_Click(object sender, EventArgs e)
        {
            open_form<Add_Production_Well> new_form = new open_form<Add_Production_Well>(this);
        }

        private void addInjectionWellToolStripMenuItem_Click(object sender, EventArgs e)
        {
            open_form<Add_Injection_well> new_form = new open_form<Add_Injection_well>(this);
        }

        private void wellProductionToolStripMenuItem_Click(object sender, EventArgs e)
        {           
            open_form<Well_Production> new_form = new open_form<Well_Production>(this);
        }

        private class open_form<T> where T: Form, new()
        {
            private static T _form = null;

            public open_form(Form main_form)
            {
                if(_form == null || _form.IsDisposed)
                {
                    _form = new T();

                    _form.MdiParent = main_form;
                    _form.Show();

                    _form.Location = new Point(0, 0);
                }
                else
                {
                    _form.BringToFront();
                }
            }
        }

        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            File_Access_Object.Save();
            MessageBox.Show("Binary Serialization File Saved");
        }

        private void loadcsvToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //load facilities from .csv files
            Facility_Manager.add_well_pads(File_Access_Object.get_well_pads());
            MessageBox.Show(".csv file loaded");         
        }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //File_Access_Object.Load();
            access_object.Load();
            MessageBox.Show("serialization file loaded");
        }

        private void savecsvToolStripMenuItem_Click(object sender, EventArgs e)
        {
            File_Access_Object.write_csv();
            MessageBox.Show("csv file saved");
        }
    }
}
-----------------------------------------------------------------------------
//my_interface

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace class_library
{
    public interface IWellPad
    {
        int Id { get; set; }
        string Province { get; set; }
        string Location { get; set; }
        List<IWell> Wells { get; set; }
    }
    public interface IWell
    {
        int Id { get; set; }
        DateTime SpudDate { get; set; }
    }
    public interface IProductionWell : IWell
    {
        List<IOilProduction> DailyProduction { get; set; }
    }
    public interface IInjectionWell : IWell
    {
        WaterType WaterType { get; set; }
    }
    public interface IOilProduction
    {
        DateTime ProductionDate { get; set; }
        int BarrelsProduced { get; set; }
    }

    public enum WaterType { Brackish, Brine, Fresh, Saline }
}

-----------------------------------------------------------------------------
//well_pad

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace class_library
{
    [Serializable]
    public class well_pad : IWellPad
    {
        private int _Id;
        private string _Location, _Province;
        private List<IWell> _Wells;

        public int Id
        {
            get
            {
                return _Id;
            }

            set
            {
                _Id = value;
            }
        }

        public string Location
        {
            get
            {
                return _Location;
            }

            set
            {
                _Location = value;
            }
        }

        public string Province
        {
            get
            {
                return _Province;
            }

            set
            {
                _Province = value;
            }
        }

        public List<IWell> Wells
        {
            get
            {
                return _Wells;
            }

            set
            {
                _Wells = value;
            }
        }
    }
}

----------------------------------------------------------------------------
//production_well

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace class_library
{
    [Serializable]
    public class production_well : IProductionWell
    {
        private List<IOilProduction> _DailyProduction;
        private int _Id;
        private DateTime _SpudDate;

        public List<IOilProduction> DailyProduction
        {
            get
            {
                return _DailyProduction;
            }

            set
            {
                _DailyProduction = value;
            }
        }

        public int Id
        {
            get
            {
                return _Id;
            }

            set
            {
                _Id = value;
            }
        }


        public DateTime SpudDate
        {
            get
            {
                return _SpudDate;
            }

            set
            {
                _SpudDate = value;
            }
        }
    }
}

----------------------------------------------------------------------------
//iwell_factory

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace class_library
{
    public class Iwell_factory
    {
        private int _id;
        private List<IOilProduction> _oil_production;
        private DateTime _spud_date;
        private string _type;
        private WaterType _water_type;

        public Iwell_factory()
        { }

        public Iwell_factory(int ID, DateTime Spud_date,string type,List<IOilProduction> oil_production)
        {
            _id = ID;
            _spud_date = Spud_date;
            _type = type;
            _oil_production = oil_production;
        }

        public Iwell_factory(int ID, DateTime Spud_date, string type, WaterType water_type)
        {
            _id = ID;
            _spud_date = Spud_date;
            _type = type;
            _water_type = water_type;
        }

        public IWell factory_well(string type )
        {
            if(type == "production")
            {
                IProductionWell production_well = new production_well {Id =_id,SpudDate=_spud_date,DailyProduction=_oil_production };
                return production_well;
            }
            else
            {
                IInjectionWell injection_well = new injection_well { Id = _id, SpudDate = _spud_date, WaterType = _water_type };
                return injection_well;
            }
            
        }
    }
}

----------------------------------------------------------------------------
//file_access_object

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace class_library
{
    public class File_Access_Object
    {
        public delegate void message_delegate(object sender, EventArgs e);
        public event message_delegate show_message;

        //used for .csv loading
        public static List<IWellPad> get_well_pads()
        {
            var well_pads = new List<IWellPad>();
            IWellPad single_well_pad = null;

            using (var reader = new StreamReader(new FileStream("well_pads.csv", FileMode.Open, FileAccess.Read)))
            {
                string line = reader.ReadLine();
                while (line != null)
                {
                    string[] items = line.Split(',');

                    single_well_pad = new well_pad { Id = int.Parse(items[0]), Province = items[1], Location =items[2] };

                    get_wells(single_well_pad);

                    well_pads.Add(single_well_pad);

                    line = reader.ReadLine();
                }
            }

            return well_pads;
        }

        private static void get_wells(IWellPad single_well_pad)
        {
            var wells = new List<IWell>();
            IWell single_well = null;

            using (var reader = new StreamReader(new FileStream("wells.csv", FileMode.Open, FileAccess.Read)))
            {
                string line = reader.ReadLine();
                while (line != null)
                {
                    string[] items = line.Split(',');

                    int well_pad_id = int.Parse(items[3]);

                    if (well_pad_id == single_well_pad.Id)
                    {
                        if(items[1]=="production")
                        {
                            List<IOilProduction> oil_productions = new List<IOilProduction>();
                            IOilProduction oil_production = new oil_production { BarrelsProduced = 100, ProductionDate = new DateTime(2016,1,30) };
                            oil_productions.Add(oil_production);

                            oil_production = new oil_production { BarrelsProduced = 200, ProductionDate = new DateTime(2016, 2, 1) };
                            oil_productions.Add(oil_production);

                            //construct production well
                            Iwell_factory well_from_factory = new Iwell_factory(int.Parse(items[0]), Convert.ToDateTime(items[2]), items[1], oil_productions);
                            single_well = well_from_factory.factory_well(items[1]);
                        }
                        else
                        {
                            //construct injection well
                            Iwell_factory well_from_factory = new Iwell_factory(int.Parse(items[0]), Convert.ToDateTime(items[2]), items[1], WaterType.Saline);
                            single_well = well_from_factory.factory_well(items[1]);
                        }



                        wells.Add(single_well);
                    }

                    line = reader.ReadLine();
                }
            }

            single_well_pad.Wells = wells;
        }

        public static void Save()
        {
            var formatter = new BinaryFormatter();

            using (var stream = new FileStream("facilities.dat", FileMode.Create, FileAccess.Write))
            {
                formatter.Serialize(stream, Facility_Manager.get_facilities());
            }
        }

        public void Load()
        {
            var formatter = new BinaryFormatter();

            if (!File.Exists("facilities.dat"))
            {
                //System.Windows.Forms.MessageBox.Show("file not found");
                //without add reference to windows form, use event to trigger messagebox dispaly on main form

                if (show_message != null)
                {
                    show_message.Invoke(this, new EventArgs { });
                }

                return;
            }

            using (var stream = new FileStream("facilities.dat", FileMode.Open, FileAccess.Read))
            {
                Facility_Manager.add_well_pads((List<IWellPad>)formatter.Deserialize(stream));
            }
        }

        public static void write_csv()
        {
            List<IWellPad> well_pads = Facility_Manager.get_facilities();

            using (var writer = new StreamWriter(new FileStream("saved_wells.csv", FileMode.Create, FileAccess.Write)))
            {
                foreach(IWellPad well_pad in well_pads)
                {
                    if (well_pad.Wells!=null && well_pad.Wells.Count !=0)
                    {
                        foreach (IWell well in well_pad.Wells)
                        {
                            try
                            {
                                IProductionWell P_well = (IProductionWell)well;

                                if (P_well.DailyProduction.Count != 0)
                                {
                                    foreach (IOilProduction daily_production in P_well.DailyProduction)
                                    {
                                        writer.WriteLine(well_pad.Id + "," + well_pad.Province + "," + well_pad.Location
                                            + "," + well.Id + "," + well.SpudDate.ToShortDateString() + ","
                                            + daily_production.BarrelsProduced + "," + daily_production.ProductionDate.ToShortDateString());
                                    }
                                }
                                else
                                {
                                    writer.WriteLine(well_pad.Id + "," + well_pad.Province + "," + well_pad.Location
                                            + "," + well.Id + "," + well.SpudDate.ToShortDateString());
                                }
                            }
                            catch (Exception e1)
                            {

                                IInjectionWell I_well = (IInjectionWell)well;
                                writer.WriteLine(well_pad.Id + "," + well_pad.Province + "," + well_pad.Location
                                        + "," + well.Id + "," + well.SpudDate.ToShortDateString() + ","
                                        + I_well.WaterType);
                            }
                        }
                    }
                    else
                    {
                        writer.WriteLine(well_pad.Id + "," + well_pad.Province + "," + well_pad.Location);
                    }
                }
            }
        }
    }
}

----------------------------------------------------------------------------
//facility_manager

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace class_library
{  
    public class Facility_Manager
    {
        private static List<IWellPad> facilities;

        private Facility_Manager(){}

        public static List<IWellPad> get_facilities()
        {
            if(facilities == null)
            {
                facilities = new List<IWellPad>();
                
            }

            return facilities;
        }

        public static void add_well_pads(List<IWellPad> well_pads)
        {
            facilities = well_pads;
        }

        public static void add_well_pad(IWellPad well_pad, int ID)
        {
            IWellPad _well_pad = facilities.Find(x => x.Id == ID);

            //if well pad id exists, choose enter new ID or update existing pad
            if(_well_pad!=null)
            {
                DialogResult yes_no = MessageBox.Show("Update existing well/Y \nEnter new ID/N", "well ID exists, what to do?", MessageBoxButtons.YesNo);

                if (yes_no == DialogResult.Yes)
                {
                    _well_pad.Province = well_pad.Province;
                    _well_pad.Location = well_pad.Location;
                    MessageBox.Show("updated");
                }

                return;
            }

            facilities.Add(well_pad);
            MessageBox.Show("well pad added");
        }

        public static void add_well(IWell well, int well_pad_id, int well_id)
        {
            IWellPad well_pad = facilities.Find(x => x.Id == well_pad_id);
            IWell _well = well_pad.Wells.Find(x => x.Id == well_id);

            //if well ID exists in well pad, choose enter new ID or update existing well
            if (_well!=null)
            {
                DialogResult yes_no = MessageBox.Show("Update existing well/Y \nEnter new ID/N", "well ID exists, what to do?", MessageBoxButtons.YesNo);

                if (yes_no == DialogResult.Yes)
                {
                    try
                    {
                        IProductionWell I_well = (IProductionWell)_well;
                        IProductionWell I_well_pameter = (IProductionWell)well;
                        I_well.SpudDate = I_well_pameter.SpudDate;
                        MessageBox.Show("updated");
                    }
                    catch (Exception e1)
                    {
                        IInjectionWell I_well = (IInjectionWell)_well;
                        IInjectionWell I_well_pameter = (IInjectionWell)well;
                        I_well.SpudDate = I_well_pameter.SpudDate;
                        I_well.WaterType = I_well_pameter.WaterType;
                        MessageBox.Show("updated");
                    }
                }

                return;
            }

            well_pad.Wells.Add(well);
            MessageBox.Show("new well added");
        }

        public static void add_daily_production(IOilProduction daily_production,string location,int _id, string date)
        {
            IWellPad well_pad = facilities.Find(x => x.Location==location);
            IWell well = well_pad.Wells.Find(x => x.Id == _id);
            IProductionWell P_well = (IProductionWell)well;
            IOilProduction P = P_well.DailyProduction.Find(x => x.ProductionDate.ToShortDateString() == date);

            //if production date exists, choose enter new date or update existing
            if (P != null)
            {
                DialogResult yes_no = MessageBox.Show("Update existing date/Y \nEnter new date/N", "Date exists, what to do?", MessageBoxButtons.YesNo);

                if (yes_no == DialogResult.Yes)
                {
                    P.BarrelsProduced = daily_production.BarrelsProduced;
                    MessageBox.Show("updated");
                }

                return;
            }

            P_well.DailyProduction.Add(daily_production);
            MessageBox.Show("daily production added to selected well");
        }
    }
}

----------------------------------------------------------------------------------------------
//explorer






using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using class_library;

namespace oil_business
{
    public partial class Explorer : Form
    {
        public Explorer()
        {
            InitializeComponent();
            Tree();
        }

        private void Tree()
        {
            TreeNode Facilities_node = new TreeNode("Facilitites");
            TreeNode well_pads_node = null;
            TreeNode Well_pad_node = null;
            TreeNode Wells_node = null;

            UX_Tree.Nodes.Add(Facilities_node);

            List<IWellPad> well_pads = Facility_Manager.get_facilities(); ;          

            Facilities_node.Tag = well_pads;

            foreach (IWellPad single_well_pad in well_pads)
            {
                bool node_exist = false;

                //check if province exists in facilities
                foreach(TreeNode x in Facilities_node.Nodes)
                {
                    if(x.Text == single_well_pad.Province)
                    {
                        node_exist = true;

                        //add city to province
                        Well_pad_node = new TreeNode(single_well_pad.Location);
                        Well_pad_node.Tag = single_well_pad;
                        x.Nodes.Add(Well_pad_node);
                    }
                }

                //province doesn't exist, add province
                if(!node_exist)
                {
                    //add province to facilities
                    well_pads_node = new TreeNode(single_well_pad.Province);
                    well_pads_node.Tag = well_pads;
                    Facilities_node.Nodes.Add(well_pads_node);

                    //add city to province
                    Well_pad_node = new TreeNode(single_well_pad.Location);
                    Well_pad_node.Tag = single_well_pad;
                    well_pads_node.Nodes.Add(Well_pad_node);
                }               

                if (single_well_pad.Wells != null)
                {
                    foreach (IWell well in single_well_pad.Wells)
                    {
                        Wells_node = new TreeNode(well.SpudDate.ToShortDateString());
                        Wells_node.Tag = well;
                        Well_pad_node.Nodes.Add(Wells_node);

                    }
                }
            }
        }

        private void UX_Tree_AfterSelect(object sender, TreeViewEventArgs e)
        {
            switch (e.Node.Level)
            {
                case 0:
                   display_facilities(e.Node.Tag, e.Node);
                    break;
                case 1:
                    display_well_pads(e.Node.Tag,e.Node.Text);
                    break;
                case 2:
                    display_single_well_pad(e.Node.Tag);
                    break;
                case 3:
                    display_single_well(e.Node.Tag);
                    break;
            }
        }

        private void display_facilities(object tag, TreeNode facilities)
        {
            List<IWellPad> well_pads = (List<IWellPad>)tag;

            UX_Listview.Columns.Clear();
            UX_Listview.Items.Clear();

            UX_Listview.Columns.Add("Province", 100);
            UX_Listview.Columns.Add("Well Pad Count", 100);
            UX_Listview.Columns.Add("Producing Wells Count", 100);
            UX_Listview.Columns.Add("Injection Wells Count", 100);          

            foreach(TreeNode provice_node in facilities.Nodes)
            {
                ListViewItem item = new ListViewItem();

                item.Text = provice_node.Text;

                int well_pad_count = 0;

                //count citites in province              
                foreach (TreeNode city_node in provice_node.Nodes)
                {
                    well_pad_count++;
                }

                item.SubItems.Add(new ListViewItem.ListViewSubItem { Text = well_pad_count.ToString() });

                int production_well = 0, injection_well = 0;

                //count different wells in province
                foreach(IWellPad well_pad in well_pads)
                {
                    if(well_pad.Province == provice_node.Text)
                    {
                        if (well_pad.Wells != null)
                        {
                            foreach (IWell well in well_pad.Wells)
                            {
                                try
                                {
                                    IProductionWell P_well = (IProductionWell)well;
                                    production_well++;
                                }
                                catch (Exception e1)
                                {
                                    injection_well++;
                                }
                            }
                        }
                    }
                }

                item.SubItems.Add(new ListViewItem.ListViewSubItem { Text = production_well.ToString() });
                item.SubItems.Add(new ListViewItem.ListViewSubItem { Text = injection_well.ToString() });

                UX_Listview.Items.Add(item);
            }
        }

        private void display_well_pads(object tag,string province)
        {
            List<IWellPad> well_pads = (List<IWellPad>)tag;

            UX_Listview.Columns.Clear();
            UX_Listview.Items.Clear();

            UX_Listview.Columns.Add("Location", 100);
            UX_Listview.Columns.Add("Producing Wells Count", 100);
            UX_Listview.Columns.Add("Injection Wells Count", 100);

            foreach(IWellPad well_pad in well_pads)
            {
                if(well_pad.Province == province)
                {
                    ListViewItem item = new ListViewItem();

                    item.Text = well_pad.Location;

                    int production_well = 0, injection_well = 0;

                    //find number of different wells in province
                    foreach (IWell well in well_pad.Wells)
                    {
                        try
                        {
                            IProductionWell P_well = (IProductionWell)well;
                            production_well++;
                        }
                        catch (Exception e1)
                        {
                            injection_well++;
                        }
                    }

                    item.SubItems.Add(new ListViewItem.ListViewSubItem { Text = production_well.ToString() });
                    item.SubItems.Add(new ListViewItem.ListViewSubItem { Text = injection_well.ToString() });

                    UX_Listview.Items.Add(item);
                }
            }
        }

        private void display_single_well_pad(object tag)
        {
            IWellPad well_pad = (IWellPad)tag;

            UX_Listview.Columns.Clear();
            UX_Listview.Items.Clear();

            UX_Listview.Columns.Add("Spud Date", 200);
            UX_Listview.Columns.Add("Barrels Produced in history", 300);

            if (well_pad.Wells != null)
            {
                foreach (IWell well in well_pad.Wells)
                {
                    ListViewItem item = new ListViewItem();

                    item.Text = well.SpudDate.ToShortDateString();

                    //find historical barrels produces by single production well
                    try
                    {
                        IProductionWell P_well = (IProductionWell)well;

                        long history_production = 0;

                        foreach (IOilProduction daily_production in P_well.DailyProduction)
                        {
                            history_production += daily_production.BarrelsProduced;
                        }

                        item.SubItems.Add(new ListViewItem.ListViewSubItem { Text = history_production.ToString() });
                    }
                    catch (Exception e1)
                    {

                    }

                    UX_Listview.Items.Add(item);
                }
            }
        }

        private void display_single_well(object tag)
        {
            IWell well = (IWell)tag;

            UX_Listview.Columns.Clear();            
            UX_Listview.Items.Clear();

            //2 types of wells display different property           
            try
            {
                IProductionWell P_well = (IProductionWell)well;

                UX_Listview.Columns.Add("Production Date", 200);
                UX_Listview.Columns.Add("Barrels Produced for the day", 300);

                if (P_well.DailyProduction == null) { return; }

                //sort the production date for well dailyproduction
                P_well.DailyProduction.Sort((y, x) => x.ProductionDate.CompareTo(y.ProductionDate));

                foreach (IOilProduction oil_production in P_well.DailyProduction)
                {
                    ListViewItem item = new ListViewItem();

                    item.Text = oil_production.ProductionDate.ToShortDateString();
                    item.SubItems.Add(new ListViewItem.ListViewSubItem { Text = oil_production.BarrelsProduced.ToString() });

                    UX_Listview.Items.Add(item);
                }

            }
            catch (Exception e1)
            {

                IInjectionWell I_well = (IInjectionWell)well;

                UX_Listview.Columns.Add("Water type", 200);

                ListViewItem item = new ListViewItem();

                item.Text = I_well.WaterType.ToString();

                UX_Listview.Items.Add(item);
            }

                     
        }

        private void expandToolStripMenuItem_Click(object sender, EventArgs e)
        {
            UX_Tree.ExpandAll();
        }

        private void collapseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            UX_Tree.CollapseAll();
        }

        private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
        {
            UX_Tree.Nodes.Clear();
            Tree();
        }
    }
}

------------------------------------------------------------------------------
//add_well_pad


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using class_library;

namespace oil_business
{
    public partial class Add_Well_Pad : Form
    {
        public Add_Well_Pad()
        {
            InitializeComponent();

            refresh();
        }

        IWellPad well_pad;

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {               
                well_pad = new well_pad
                {
                    Id = Convert.ToInt32(UX_ID.Text),
                    Province = UX_Province.Text,
                    Location = UX_Location.Text,
                    Wells = new List<IWell>()
                };

                Facility_Manager.add_well_pad(well_pad, Convert.ToInt32(UX_ID.Text));             
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.ToString());
            }

        }

        private void refresh()
        {
            listView1.Columns.Clear();
            listView1.Items.Clear();

            listView1.Columns.Add("Existing Well Pads", 300);

            foreach(IWellPad well_pad in Facility_Manager.get_facilities())
            {
                ListViewItem item = new ListViewItem();

                item.Text = well_pad.Id + " " + well_pad.Location;

                listView1.Items.Add(item);
            }
        }

        private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
        {
            refresh();
        }
    }
}


---------------------------------------------------------------------------------------------
//add_production_well


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using class_library;

namespace oil_business
{
    public partial class Add_Production_Well : Form
    {
        public Add_Production_Well()
        {
            InitializeComponent();

            refresh();
        }

        protected virtual void button1_Click(object sender, EventArgs e)
        {
            if (UX_ListBox.SelectedItem != null)
            {
                try
                {
                    int well_pad_id = Convert.ToInt32(UX_ListBox.SelectedItem.ToString().Split(' ')[0]);                   

                    IProductionWell _well = new production_well
                    {
                        Id = Convert.ToInt32(UX_ID.Text),
                        SpudDate = dateTimePicker1.Value,
                        DailyProduction = new List<IOilProduction>()
                    };

                    Facility_Manager.add_well(_well, well_pad_id, Convert.ToInt32(UX_ID.Text));

                }
                catch (Exception e1)
                {
                    MessageBox.Show(e1.ToString() + "\n please select existing well pad ID from list");
                }
            }
            else
            {
                MessageBox.Show("please select a well pad first");
            }
        }

        private void refresh()
        {
            UX_ListBox.Items.Clear();

            foreach (IWellPad well_pad in Facility_Manager.get_facilities())
            {
                UX_ListBox.Items.Add(well_pad.Id + "    " + well_pad.Location);
            }
            
        }

        private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
        {
            refresh();
        }

        protected virtual void UX_ListBox_SelectedValueChanged(object sender, EventArgs e)
        {
            listView1.Columns.Clear();
            listView1.Items.Clear();
            listView1.Columns.Add("Existing production well", 300);

            if (UX_ListBox.SelectedItem != null)
            {
                int well_pad_id = Convert.ToInt32(UX_ListBox.SelectedItem.ToString().Split(' ')[0]);
                IWellPad well_pad = Facility_Manager.get_facilities().Find(x => x.Id == well_pad_id);

                foreach (IWell well in well_pad.Wells)
                {
                    try
                    {
                        IProductionWell P_well = (IProductionWell)well;

                        ListViewItem item = new ListViewItem();
                        item.Text = P_well.Id.ToString() + "    " + P_well.SpudDate.ToShortDateString();
                        listView1.Items.Add(item);
                    }
                    catch (Exception e1)
                    { }
                }
            }
        }
    }
}

-------------------------------------------------------------------------------------------------------
//add_injection_well


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using class_library;

namespace oil_business
{
    public partial class Add_Injection_well : oil_business.Add_Production_Well
    {
        public Add_Injection_well()
        {
            InitializeComponent();

            foreach (string name in Enum.GetNames(typeof(WaterType)))
            {
                UX_Water_type.Items.Add(name);
            }
        }

        protected override void button1_Click(object sender, EventArgs e)
        {
            //base.button1_Click(sender, e);
            if (UX_ListBox.SelectedItem != null && UX_Water_type.SelectedItem!=null)
            {
                try
                {               
                    int well_pad_id = Convert.ToInt32(UX_ListBox.SelectedItem.ToString().Split(' ')[0]);                   

                    IInjectionWell _well = new injection_well
                    {
                        Id = Convert.ToInt32(UX_ID.Text),
                        SpudDate = dateTimePicker1.Value,
                        WaterType = get_water_type(UX_Water_type.SelectedItem.ToString())
                    };

                    Facility_Manager.add_well(_well, well_pad_id, Convert.ToInt32(UX_ID.Text));
                    
                }
                catch (Exception e1)
                {
                    MessageBox.Show(e1.ToString());
                }
            }
            else
            {
                MessageBox.Show("please select a well pad and watertype first");
            }
        }

        private WaterType get_water_type(string name)
        {
            switch(name)
            {
                case "Brackish":
                    return WaterType.Brackish;
                    
                case "Brine":
                    return WaterType.Brine;
                    
                case "Fresh":
                    return WaterType.Brine;                                  

                default:
                    return WaterType.Saline;
            }
        }

        protected override void UX_ListBox_SelectedValueChanged(object sender, EventArgs e)
        {
            listView1.Columns.Clear();
            listView1.Items.Clear();
            listView1.Columns.Add("Existing injection well", 300);

            if (UX_ListBox.SelectedItem != null)
            {
                int well_pad_id = Convert.ToInt32(UX_ListBox.SelectedItem.ToString().Split(' ')[0]);
                IWellPad well_pad = Facility_Manager.get_facilities().Find(x => x.Id == well_pad_id);

                foreach (IWell well in well_pad.Wells)
                {
                    try
                    {
                        IInjectionWell I_well = (IInjectionWell)well;

                        ListViewItem item = new ListViewItem();
                        item.Text = I_well.Id.ToString() + "    " + I_well.SpudDate.ToShortDateString();
                        listView1.Items.Add(item);
                    }
                    catch (Exception e1)
                    { }
                }
            }
        }
    }
}

------------------------------------------------------------------------------------------------
//well_production






using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using class_library;

namespace oil_business
{
    public partial class Well_Production : Form
    {
        public Well_Production()
        {
            InitializeComponent();

            refresh();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if(UX_Select_Well_pad.SelectedItem == null || UX_Select_Production_well.SelectedItem==null)
            {
                MessageBox.Show("please select Well Pad and production well first");
            }
            else
            {
              try
                {
                    IOilProduction daily_production = new oil_production();
                    daily_production.ProductionDate = UX_date.Value;
                    daily_production.BarrelsProduced = Convert.ToInt32(UX_barrels.Text);
                    int well_ID = Convert.ToInt32(UX_Select_Production_well.SelectedItem.ToString().Split(' ')[0]);                                    

                    Facility_Manager.add_daily_production(daily_production, UX_Select_Well_pad.SelectedItem.ToString(), well_ID, UX_date.Value.ToShortDateString());               
                }
                catch(Exception e1)
                {
                    MessageBox.Show(e1.ToString());
                }
            }
        }

        private void refresh()
        {
            UX_Select_Well_pad.Items.Clear();
            UX_Select_Production_well.Items.Clear();

            foreach (IWellPad well_pad in Facility_Manager.get_facilities())
            {
                UX_Select_Well_pad.Items.Add(well_pad.Location);                
            }
        }

        private void UX_Select_Well_pad_SelectedValueChanged(object sender, EventArgs e)
        {
            UX_Select_Production_well.Items.Clear();

            if (UX_Select_Well_pad.SelectedItem != null)
            {
                IWellPad well_pad = Facility_Manager.get_facilities().Find(x => x.Location == UX_Select_Well_pad.SelectedItem.ToString());

                foreach (IWell well in well_pad.Wells)
                {
                    try
                    {
                        IProductionWell P_well = (IProductionWell)well;
                        UX_Select_Production_well.Items.Add(P_well.Id + "   " + P_well.SpudDate.ToShortDateString());
                    }
                    catch (Exception e1)
                    {
                    }
                }

            }
        }
    }
}

--------------------------------------------------------------------
//well_pads.csv

1,BC,Kelowna
2,BC,Vancouver
3,AB,Calgary
4,AB,Edmonton
5,SK,Saskatoon
6,SK,Regina

//wells.csv
1,injection,01/01/2006,1
2,production,02/02/2007,1
3,injection,03/03/2008,1
4,production,04/04/2009,2
5,injection,05/05/2010,2
6,production,06/06/2011,2
7,production,07/07/2012,3
8,production,08/08/2013,3
9,production,09/09/2014,3
10,injection,10/10/2013,4
11,injection,11/11/2014,4
12,injection,12/12/2015,4