Example #1
0
 public MediaLogic()
 {
     mediaDAO            = new MediaDAO();
     mediaTable          = new MediaDS.ViewMediaDataTable();
     languageTable       = new MediaDS.TabLanguageDataTable();
     genreTable          = new MediaDS.TabGenreDataTable();
     directorTable       = new MediaDS.TabDirectorDataTable();
     borrowTable         = new MediaDS.TabBorrowDataTable();
     mediaAvailableTable = new MediaDS.ViewMediaAvailableDataTable();
     mediaBorrowedTable  = new MediaDS.ViewMediaBorrowedDataTable();
 }
Example #2
0
        //Director tabel
        public List <IdAndValue> getAllDirectorTable()
        {
            List <IdAndValue> myList = new List <IdAndValue>();

            MediaDS.TabDirectorDataTable myData = mediaDAO.getAllDirectors();

            //parse data from datatable rows to list elements
            myList = parseDirectorDataTolist(myData);

            return(myList);
        }
Example #3
0
        public List <PairModel> ListDirector()
        {
            List <PairModel> list = new List <PairModel>();

            directorTable = mediaDAO.ListDirector();
            foreach (MediaDS.TabDirectorRow row in directorTable.Rows)
            {
                PairModel pair = PairModel.Parse(row);
                list.Add(pair);
            }
            return(list);
        }
        public List <PairModel> ListDirector()
        {
            List <PairModel> pairs = new List <PairModel>();

            MediaDS.TabDirectorDataTable directorTable = mediaDAO.ListDirector();

            foreach (MediaDS.TabDirectorRow row in directorTable.Rows)
            {
                PairModel pair = PairModel.Parse(row);
                pairs.Add(pair);
            }
            return(pairs);
        }
Example #5
0
        public List <PairModel> ListDirector()
        {
            List <PairModel> medias = new List <PairModel>();

            MediaDS.TabDirectorDataTable directorTable = mediaDAO.ListDirector();

            foreach (MediaDS.TabDirectorRow row in directorTable.Rows)
            {
                PairModel media = PairModel.Parse(row);
                medias.Add(media);
            }
            return(medias);
        }
Example #6
0
        public int getDirectorIdByName(string directorName)
        {
            //get data from DAO
            MediaDS.TabDirectorDataTable myData = mediaDAO.getDirectorByName(directorName);

            int recievedId = -1;

            foreach (MediaDS.TabDirectorRow row in myData.Rows) //should only result to one row
            {
                if (row != null)
                {
                    recievedId = row.DID;
                }
            }

            return(recievedId); //if is -1 their is an error
        }
Example #7
0
        //Parse genre director and language tables usign IdAndValueClass
        //tableDirector
        public List <IdAndValue> parseDirectorDataTolist(MediaDS.TabDirectorDataTable myDataTable)
        {
            List <IdAndValue> idVal = new List <IdAndValue>();

            foreach (MediaDS.TabDirectorRow row in myDataTable.Rows)
            //foreach (UserDS.TabUserRow row in myDataTable.Rows)
            {
                if (row == null)
                {
                    return(null);
                }
                else
                {
                    IdAndValue item = new IdAndValue(row.DID, row.DirectorName);
                    idVal.Add(item);
                }
            }
            return(idVal);
        }