private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { backgroundWorker.ReportProgress(0, "Загрузка данных..."); newDBcon = new MainDBConnect(IVRShared.GetDBPath()); IsPresentView = new DataView(newDBcon.GetDataTable("spec")); IsPresentView.RowFilter = "is_present = true"; backgroundWorker.ReportProgress(100, "Загрузка завершена!"); }
public ProfileForm(MainDBConnect newDbCon) { InitializeComponent(); /* * RegistryKey regKey = Registry.CurrentUser; * regKey = regKey.OpenSubKey("Software\\UFSIN\\ivrJournal"); * MainDBConnect newDBcon = new MainDBConnect(regKey.GetValue("dbPath", "").ToString()); */ pd = new ProfileData(); this.IsNew = true; this.dbCon = newDbCon; SetCBFields(); SetRights(); //pbFoto.Load(@"\\xaos\OK_AISS\Фото сотрудников\АППАРАТ\Балалаев Игорь Николаевич - Старая.jpg"); }
public ProfileForm(MainDBConnect newDbCon, DataRow selRow) { InitializeComponent(); pd = new ProfileData(); this.IsNew = false; this.selRow = selRow; this.dbCon = newDbCon; SetCBFields(); this.tbLastName.Text = selRow["last_name"].ToString(); this.tbFirstName.Text = selRow["first_name"].ToString(); this.tbPatronymic.Text = selRow["patronymic"].ToString(); this.mtbBirthDate.Text = selRow["birthdate"].ToString(); //MessageBox.Show(cbEducation.SelectedValue.ToString()); if ((selRow["edu_id"].ToString()) != "") { cbEducation.SelectedValue = (int)selRow["edu_id"]; } if ((selRow["mstatus_id"].ToString()) != "") { cbMstatus.SelectedValue = (int)selRow["mstatus_id"]; } if ((selRow["profession_id"].ToString()) != "") { cbProfession.SelectedValue = (int)selRow["profession_id"]; } if ((selRow["nation_id"].ToString()) != "") { cbNation.SelectedValue = (int)selRow["nation_id"]; } if ((selRow["party_id"].ToString()) != "") { cbParty.SelectedValue = (int)selRow["party_id"]; } this.tbCourt.Text = selRow["court"].ToString(); this.tbArticle.Text = selRow["article"].ToString(); this.mtbCrimeDate.Text = selRow["crime_date"].ToString(); this.tbPeriod.Text = selRow["period"].ToString(); this.lblPeriod.Text = CalcPeriod(selRow["period_start"].ToString(), selRow["period_end"].ToString()); this.mtbPeriodStart.Text = selRow["period_start"].ToString(); this.mtbPeriodEnd.Text = selRow["period_end"].ToString(); this.mtbDateLight.Text = selRow["period_light"].ToString(); this.mtbDateNormal.Text = selRow["period_normal"].ToString(); this.mtbDateKp.Text = selRow["period_kp"].ToString(); this.mtbDateUdo.Text = selRow["period_udo"].ToString(); this.tbCrimeDesc.Text = selRow["crime_description"].ToString(); this.tbMedDesc.Text = selRow["med_description"].ToString(); this.tbOther.Text = selRow["other"].ToString(); this.tbResult.Text = selRow["result"].ToString(); try { String fotoPath = selRow["foto"].ToString(); if (fotoPath != String.Empty) { pbFoto.Load(dbCon.GetDBDirPath() + @"\" + fotoPath); } pd.foto = fotoPath; } catch (IOException ioe) { MessageBox.Show(ioe.Message, "Ошибка"); } SetRights(); }
public KartArchiveForm() { InitializeComponent(); RegistryKey regKey = Registry.CurrentUser; regKey = regKey.OpenSubKey("Software\\UFSIN\\ivrJournal"); newDBcon = new MainDBConnect(regKey.GetValue("dbPath", "").ToString()); DataGridViewTextBoxColumn textColumn = new DataGridViewTextBoxColumn(); { textColumn.DataPropertyName = "id"; textColumn.HeaderText = "код"; textColumn.Width = 30; textColumn.MinimumWidth = 50; textColumn.Visible = false; textColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; } dgArchive.Columns.Add(textColumn); textColumn = new DataGridViewTextBoxColumn(); { textColumn.DataPropertyName = "last_name"; textColumn.HeaderText = "Фамилия"; textColumn.Width = 100; textColumn.MinimumWidth = 90; textColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } dgArchive.Columns.Add(textColumn); textColumn = new DataGridViewTextBoxColumn(); { textColumn.DataPropertyName = "first_name"; textColumn.HeaderText = "Имя"; textColumn.Width = 100; textColumn.MinimumWidth = 90; textColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } dgArchive.Columns.Add(textColumn); textColumn = new DataGridViewTextBoxColumn(); { textColumn.DataPropertyName = "patronymic"; textColumn.HeaderText = "Отчество"; textColumn.Width = 100; textColumn.MinimumWidth = 90; textColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } dgArchive.Columns.Add(textColumn); textColumn = new DataGridViewTextBoxColumn(); { textColumn.DataPropertyName = "birthdate"; textColumn.HeaderText = "Дата рождения"; textColumn.Width = 80; textColumn.MinimumWidth = 80; textColumn.AutoSizeMode = DataGridViewAutoSizeColumnMode.None; } dgArchive.Columns.Add(textColumn); DataView IsPresentView = new DataView(newDBcon.GetDataTable("spec")); IsPresentView.RowFilter = "is_present = false"; dgArchive.AutoGenerateColumns = false; dgArchive.DataSource = IsPresentView; labelHelp.Text = "Загружено записей: " + dgArchive.RowCount; toolTip1.SetToolTip(bnUnDelete, "Восстановить из архива"); toolTip1.SetToolTip(bnClose, "Закрыть форму"); SetRights(); }