示例#1
0
        public void AddBorrower()
        {
            var addborrowerwindow = new AddBorrowerWindow();

            addborrowerwindow.DataContext = this;
            var result = addborrowerwindow.ShowDialog();

            if (result == true)
            {
                if (firstname == null | lastname == null | gender == null | type == null)
                {
                    MessageBox.Show("incomplete of filling up the information");
                }
                else
                {
                    BORROWERSLIST.Add(new Borrower(lastname, firstname, gender, type, idnumber, CheckBorrowedBook.NONE.ToString()));
                    MessageBox.Show("successfully added the borrower");
                }
                lastname  = null;
                firstname = null;
                gender    = null;
                type      = null;
            }
            else
            {
                lastname  = null;
                firstname = null;
                gender    = null;
                type      = null;
            }
        }
示例#2
0
        public void AddBorrower()
        {
            var addborrowerwindow = new AddBorrowerWindow();

            addborrowerwindow.DataContext = this;
            var result = addborrowerwindow.ShowDialog();

            if (result == true)
            {
                if (firstname == null | lastname == null | gender == null | type == null)
                {
                    MessageBox.Show("incomplete of filling up the information");
                }
                else
                {
                    SqlCommand command_borrower = new SqlCommand("INSERT INTO [BORROWER](LastName,Gender,FirstName,BorrowerType,BorrowStatus) VALUES(@LastName,@Gender,@FirstName,@BorrowerType,@BorrowStatus)", con);
                    //SqlCommand command_borrower = new SqlCommand("INSERT INTO [BORROWER](ID,LastName,Gender,FirstName,BorrowerType,BorrowStatus) VALUES(@ID,@LastName,@Gender,@FirstName,@BorrowerType,@BorrowStatus)", con);
                    //command_borrower.Parameters.AddWithValue("@ID", idnumber);
                    command_borrower.Parameters.AddWithValue("@LastName", lastname);
                    command_borrower.Parameters.AddWithValue("@Gender", gender);
                    command_borrower.Parameters.AddWithValue("@FirstName", firstname);
                    command_borrower.Parameters.AddWithValue("@BorrowerType", type);
                    command_borrower.Parameters.AddWithValue("@BorrowStatus", CheckBorrowedBook.NONE.ToString());
                    con.Open();
                    command_borrower.ExecuteNonQuery();
                    con.Close();
                    BORROWERSLIST.Add(new BORROWER(lastname, firstname, gender, type, idnumber, CheckBorrowedBook.NONE.ToString()));
                    MessageBox.Show("successfully added the borrower");
                }
            }
            lastname  = null;
            firstname = null;
            gender    = null;
            type      = null;
        }