//public frmNewMember(string userNameFromLogin, string userCategory)
        //{
        //    InitializeComponent();
        //    // Assign the properties UserNameFromLogin & UserCategory respectively when form is contructed
        //    UserNameFromLogin = userNameFromLogin;
        //    UserCategory = userCategory;
        //}

        private void frmNewMember_Load(object sender, EventArgs e)
        {
            context = new PGPLibraryEntities();
            n       = new Navigation();
            txtBoxPassword.UseSystemPasswordChar      = true;
            txtBoxPasswordCheck.UseSystemPasswordChar = true;
        }
 private void frmNewMember2_Load(object sender, EventArgs e)
 {
     HideWarningLabels();
     n               = new Navigation();
     context         = new PGPLibraryEntities();
     isSubmitClicked = false;
 }
Esempio n. 3
0
        private void frmBorrowBook_BookID_Load(object sender, EventArgs e)
        {
            n       = new Navigation();
            context = new PGPLibraryEntities();
            var a = context.BookListings.Select(x =>
                                                new
            {
                x.BookID,
                x.ISBN,
                x.BookTitle,
                x.BookType,
                x.Language,
                x.AuthorID,
                x.PublisherID,
                x.TotalStock,
                x.NumberLoaned,
                x.Section,
                x.CallNumber,
                x.Notes,
                x.Publisher.PublisherName,
                x.Author.AuthorName
            });


            if (a != null)
            {
                dgvSearchBookID.DataSource = a.ToList();
            }
        }
Esempio n. 4
0
        private void frmSearchBook_Load(object sender, EventArgs e)
        {
            n = new Navigation();
            PGPLibraryEntities context = new PGPLibraryEntities();

            lblUser.Text            = $"{UserCategory}: {UserNameFromLogin}";
            lblBookNotFound.Visible = false;
            lblBookAvailble.Visible = false;
        }
        private void frmBorrowBook_Load(object sender, EventArgs e)
        {
            n                   = new Navigation();
            context             = new PGPLibraryEntities();
            lblUserDetails.Text = $"{UserCategory}: {UserNameFromLogin}";
            int?a = context.Members.Where(x => x.Username.ToUpper() == UserNameFromLogin.ToUpper()).Select(x => x.MemberID).FirstOrDefault();

            if (a != null)
            {
                txtBoxMemberID.Text = a.ToString();
                var firstName = context.Members.Where(x => x.Username.ToUpper() == UserNameFromLogin.ToUpper()).Select(x => x.FirstName).First();
                var lastName  = context.Members.Where(x => x.Username.ToUpper() == UserNameFromLogin.ToUpper()).Select(x => x.LastName).First();
                txtBoxMemberName.Text = $"{firstName} {lastName}";
            }
            dtpBorrow.Value           = DateTime.Now;
            dtpDue.Value              = DateTime.Now.AddMonths(1);
            lblNoBooksWarning.Visible = false;
        }
Esempio n. 6
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            PGPLibraryEntities context = new PGPLibraryEntities();
            BookListing        nbook   = new BookListing();
            BookAdjustment     adjust  = new BookAdjustment();

            if (!GotEmptyField() && AdddataType() && IsAddMore())
            {
                //Update Booklisting Table
                nbook.ISBN       = txtISBNAdd.Text;
                nbook.BookTitle  = txtBookTitleAdd.Text;
                nbook.CallNumber = txtCallNoAdd.Text;
                nbook.Notes      = txtNoteAdd.Text;
                nbook.BookType   = cboBoxBookTypeAdd.SelectedItem.ToString();
                nbook.Language   = cboBoxLanguageAdd.SelectedItem.ToString();
                Author author = context.Authors.Where(x => x.AuthorName == cboBoxAuthorAdd.SelectedItem.ToString()).First();
                nbook.AuthorID = author.AuthorID;
                Publisher publisher = context.Publishers.Where(x => x.PublisherName == cboBoxPublisherAdd.SelectedItem.ToString()).First();
                nbook.PublisherID  = publisher.PublisherID;
                nbook.Section      = cboBoxSectionAdd.SelectedItem.ToString();
                nbook.BookID       = "B00" + context.ControlTables.Where(x => x.NumberType == "BookID").Select(x => x.FirstFreeNo).First();
                nbook.NumberLoaned = 0;

                //Update BookAdjustment Table
                adjust.BookID     = "B00" + context.ControlTables.Where(x => x.NumberType == "BookID").Select(x => x.FirstFreeNo).First();
                adjust.DateAdjust = DateTime.Now;
                //Librarian librarian = context.Librarians.Where(x => x.Username == lblUser.Text).First();
                //adjust.WhoAdjust = librarian.LibrarianID;
                adjust.WhoAdjust        = Convert.ToInt32("4000");
                adjust.AdjustmentReason = "Buy new books";
                adjust.AdjustmentQty    = Convert.ToInt32(txtQuantityAdd.Text);
                nbook.TotalStock        = Convert.ToInt32(txtQuantityAdd.Text);
                ////Update ControlNumber
                //ControlTable control = context.ControlTables.Where(x => x.NumberType == "BookID").First();
                //control.FirstFreeNo += 1;
                MessageBox.Show("Add book successfully.");
                context.BookAdjustments.Add(adjust);
                context.BookListings.Add(nbook);
                context.SaveChanges();
            }
        }
Esempio n. 7
0
        private void frmProfile_Load(object sender, EventArgs e)
        {
            n = new Navigation();
            lblUserDetails.Text = $"{UserCategory}: {UserNameFromLogin}";
            PGPLibraryEntities context = new PGPLibraryEntities();

            if (UserCategory == "Member")
            {
                var s = from x in context.Members
                        where x.Username == UserNameFromLogin
                        select new { x.MemberID };
                int memberID = Convert.ToInt32(s.FirstOrDefault().MemberID);

                //MemberID is int
                var q = from x in context.IssueTrans
                        from y in context.BookListings
                        where x.BookID == y.BookID && x.LoanStatus == "OUT" && x.MemberID == memberID
                        select new { x.TransactionID, x.MemberID, x.BookID, y.BookTitle, x.DateBorrow, x.DateDue, x.OverdueFine };
                dgvProfile.DataSource = q.ToList();
            }
        }
 private void frmDashboard_Load(object sender, EventArgs e)
 {
     context             = new PGPLibraryEntities();
     n                   = new Navigation();
     lblUserDetails.Text = $"{UserCategory}: {UserNameFromLogin}";
 }