コード例 #1
0
        private void BookDetailsFrom_Load(object sender, EventArgs e)
        {
            if (user.getType() == 1)
            {
                DataTable dt = DataAccess.LoadData("select BookDetails.Id,Book.Name as'BookName',BookDetails.Status,BookDetails.DaskNo from BookDetails,Book where BookDetails.BookId=Book.Id ");
                dt.Columns.Add("StatusName");
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    int statusID = Int32.Parse(dt.Rows[i]["Status"].ToString());
                    dt.Rows[i]["StatusName"] = ((Enumcollection.BookStatus)statusID).ToString();
                }
                dgvBookDetails.DataSource = dt;
                dgvBookDetails.ClearSelection();
                dgvBookDetails.Refresh();

                cBoxStatus.DataSource    = Enumcollection.BookStatusList();
                cBoxStatus.DisplayMember = "Name";
                cBoxStatus.ValueMember   = "ID";
            }
            else
            {
                btnUpdate.Visible   = false;
                txtBookName.Visible = false;
                txtDaskNo.Visible   = false;
                UpdateLabel.Visible = false;
                cBoxStatus.Visible  = false;
                txtDaskNo.Visible   = false;
                btnLoad.Visible     = false;
                lblBName.Visible    = false;
                lblDeskNo.Visible   = false;
                lblId.Visible       = false;
                lblStatus.Visible   = false;
                txtId.Visible       = false;
            }
        }
コード例 #2
0
        private void BorrowHistoryForm_Load(object sender, EventArgs e)
        {
            if (user.getType() == 1)
            {
                DataTable dt = DataAccess.LoadData("select BorrowHistory.Id,UserInfo.UserName,Book.Name as'BookName',BorrowHistory.BorrowDate,BorrowHistory.ExpectedReturnDate,BorrowHistory.ReturnDate,BorrowHistory.LateFine,BorrowHistory.LostFine from BorrowHistory,BookDetails,UserInfo,Book where BorrowHistory.UserId=UserInfo.Id and BorrowHistory.BookDetailsId=BookDetails.Id and BookDetails.BookId = Book.Id");

                dgvBorrowHistory.DataSource = dt;
                dgvBorrowHistory.ClearSelection();
                dgvBorrowHistory.Refresh();
            }
            else
            {
                DataTable dt = DataAccess.LoadData("select * from UserBorrowHistory where UserName ='******' ");

                dgvBorrowHistory.DataSource = dt;
                dgvBorrowHistory.ClearSelection();
                dgvBorrowHistory.Refresh();
                btnUpdate.Visible   = false;
                btnLoad.Visible     = false;
                txtBookName.Visible = false;
                txtId.Visible       = false;
                txtLateFine.Visible = false;
                txtLostFine.Visible = false;
                txtUserName.Visible = false;
                lblBDate.Visible    = false;
                lblBName.Visible    = false;

                lblERDate.Visible   = false;
                lblId.Visible       = false;
                lblLateFine.Visible = false;
                lblLostFine.Visible = false;
                lblRDate.Visible    = false;
                lblUName.Visible    = false;
                dtpBDate.Visible    = false;
                dtpERDate.Visible   = false;
                dtpRDate.Visible    = false;
                txtSearch.Visible   = false;
                lblUBH.Visible      = false;
                lblUN.Visible       = false;
                btnSearch.Visible   = false;
            }
        }