Ejemplo n.º 1
0
        public Country()
        {
            ID      = -1;
            Changed = false;

            UnionList = new CountryUnionList();
        }
Ejemplo n.º 2
0
 private void UpdateMirror()
 {
     if (mirror == null)
     {
         mirror = new CountryUnionList();
     }
     mirror.Clear();
     mirror.Load();
     foreach (var cu in this)
     {
         mirror.RemoveAll(item => item.ID == cu.ID);
     }
 }
Ejemplo n.º 3
0
        public void Load()
        {
            DBInterface.CommandText = "SELECT nameCountry, codeISO2, codeISO3, codeCitizen FROM `sellcontroller`.`country` WHERE `idCountry` = @id;";
            DBInterface.AddParameter("@id", MySql.Data.MySqlClient.MySqlDbType.Int32, ID);
            DataTable tab = DBInterface.ExecuteSelection();

            if (tab.Rows.Count == 1)
            {
                Name        = Convert.ToString(tab.Rows[0]["nameCountry"]);
                ISO         = Convert.ToString(tab.Rows[0]["codeISO2"]);
                ISO3        = Convert.ToString(tab.Rows[0]["codeISO3"]);
                Nationality = Convert.ToString(tab.Rows[0]["codeCitizen"]);
            }
            else if (tab.Rows.Count > 1)
            {
                throw new DuplicateNameException("Country table has rows with same id");
            }

            UnionList.Load(this);
            mirror = UnionList.mirror;

            Changed = false;
        }