Example #1
0
        public List <Date> Read()
        {
            string command = "Select * from Date";
            var    db      = new DataAccess.DataBaseManager();
            var    result  = db.GetData(command);

            var karbarList   = new Karbar().Read();
            var booktyoelist = new BookType().Read();

            List <Date> lstResult = new List <Date>();

            foreach (DataRow r in result.Rows)
            {
                Date date = new Date();
                date.ID           = Convert.ToInt32(r["ID"]);
                date.EntranceDate = Convert.ToDateTime(r["EntranceDate"]);
                Date daate = new Date();
                daate.ID           = Convert.ToInt32(r["ID"]);
                daate.EntranceDate = Convert.ToDateTime(r["bargasht"]);
                //User
                Karbar karbar   = new Karbar();
                var    karbarID = Convert.ToInt64(r["KarbarId"]);
                date.Karbar = karbarList.FirstOrDefault(a => a.ID == karbarID);

                //CarType
                BookType bookType   = new BookType();
                var      BookTypeID = Convert.ToInt64(r[" BookTypeID"]);
                date.BookType = booktyoelist.FirstOrDefault(a => a.ID == BookTypeID);

                lstResult.Add(date);
            }

            return(lstResult);
        }
Example #2
0
        public List <BookType> Read()
        {
            string command = "Select * from BookType";
            var    db      = new DataAccess.DataBaseManager();
            var    result  = db.GetData(command);

            List <BookType> lstResult = new List <BookType>();

            foreach (DataRow r in result.Rows)
            {
                BookType book = new BookType();
                book.ID       = Convert.ToInt32(r["ID"]);
                book.BookName = r["BookName"].ToString();
                lstResult.Add(book);
            }

            return(lstResult);
        }