Exemplo n.º 1
0
        public LineEntity this[int lineId]
        {
            get
            {
                if (lineList == null)
                {
                    lineList = new List <LineEntity>();
                }

                LineEntity matchedLine = SearchLineFromLineList(lineId);

                if (needCheckQuery)
                {
                    if (matchedLine == null)
                    {
                        try
                        {
                            matchedLine = SeachLineByQuery(lineId);
                            lineList.Add(matchedLine);
                        }
                        catch (Exception exception)
                        {
                            throw exception;
                        }
                    }
                }
                return(matchedLine);
            }
        }
Exemplo n.º 2
0
        private LineEntity SeachLineByQuery(int lineId)
        {
            List <Line> matchedLineList =
                metroWeb.MetroWebDatabase.Table <Line>().Select(new Line {
                LineId = lineId
            });

            if (matchedLineList.Count == 0)
            {
                throw new Exception(string.Format("line id {0} is not found", lineId));
            }

            LineEntity matchedLineEntity = new LineEntity(metroWeb, matchedLineList[0]);

            return(matchedLineEntity);
        }
Exemplo n.º 3
0
        private List <LineEntity> SeachLineByQuery()
        {
            List <Line> matchedLineList =
                metroWeb.MetroWebDatabase.Table <Line>().Select();

            List <LineEntity> matchedLineEntityList = new List <LineEntity>();

            foreach (Line matchedLine in matchedLineList)
            {
                if (!lineList.Exists(line => line.LineId == matchedLine.LineId))
                {
                    LineEntity lineEntity = new LineEntity(metroWeb, matchedLine);
                    matchedLineEntityList.Add(lineEntity);
                }
            }
            return(matchedLineEntityList);
        }
Exemplo n.º 4
0
        private List <LineEntity> SeachLineByQuery(string lineName)
        {
            List <Line> matchedLineList =
                metroWeb.MetroWebDatabase.Table <Line>().Select(new Line {
                LineName = lineName
            });

            if (matchedLineList.Count == 0)
            {
                throw new Exception(string.Format("line name {0} is not found", lineName));
            }

            List <LineEntity> matchedLineEntityList = new List <LineEntity>();

            foreach (Line matchedLine in matchedLineList)
            {
                if (!lineList.Exists(line => line.LineId == matchedLine.LineId))
                {
                    LineEntity lineEntity = new LineEntity(metroWeb, matchedLine);
                    matchedLineEntityList.Add(lineEntity);
                }
            }
            return(matchedLineEntityList);
        }