private void btnHistory_Click(object sender, EventArgs e)
        {
            this.dgvBorrow.Columns[5].HeaderText = "归还日期";
            BorrowHistoryBLL         bll  = new BorrowHistoryBLL();
            List <ShowBorrowHistory> list = bll.getListBorrowHisoryAll(stuID);

            this.dgvBorrow.DataSource = list;
            BookPage.DataCount        = bll.getBorrowAllCount(stuID);
            BookPage.PageIndex        = 1;
            //加载字体
            LoadBorrowAllFont();
        }
        /// <summary>
        /// 当前借阅列表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnNow_Click(object sender, EventArgs e)
        {
            IsBorrowHistoryNow = true;
            //点击当前借阅的按钮时,值为true!!
            this.dgvBorrow.Columns[5].HeaderText = "应归还日期";
            BorrowHistoryBLL         bll  = new BorrowHistoryBLL();
            List <ShowBorrowHistory> list = bll.getListBorrowHisoryNow(stuID);

            this.dgvBorrow.DataSource = list;
            BookPage.DataCount        = bll.getBorrowNowCount(stuID);
            BookPage.PageIndex        = 1;
            //加载字体!
            LoadBorrowNowFont();
        }
 /// <summary>
 /// 换页事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void BookPage_PageChange_Click(object sender, EventArgs e)
 {
     if (IsBorrowHistoryNow)
     {
         BorrowHistoryBLL         bll  = new BorrowHistoryBLL();
         List <ShowBorrowHistory> list = bll.getListBorrowHisoryNow(stuID);
         this.dgvBorrow.DataSource = list;
         //加载字体!!!
         LoadBorrowNowFont();
     }
     else
     {
         BorrowHistoryBLL         bll  = new BorrowHistoryBLL();
         List <ShowBorrowHistory> list = bll.getListBorrowHisoryAll(stuID);
         this.dgvBorrow.DataSource = list;
         //加载字体!!!
         LoadBorrowAllFont();
     }
 }
        /// <summary>
        /// 加载历史借阅时的字体
        /// </summary>
        private void LoadBorrowAllFont()
        {
            BorrowHistoryBLL bll = new BorrowHistoryBLL();

            foreach (DataGridViewRow row in this.dgvBorrow.Rows)
            {
                string bookID = row.Cells[0].Value.ToString();
                if (bll.judgeOverDateAll(stuID, bookID) == true)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        row.Cells[i].Style.ForeColor = Color.Red;
                    }
                }
                else
                {
                    for (int i = 0; i < 5; i++)
                    {
                        row.Cells[i].Style.ForeColor = Color.Green;
                    }
                }
            }
        }
Beispiel #5
0
        private void InfoBaseForm_Load(object sender, EventArgs e)
        {
            StudentInfoBLL   stubll   = new StudentInfoBLL();
            StudentInfoModel stuModel = new StudentInfoModel();
            GetGroupsBLL     group    = new GetGroupsBLL();

            stuModel            = stubll.getStudentInfoByID(stuID);
            txtstuName.Text     = stuModel.StuName;
            txtstuName.ReadOnly = true;

            txtstuID.Text     = stuModel.StuID;
            txtstuID.ReadOnly = true;

            txtentrance.Text     = stuModel.StuClass;
            txtentrance.ReadOnly = true;

            BorrowHistoryBLL         bll  = new BorrowHistoryBLL();
            List <ShowBorrowHistory> list = bll.getListBorrowHisoryNow(stuModel.StuID);

            txtnowBorrows.Text = list.Count.ToString();



            string    sql = "select schoolName from SchoolType where schoolid='" + stuModel.SchoolID + "'";
            SQLHelper h   = new SQLHelper();

            SqlParameter[] psa =
            {
                new SqlParameter("@stuID", stuID),
            };
            string s = h.ExecuteScalar(sql, psa).ToString();

            txtschool.Text     = s;
            txtschool.ReadOnly = true;

            string    sqla = "select CollegeName from Collegetype where CollegeId=" + "'" + stuModel.CollegeID + "'";
            SQLHelper a    = new SQLHelper();

            SqlParameter[] psb =
            {
                new SqlParameter("@stuID", stuID),
            };
            string t = a.ExecuteScalar(sqla, psb).ToString();

            txtcollege.Text     = t;
            txtcollege.ReadOnly = true;

            string    sqlb = "select ProfessionName from professiontype where ProfessionID=" + "'" + stuModel.ProfessionID + "'";
            SQLHelper b    = new SQLHelper();

            SqlParameter[] psc =
            {
                new SqlParameter("@stuID", stuID),
            };
            string u = b.ExecuteScalar(sqlb, psc).ToString();

            txtprofession.Text     = u;
            txtprofession.ReadOnly = true;

            txtstuClass.Text     = stuModel.StuClass;
            txtstuClass.ReadOnly = true;
            StudentInfoBLL stublld = new StudentInfoBLL();

            int m = stublld.timeoutBorrowsBook(stuID);

            stuModel.NowsCredit = stuModel.NowsCredit - m;
            txtnowsCredit.Text  = stuModel.NowsCredit.ToString();
            stublld.updateStudentInfo(stuModel);
        }