Пример #1
0
        static CommentPersistence()
        {
            comments = new List <Comment>();
            String          sql  = "select * from COMMENT";
            List <object[]> rows = RepositoryManager.Repository.DoQuery(sql);

            foreach (object[] dataRow in rows)
            {
                Comment comment = new Comment
                {
                    CommentId = (long)dataRow[0],
                    Title     = (string)dataRow[1],
                    Content   = (string)dataRow[2],
                    Writer    = UserPersistence.GetUser((String)dataRow[3]),
                    Service   = ServicePersistence.GetService((String)dataRow[4])
                };
                comments.Add(comment);
            }
        }
Пример #2
0
        static ServicePersistence()
        {
            services = new List <Service>();
            String          sql  = "select * from SERVICE";
            List <object[]> rows = RepositoryManager.Repository.DoQuery(sql);

            foreach (object[] dataRow in rows)
            {
                DateTime addDate = Convert.ToDateTime(dataRow[4]);
                Service  service = new Service
                {
                    Title       = (string)dataRow[0],
                    Description = (string)dataRow[1],
                    Owner       = UserPersistence.GetUser(dataRow[2].ToString()),
                    Category    = (string)dataRow[3],
                    Comments    = null,//will change!!!!!
                    date        = addDate
                };
                service.Comments = CommentPersistence.getCommentsForaService(service);
                services.Add(service);
            }
        }