示例#1
0
        public void Fill_User_List(DataTable dt, INFO_COLOR_MODE color_mode)
        {
            int rows_count = dt.Rows.Count;

            // IMPORTANT
            if (rows_count == 0)
            {
                return;
            }

            for (int i = 0; i < rows_count; i++)
            {
                int user_id = int.Parse(dt.Rows[i][0].ToString());
                if (user_id == 0)
                {
                    continue;
                }
                string name     = dt.Rows[i][1].ToString();
                string surname  = dt.Rows[i][2].ToString();
                string gender   = dt.Rows[i][3].ToString();
                int    age      = int.Parse(dt.Rows[i][4].ToString());
                string email    = dt.Rows[i][5].ToString();
                string password = dt.Rows[i][6].ToString();
                string date     = dt.Rows[i][7].ToString();
                int    fee      = int.Parse(dt.Rows[i][8].ToString());

                User user = new User(user_id, name, surname, gender, age, email, password, date, fee);
                user.Set_Book(color_mode);
                this.Add_User_to_List(user);
            }
        }
示例#2
0
        public void Fill_Book_List(DataTable dt, Book_List main_list, Book_List search_list, Book_Tag main_tag, Panel main_panel, INFO_COLOR_MODE color_mode, bool fill_image_list = true)
        {
            int rows_count = book_count = dt.Rows.Count;

            // IMPORTANT
            if (rows_count == 0)
            {
                return;
            }

            for (int i = 0; i < rows_count; i++)
            {
                int book_id = int.Parse(dt.Rows[i][0].ToString());
                if (book_id == 0)
                {
                    continue;
                }
                int    author_id        = int.Parse(dt.Rows[i][1].ToString());
                int    publisher_id     = int.Parse(dt.Rows[i][2].ToString());
                int    category_id      = int.Parse(dt.Rows[i][3].ToString());
                int    librarian_id     = int.Parse(dt.Rows[i][4].ToString());
                int    shelf_id         = int.Parse(dt.Rows[i][5].ToString());
                int    popularity_id    = int.Parse(dt.Rows[i][6].ToString());
                string name             = dt.Rows[i][7].ToString();
                string date             = dt.Rows[i][8].ToString();
                string description      = dt.Rows[i][9].ToString();
                int    count            = int.Parse(dt.Rows[i][10].ToString());
                string cover_path       = dt.Rows[i][11].ToString();
                int    popularity_score = int.Parse(dt.Rows[i][12].ToString());

                Book book = new Book(book_id, author_id, publisher_id, category_id, librarian_id, shelf_id, name, count, date, description, cover_path, popularity_id, popularity_score);
                book.Set_Book(main_list, search_list, main_tag, main_panel, color_mode);
                this.Add_Book_to_List(book);
            }

            if (fill_image_list)
            {
                Fill_Cover_Image_List();
            }
        }