Esempio n. 1
0
 // Получить параметры страны по коду
 // TODO: Переделать, возвращать объект типа Country
 public void GetByCod(string cod)
 {
     if (cod.Equals(null))
     {
         cod = ""; rid = 0; id = 0; nameEng = ""; color = ""; ridgamer = 0;
     }
     else
     {
         var countryTable = new Battle.Domain.Concrete.CountryContext();
         this.cod = cod;
         rid = countryTable.Database.SqlQuery<int>("Select rid from Country where cod = '" + cod + "'").FirstOrDefault<int>();
         id = countryTable.Database.SqlQuery<int>("Select id from Country where cod = '" + cod + "'").FirstOrDefault<int>();
         nameEng = countryTable.Database.SqlQuery<string>("Select name from Country where cod = '" + cod + "'").FirstOrDefault<string>();
         color = countryTable.Database.SqlQuery<string>("Select color from Country where cod = '" + cod + "'").FirstOrDefault<string>();
         mineral = countryTable.Database.SqlQuery<int>("Select mineral from Country where cod = '" + cod + "'").FirstOrDefault<int>();
         ridgamer = countryTable.Database.SqlQuery<int>("Select ridgamer from Country where cod = '" + cod + "'").FirstOrDefault<int>();
     }
 }
Esempio n. 2
0
 // Сменить владельца страны
 public void ChangeOwner(int ridGamer)
 {
     var countryTable = new Battle.Domain.Concrete.CountryContext();
     int i = countryTable.Database.ExecuteSqlCommand(
         "Update Country set ridgamer = '" + ridGamer.ToString() + "' where id=" + this.id.ToString());
 }