Ejemplo n.º 1
0
 public Building getBuilding(int tier)
 {
     if (tier == 0)
     {
         return(null);
     }
     return(Buildings.getTier(tier, sql));
 }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
 public void deleteFarm(int fid)
 {
     Buildings.deleteFarm(sql, fid);
 }
Ejemplo n.º 4
0
 public void ChangeFarm(int fid, BuildingType uppertype, BuildingType lowertype)
 {
     Buildings.changeFarm(sql, fid, uppertype, lowertype);
 }
Ejemplo n.º 5
0
 public bool FarmExists(int id)
 {
     return(Buildings.farmExists(sql, id));
 }
Ejemplo n.º 6
0
 public int addFarm(int parent, BuildingType uppertype, BuildingType lowertype, string name, int id)
 {
     return(Buildings.addFarm(sql, parent, uppertype, lowertype, name, id));
 }
Ejemplo n.º 7
0
 public void deleteBuilding(int bid)
 {
     Buildings.deleteBuilding(sql, bid);
 }
Ejemplo n.º 8
0
 public void replaceBuilding(int bid, int toBuilding)
 {
     Buildings.replaceBuilding(sql, bid, toBuilding);
 }
Ejemplo n.º 9
0
 public void addBuilding(int parent, string name)
 {
     Buildings.addBuilding(sql, parent, name, 0);
 }
Ejemplo n.º 10
0
 public void setBuildingName(int bid, string name)
 {
     Buildings.setBuildingName(sql, bid, name);
 }
Ejemplo n.º 11
0
 public BuildingList getBuildings(Filters f)
 {
     return(Buildings.getBuildings(sql, f));
 }
Ejemplo n.º 12
0
 public int getMFCount()
 {
     return(Buildings.GetMFCount(sql));
 }
Ejemplo n.º 13
0
 public void updateBuilding(Building b)
 {
     Buildings.updateBuilding(b, sql);
 }
Ejemplo n.º 14
0
 public BldTreeData buildingsTree()
 {
     return(Buildings.getTree(0, sql, null));
 }