예제 #1
0
        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));
        }
예제 #2
0
        public static void Delete(string constructionCode)
        {
            string sql = @"
                DELETE FROM HemsBlocks
                WHERE
                    ConstructionCode = '" + constructionCode + @"'";

            var db = HemsBlock.GetDatabase();

            db.ExecuteNonQuery(sql);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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));
        }
예제 #5
0
        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();
        }