private void buttonRecovery_Click(object sender, EventArgs e) { if (confCode == textBoxCode.Text) { string digest = Authorization.SHAdigest(textBoxNewPassword.Text); if (DBAction.updatePassword(digest, login)) { MessageBox.Show("Пароль изменен! Теперь вы можете войти в систему"); DBAction.libraryDS.Tables["login"].Clear(); FormAutho.getDataUsers(); this.Close(); } else { MessageBox.Show("Возникла ошибка"); } } else { MessageBox.Show("Введен неверный код"); } }
private void buttonSaveChange_Click(object sender, EventArgs e) { //departmentDataTable.AcceptChanges(); //dataAdapter.Update((DataTable)bindingSourceDepartment.DataSource); //sqlQuery = "update department(address, phone, e_mail) set values (" + dataGridDepartment.CurrentCell.Value + ", " + dataGridDepartment.CurrentCell.Value + ", " + dataGridDepartment.CurrentCell.Value + ") where " + dataGridDepartment.CurrentCell.RowIndex + " = id_department"; //DBAction.updateDataTable(ref dataAdapterDepartment, sqlQuery); //dataAdapter.UpdateCommamd((DataTable)bindingSourceDepartment.DataSource); departmentDataAdapter = new NpgsqlDataAdapter(); #region parameteters.add deleteCommand.Parameters.Add("@Id", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "id_department"; insertCommand.Parameters.Add("@Address", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "address"; insertCommand.Parameters.Add("@Phone", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "phone"; insertCommand.Parameters.Add("@Email", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "e_mail"; updateCommand.Parameters.Add("@Address", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "address"; updateCommand.Parameters.Add("@Phone", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "phone"; updateCommand.Parameters.Add("@Email", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "e_mail"; updateCommand.Parameters.Add("@Id", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "id_department"; #endregion departmentDataAdapter.UpdateCommand = updateCommand; departmentDataAdapter.DeleteCommand = deleteCommand; departmentDataAdapter.InsertCommand = insertCommand; DBAction.updateDataTable(departmentDataAdapter, table); getTableDepartment(); }
private void buttonSaveChange_Click(object sender, EventArgs e) { readersDataAdapter = new NpgsqlDataAdapter(); #region parameteters.add deleteCommand.Parameters.Add("@Id", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "id_library_kard"; insertCommand.Parameters.Add("@NameReader", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "name_reader"; insertCommand.Parameters.Add("@Address", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "home_address"; insertCommand.Parameters.Add("@Phone", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "phone"; insertCommand.Parameters.Add("@Email", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "e_mail"; updateCommand.Parameters.Add("@NameReader", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "name_reader"; updateCommand.Parameters.Add("@Address", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "home_address"; updateCommand.Parameters.Add("@Phone", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "phone"; updateCommand.Parameters.Add("@Email", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "e_mail"; updateCommand.Parameters.Add("@Id", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "id_library_kard"; #endregion readersDataAdapter.UpdateCommand = updateCommand; readersDataAdapter.DeleteCommand = deleteCommand; readersDataAdapter.InsertCommand = insertCommand; DBAction.updateDataTable(readersDataAdapter, table); getTableReaders(); }
public void dataAdapterCommand() { bookDataAdapter = new NpgsqlDataAdapter(); #region parameteters.add deleteCommand.Parameters.Add("@Id", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "id_library_cipher"; insertCommand.Parameters.Add("@Author", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "author"; insertCommand.Parameters.Add("@Name", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "name_book"; insertCommand.Parameters.Add("@Year", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "year_book"; insertCommand.Parameters.Add("@Pages", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "number_of_pages"; insertCommand.Parameters.Add("@Copies", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "number_of_copies"; insertCommand.Parameters.Add("@Department", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "id_department"; updateCommand.Parameters.Add("@Author", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "author"; updateCommand.Parameters.Add("@Name", NpgsqlTypes.NpgsqlDbType.Varchar).SourceColumn = "name_book"; updateCommand.Parameters.Add("@Year", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "year_book"; updateCommand.Parameters.Add("@Pages", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "number_of_pages"; updateCommand.Parameters.Add("@Copies", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "number_of_copies"; updateCommand.Parameters.Add("@Department", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "id_department"; updateCommand.Parameters.Add("@Id", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "id_library_cipher"; #endregion bookDataAdapter.UpdateCommand = updateCommand; bookDataAdapter.DeleteCommand = deleteCommand; bookDataAdapter.InsertCommand = insertCommand; DBAction.updateDataTable(bookDataAdapter, table); getTableBook(); }
public void dataAdapterCommand() { #region parameteters.add deleteCommand.Parameters.Add("@Id", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "id_booking"; insertCommand.Parameters.Add("@LibraryCipher", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = DBAction.libraryDS.Tables[table].Columns[1].ToString(); insertCommand.Parameters.Add("@LibraryCard", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = DBAction.libraryDS.Tables[table].Columns[2].ToString(); insertCommand.Parameters.Add("@DateBooking", NpgsqlTypes.NpgsqlDbType.Date).SourceColumn = DBAction.libraryDS.Tables[table].Columns[3].ToString(); insertCommand.Parameters.Add("@Department", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = DBAction.libraryDS.Tables[table].Columns[4].ToString(); updateCommand.Parameters.Add("@DateBooking", NpgsqlTypes.NpgsqlDbType.Date).SourceColumn = "date_booking"; updateCommand.Parameters.Add("@Department", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "id_department"; updateCommand.Parameters.Add("@Id", NpgsqlTypes.NpgsqlDbType.Integer).SourceColumn = "id_booking"; #endregion bookingDataAdapter.UpdateCommand = updateCommand; bookingDataAdapter.DeleteCommand = deleteCommand; bookingDataAdapter.InsertCommand = insertCommand; DBAction.updateDataTable(bookingDataAdapter, table); getTableBooking(); }
public static void getDataUsers() { Npgsql.NpgsqlDataAdapter loginDataAdapter; DBAction.getData(out loginDataAdapter, "login"); }
public static void getTableDepartment() { DBAction.libraryDS.Tables[table].Clear(); DBAction.getData(out departmentDataAdapter, table); }
public static void getTableReaders() { DBAction.libraryDS.Tables[table].Clear(); DBAction.getData(out readersDataAdapter, table); }
public static void getTableBook() { DBAction.libraryDS.Tables[table].Clear(); DBAction.getData(out bookDataAdapter, table); }
public static void getTableIssuingBooks() { DBAction.libraryDS.Tables[table].Clear(); DBAction.getData(out issuingBooksDataAdapter, table); }