public Building getBuilding(int tier) { if (tier == 0) { return(null); } return(Buildings.getTier(tier, sql)); }
/// <summary> /// Добавляет новую МИНИферму /// </summary> /// <param name="parent">Ветка-родитель</param> /// <param name="uppertype">Тип верхнего яруса</param> /// <param name="lowertype">Тип нижнего яруса</param> /// <param name="name">Название (если блок)</param> /// <param name="id">Номер МИНИфермы</param> /// <returns>Номер новой клетки</returns> internal static int addFarm(MySqlConnection sql, int parent, BuildingType uppertype, BuildingType lowertype, String name, int id) { int t1 = Buildings.addNewTier(sql, uppertype); int t2 = Buildings.addNewTier(sql, lowertype); int res = 0; MySqlCommand cmd = new MySqlCommand( String.Format( "INSERT INTO minifarms(m_upper, m_lower, m_id) VALUES({0}, {1}, {2});", DBHelper.Nullable(t1), DBHelper.Nullable(t2), id ), sql ); _logger.Debug("db.mysql.Building: " + cmd.CommandText); cmd.ExecuteNonQuery(); res = (int)cmd.LastInsertedId; addBuilding(sql, parent, (name != "" ? name : String.Format("№{0:d}", res)), res); return(res); }
public void deleteFarm(int fid) { Buildings.deleteFarm(sql, fid); }
public void ChangeFarm(int fid, BuildingType uppertype, BuildingType lowertype) { Buildings.changeFarm(sql, fid, uppertype, lowertype); }
public bool FarmExists(int id) { return(Buildings.farmExists(sql, id)); }
public int addFarm(int parent, BuildingType uppertype, BuildingType lowertype, string name, int id) { return(Buildings.addFarm(sql, parent, uppertype, lowertype, name, id)); }
public void deleteBuilding(int bid) { Buildings.deleteBuilding(sql, bid); }
public void replaceBuilding(int bid, int toBuilding) { Buildings.replaceBuilding(sql, bid, toBuilding); }
public void addBuilding(int parent, string name) { Buildings.addBuilding(sql, parent, name, 0); }
public void setBuildingName(int bid, string name) { Buildings.setBuildingName(sql, bid, name); }
public BuildingList getBuildings(Filters f) { return(Buildings.getBuildings(sql, f)); }
public int getMFCount() { return(Buildings.GetMFCount(sql)); }
public void updateBuilding(Building b) { Buildings.updateBuilding(b, sql); }
public BldTreeData buildingsTree() { return(Buildings.getTree(0, sql, null)); }