public void DoUpdate() { // ѕровер¤ем версию базы данных String databaseVersion = conSql.GetSystemValue("Database Version"); // ¬носим соответствующие корректировки в базу данных if (databaseVersion == "1.0") { Updating_1_0(); databaseVersion = "1.1"; } if (databaseVersion == "1.1") { Updating_1_1(); databaseVersion = "1.2"; } if (databaseVersion == "1.2") { Updating_1_2(); databaseVersion = "1.3"; } if (databaseVersion == "1.3") { Updating_1_3(); databaseVersion = "1.4"; } if (databaseVersion == "1.4") { Updating_1_4(); databaseVersion = "1.5"; } if (databaseVersion == "1.5") { Updating_1_5(); databaseVersion = "1.6"; } string departmentID = conSql.GetSystemValue("Department"); if (departmentID == null) { ChooseDepartmentForm frmChooseDepartment = new ChooseDepartmentForm(); frmChooseDepartment.ShowDialog(); } }
public AboutForm() { InitializeComponent(); SQLDBConnect conSql = new SQLDBConnect(); lblDBVersion.Text = conSql.GetSystemValue("Database Version"); lblPrgVersion.Text = AssemblyName.GetAssemblyName(Assembly.Load("ivrJournal").Location).Version.ToString(); }
private void dgSpr_UserAddedRow(object sender, DataGridViewRowEventArgs e) { if (nameSpr == "spr_party_number") { SQLDBConnect sqlCon = new SQLDBConnect(); dgSpr.CurrentRow.Cells[2].Value = sqlCon.GetSystemValue("Department"); } }
private void PrepareTables() { try { OleDbCon.Open(); OleDbDataAdapter specAdapter = new OleDbDataAdapter("SELECT * FROM spec ORDER BY last_name, first_name, patronymic", OleDbCon); OleDbDataAdapter eduAdapter = new OleDbDataAdapter("SELECT * FROM spr_edu", OleDbCon); OleDbDataAdapter mstatusAdapter = new OleDbDataAdapter("SELECT * FROM spr_mstatus", OleDbCon); OleDbDataAdapter profAdapter = new OleDbDataAdapter("SELECT * FROM spr_profession", OleDbCon); OleDbDataAdapter nationAdapter = new OleDbDataAdapter("SELECT * FROM spr_nation", OleDbCon); //OleDbDataAdapter partyAdapter = new OleDbDataAdapter("SELECT * FROM spr_party_number", OleDbCon); SQLDBConnect sqlCon = new SQLDBConnect(); String dep = sqlCon.GetSystemValue("Department"); String sqlStr = @"SELECT * FROM spr_party_number WHERE department_id='" + dep + @"'"; OleDbDataAdapter partyAdapter = new OleDbDataAdapter(sqlStr, OleDbCon); OleDbDataAdapter spr_profilactAdapter = new OleDbDataAdapter("SELECT * FROM spr_profilact_ychet", OleDbCon); OleDbDataAdapter enum_periodAdapter = new OleDbDataAdapter("SELECT * FROM enum_period", OleDbCon); OleDbCommandBuilder specBuilder = new OleDbCommandBuilder(specAdapter); OleDbCommandBuilder mstatusBuilder = new OleDbCommandBuilder(mstatusAdapter); OleDbCommandBuilder profBuilder = new OleDbCommandBuilder(profAdapter); OleDbCommandBuilder eduBuilder = new OleDbCommandBuilder(eduAdapter); OleDbCommandBuilder nationBuilder = new OleDbCommandBuilder(nationAdapter); OleDbCommandBuilder partyBuilder = new OleDbCommandBuilder(partyAdapter); OleDbCommandBuilder spr_profilactBuilder = new OleDbCommandBuilder(spr_profilactAdapter); // OleDbCommandBuilder enum_periodBuilder = new OleDbCommandBuilder(enum_periodAdapter); DataSet ds = new DataSet(); specAdapter.Fill(ds, "spec"); eduAdapter.Fill(ds, "spr_edu"); mstatusAdapter.Fill(ds, "spr_mstatus"); profAdapter.Fill(ds, "spr_profession"); nationAdapter.Fill(ds, "spr_nation"); partyAdapter.Fill(ds, "spr_party_number"); spr_profilactAdapter.Fill(ds, "spr_profilact_ychet"); enum_periodAdapter.Fill(ds, "enum_period"); BuildTableRelationship(ds); MainDataAdapter = specAdapter; MainDataSet = ds; OleDbCon.Close(); } catch (OleDbException odbe) { MessageBox.Show(odbe.Message, "ќшибка"); } }
public ChooseDepartmentForm() { InitializeComponent(); sqlCon = new SQLDBConnect(); bnBack.Enabled = false; dgRegion.Columns.Add(new DataGridViewTextBoxColumn()); dgRegion.Columns[0].DataPropertyName = "id"; dgRegion.Columns[0].Name = "id"; dgRegion.Columns[0].HeaderText = "Код ОКПО"; dgRegion.Columns[0].Width = 100; dgRegion.Columns.Add(new DataGridViewTextBoxColumn()); dgRegion.Columns[1].DataPropertyName = "name"; dgRegion.Columns[1].HeaderText = "Наименование региона"; dgRegion.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dgRegion.AutoGenerateColumns = false; dgDepartment.Columns.Add(new DataGridViewTextBoxColumn()); dgDepartment.Columns[0].DataPropertyName = "id"; dgDepartment.Columns[0].Name = "id"; dgDepartment.Columns[0].HeaderText = "Код ОКПО"; dgDepartment.Columns[0].Width = 100; dgDepartment.Columns.Add(new DataGridViewTextBoxColumn()); dgDepartment.Columns[1].DataPropertyName = "name"; dgDepartment.Columns[1].HeaderText = "Наименование подразделения"; dgDepartment.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dgDepartment.AutoGenerateColumns = false; /* * RegistryKey regKey = Registry.CurrentUser; * regKey = regKey.OpenSubKey("Software\\UFSIN\\ivrJournal"); * String dbPath = regKey.GetValue("dbPath", @"c:\Program files\ufsin_rk\Дневник ИВР\divr.mdb").ToString(); */ departmentID = sqlCon.GetSystemValue("Department"); dgRegion.DataSource = sqlCon.GetDataTable("region", "SELECT id, name FROM department WHERE higher='0'"); this.tabControl1.Selected += new TabControlEventHandler(tabControl1_Selected); }
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { toolStripProgressBar.Enabled = false; dgListPerson.DataSource = IsPresentView; SetRights(); SQLDBConnect sqlCon = new SQLDBConnect(); String dep = sqlCon.GetSystemValue("Department"); DataTable dt = sqlCon.GetDataTable("spr_party_number", @"SELECT * FROM spr_party_number WHERE department_id='" + dep + @"'"); cbParty.DataSource = dt; cbParty.SelectedIndex = -1; labelHelp.Text = "Загружено записей: " + dgListPerson.RowCount; ((MainForm)this.MdiParent).statusStrip.Items.Clear(); }
// DataTable dt_buf; public IVRTransferForm() { InitializeComponent(); DataGridViewTextBoxColumn textColumn = new DataGridViewTextBoxColumn(); { textColumn.DataPropertyName = "id"; textColumn.HeaderText = "код"; textColumn.Width = 30; textColumn.MinimumWidth = 50; textColumn.Visible = false; textColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; } dgIVRList.Columns.Add(textColumn); textColumn = new DataGridViewTextBoxColumn(); { textColumn.DataPropertyName = "last_name"; textColumn.HeaderText = "Фамилия"; textColumn.Width = 100; textColumn.MinimumWidth = 90; textColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } dgIVRList.Columns.Add(textColumn); textColumn = new DataGridViewTextBoxColumn(); { textColumn.DataPropertyName = "first_name"; textColumn.HeaderText = "Имя"; textColumn.Width = 100; textColumn.MinimumWidth = 90; textColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } dgIVRList.Columns.Add(textColumn); textColumn = new DataGridViewTextBoxColumn(); { textColumn.DataPropertyName = "patronymic"; textColumn.HeaderText = "Отчество"; textColumn.Width = 100; textColumn.MinimumWidth = 90; textColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } dgIVRList.Columns.Add(textColumn); textColumn = new DataGridViewTextBoxColumn(); { textColumn.DataPropertyName = "birthdate"; textColumn.HeaderText = "Дата рождения"; textColumn.Width = 80; textColumn.MinimumWidth = 80; textColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; } dgIVRList.Columns.Add(textColumn); DataGridViewCheckBoxColumn columnCheck = new DataGridViewCheckBoxColumn(); { columnCheck.Name = "selected"; columnCheck.DataPropertyName = "selected"; columnCheck.HeaderText = "Метка"; columnCheck.Width = 50; columnCheck.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; } dgIVRList.Columns.Add(columnCheck); sqlCon = new SQLDBConnect(); DataTable dt_buf = sqlCon.GetDataTable("spec", "SELECT * FROM spec WHERE is_present = true"); if (dt_buf == null) { return; } DataColumn newColumn5 = new DataColumn(); newColumn5.ColumnName = "selected"; newColumn5.DataType = System.Type.GetType("System.Boolean"); dt_buf.Columns.Add(newColumn5); foreach (DataRow row in dt_buf.Rows) { row["selected"] = false; } dgIVRList.AutoGenerateColumns = false; dgIVRList.DataSource = dt_buf; String dep = sqlCon.GetSystemValue("Department"); DataTable dt_party = sqlCon.GetDataTable("spr_party_number", @"SELECT * FROM spr_party_number WHERE department_id='" + dep + @"'"); cbParty.DataSource = dt_party; cbParty.ValueMember = "id"; cbParty.DisplayMember = "name"; cbParty.SelectedIndex = -1; }
private void dgEmployee_UserAddedRow(object sender, DataGridViewRowEventArgs e) { SQLDBConnect sqlCon = new SQLDBConnect(); dgEmployee.CurrentRow.Cells[1].Value = sqlCon.GetSystemValue("Department"); }