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