public static List <HemsBlock> Get(string constructionCode) { var code = constructionCode.Replace("'", "''"); var sql = @"SELECT * FROM HemsBlocks WHERE ConstructionCode = '" + code + "'"; var db = HemsBlock.GetDatabase(); return(db.ExecuteQuery <HemsBlock>(sql)); }
public static void Delete(string constructionCode) { string sql = @" DELETE FROM HemsBlocks WHERE ConstructionCode = '" + constructionCode + @"'"; var db = HemsBlock.GetDatabase(); db.ExecuteNonQuery(sql); }
public List <HemsBlock> GetEcwill2(string constructionCode) { string sql = string.Empty; sql = @"SELECT * FROM HemsBlocks WHERE ConstructionCode = '" + constructionCode + @"' AND Name = 'branch_40' AND DisplayName = 'エコウィル'"; var db = HemsBlock.GetDatabase(); var blocks = db.ExecuteQuery <HemsBlock>(sql); return(blocks); }
public static List <HemsBlock> Get(List <string> constructionCodes) { if (constructionCodes.Count == 0) { return(new List <HemsBlock>()); } var codes = string.Empty; constructionCodes.ForEach(p => codes += "'" + p + "',"); codes = codes.Substring(0, codes.Length - 1); var sql = @" SELECT * FROM HemsBlocks WHERE ConstructionCode IN (" + codes + @")"; var db = HemsBlock.GetDatabase(); return(db.ExecuteQuery <HemsBlock>(sql)); }
public void FillFloorRoom() { var sql = @" SELECT R.Location + ' - ' + R.Name AS FloorRoom FROM HemsRoomBlocks B JOIN HemsRooms R ON B.ConstructionCode = R.ConstructionCode AND B.RoomId = R.Id WHERE B.ConstructionCode = '" + this.ConstructionCode + @"' AND B.DeviceId = " + this.DeviceId + @" AND B.BlockId = " + this.Id; var db = HemsBlock.GetDatabase(); var floorRoom = db.ExecuteScalar(sql); if (floorRoom == null || floorRoom == DBNull.Value) { return; } this.FloorRoom = floorRoom.ToString(); }