private void UserForm_Load(object sender, EventArgs e) { ClassBackEnd.GetIntoPersonCenter(); UserInfoLoad(); ButtonState = 0; SheeetRefresh(); BookRecordSheet.Hide(); #region 返回按钮处理 frmMain.ReturnButton.Tag = 1; Point t = new Point(61, 11); frmMain.ReturnButton.Show(); frmMain.TitleLabel.Location = t; #endregion }
private void BookInfoButton_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (ButtonState == 0) { BookInfoLabel.Text = "借阅记录"; BookInfoButton.Text = "借书信息"; ButtonState = 1; BookRecordSheet.Show(); BorrowInfoSheet.Hide(); } else { BookInfoLabel.Text = "借书信息"; BookInfoButton.Text = "借阅记录"; ButtonState = 0; BookRecordSheet.Hide(); BorrowInfoSheet.Show(); } }
private void SheeetRefresh() { int i = 0; BorrowInfoSheet.Rows.Clear(); for (i = 0; i < ClassBackEnd.Userbsbook.Count; i++) { DataGridViewRow row = new DataGridViewRow(); int index = BorrowInfoSheet.Rows.Add(row); BorrowInfoSheet.Rows[index].Cells[0].Value = ClassBackEnd.Userbsbook[i].Bookname; BorrowInfoSheet.Rows[index].Cells[1].Value = ClassBackEnd.Userbsbook[i].Bsdate + " " + ClassBackEnd.Userbsbook[i].Rgdate; if (ClassBackEnd.Userbsbook[i].Isborrowed) { BorrowInfoSheet.Rows[index].Cells[2].Value = "借阅"; } else { BorrowInfoSheet.Rows[index].Cells[2].Value = "预约"; } BorrowInfoSheet.Rows[index].Height = 60; } while (i < 4) { DataGridViewRow row = new DataGridViewRow(); int index = BorrowInfoSheet.Rows.Add(row); BorrowInfoSheet.Rows[index].Cells[0].Value = ""; BorrowInfoSheet.Rows[index].Cells[1].Value = ""; BorrowInfoSheet.Rows[index].Cells[2].Value = ""; BorrowInfoSheet.Rows[index].Height = 60; i++; } BorrowInfoSheet.ClearSelection(); BorrowInfoSheet.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; BorrowInfoSheet.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; BorrowInfoSheet.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; BookRecordSheet.Rows.Clear(); for (i = 0; i < ClassBackEnd.Borrowhis.Count; i++) { DataGridViewRow row = new DataGridViewRow(); int index = BookRecordSheet.Rows.Add(row); BookRecordSheet.Rows[index].Cells[0].Value = ClassBackEnd.Borrowhis[i].Bookname; BookRecordSheet.Rows[index].Cells[1].Value = ClassBackEnd.Borrowhis[i].Borrowdata + " " + ClassBackEnd.Borrowhis[i].Returndata; BookRecordSheet.Rows[index].Cells[2].Value = "详情"; BookRecordSheet.Rows[index].Height = 60; } while (i < 7) { DataGridViewRow row = new DataGridViewRow(); int index = BookRecordSheet.Rows.Add(row); BookRecordSheet.Rows[index].Cells[0].Value = ""; BookRecordSheet.Rows[index].Cells[1].Value = ""; BookRecordSheet.Rows[index].Cells[2].Value = ""; BookRecordSheet.Rows[index].Height = 60; i++; } BookRecordSheet.ClearSelection(); BookRecordSheet.Columns[1].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; BookRecordSheet.Columns[2].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; BookRecordSheet.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; }