Esempio n. 1
0
        private void SavesimpleButton_Click(object sender, EventArgs e)
        {
            var db = new LibraryEntities();

            if (UsernametextBox.Text != string.Empty && PasswordtextBox.Text != string.Empty)
            {
                var userExist = db.Users.SingleOrDefault(a => a.Username.Equals(UsernametextBox.Text));
                if (userExist != null)
                {
                    if (userExist.Password.Equals(PasswordtextBox.Text))
                    {
                        XtraMessageBox.Show("Welcome: " + userExist.Username, "logged in", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        DialogResult = DialogResult.OK;
                    }
                    else
                    {
                        XtraMessageBox.Show("wrong password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    XtraMessageBox.Show("user not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            else
            {
                XtraMessageBox.Show("insert fields", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 2
0
        private void SavesimpleButton_Click(object sender, EventArgs e)
        {
            var newbook = (Book)bookBindingSource.DataSource;
            var db      = new LibraryEntities();

            db.Books.Add(newbook);
            db.SaveChanges();

            XtraMessageBox.Show("book added sucessfully");
            DialogResult = DialogResult.OK;
        }
Esempio n. 3
0
        private void SavesimpleButton_Click(object sender, EventArgs e)
        {
            var db      = new LibraryEntities();
            var newuser = (User)userBindingSource.DataSource;

            db.Users.Add(newuser);
            db.SaveChanges();

            DialogResult = DialogResult.OK;
            XtraMessageBox.Show("new user added sucessfully");
        }
Esempio n. 4
0
        private void SavesimpleButton_Click(object sender, EventArgs e)
        {
            var lend = (Borrowedhistory)borrowedhistoryBindingSource.DataSource;
            var db   = new LibraryEntities();

            db.Borrowedhistories.Add(lend);
            db.SaveChanges();

            XtraMessageBox.Show("lent");
            DialogResult = DialogResult.OK;
        }