public void SøgSpecifiktEmnetyperFriTeskt(SearchForm searchForm)
        {
            _db = new DBConnectionstring();
            var constring = new SqlConnection(_db.DbConnectionString);

            constring.Open();

            var sqlDataAdapter1 =
                new SqlDataAdapter(
                    "Select tblEmnetyper.emnetype, tblEmnetyper.beskrivelse, tblSagsoplysninger.sagens_titel, tblSagsoplysninger.journalNr, tblMaterialetyper.materialetype from tblSagsoplysninger, tblEmnetyper, tblMaterialetyper" +
                    " where emnetype='" + searchForm.comboEmnetyper.SelectedItem +
                    "' and tblSagsoplysninger.sagens_titel like'" + searchForm.textboxSagstitel.Text + "%'"
                    ,
                    constring);

            var datatable1 = new DataTable();
            sqlDataAdapter1.Fill(datatable1);

            if (datatable1.Rows.Count == 0)
            {
                MessageBox.Show("Ingen rapporter fundet");
            }
            else
            {
                MessageBox.Show("fundet =" + datatable1.Rows.Count);
            }

            searchForm.dataGridView1.DataSource = datatable1;
            searchForm.Refresh();
        }
        public void EksperimentTyperSøgDbFRi(SearchForm searchForm)
        {
            DbConnection = new DBConnectionString();
            var constring = new SqlConnection(DbConnection.DbConnectionString);

            constring.Open();

            var sqlDataAdapter1 =
                new SqlDataAdapter(
                    "Select tblSagsoplysninger.sagens_titel, tblSagsoplysninger.journalNr, tblEksperimenttyper.eksperimenttype, tblMaterialetyper.materialetype, tblMaterialetyper.beskrivelse, tblPeriodetyper.periodetype from tblSagsoplysninger, tblMaterialetyper, tblEksperimenttyper, tblPeriodetyper " +
                    " where eksperimenttype='" + searchForm.EksperimenttyperComboBox.SelectedItem +
                    "' and tblSagsoplysninger.sagens_titel like'%" + searchForm.textboxSagstitel.Text + "%'"
                    ,
                    constring);

            var datatable1 = new DataTable();
            sqlDataAdapter1.Fill(datatable1);

            //if (datatable1.Rows.Count == 0)
            //{
            //    MessageBox.Show("Ingen rapporter fundet");
            //}
            //else
            //{
            //    MessageBox.Show("fundet =" + datatable1.Rows.Count);
            //}

            searchForm.dataGridView1.DataSource = datatable1;

            constring.Close();
            searchForm.Refresh();
        }
        public void SøgÅrstalAfsluttet(SearchForm searchForm)
        {
            DbConnection = new DBConnectionString();
            var constring = new SqlConnection(DbConnection.DbConnectionString);

            constring.Open();

            //searchForm.dateTimePickerAfslut.Format = DateTimePickerFormat.Custom;
            //searchForm.dateTimePickerAfslut.CustomFormat = "dd-MM-yyyy";

            var sqlDataAdapter1 =
                new SqlDataAdapter(
                    "Select tblSagsoplysninger.sagens_titel, tblSagsoplysninger.journalNr, tblSagsoplysninger.dato_oprettet, tblSagsoplysninger.dato_afsluttet from tblSagsoplysninger" +
                    " where dato_afsluttet='" + searchForm.textBoxsagAfsluttet.Text +
                    "' and tblSagsoplysninger.sagens_titel like'" + searchForm.textboxSagstitel.Text + "%'"
                    ,
                    constring);

            var datatable1 = new DataTable();
            sqlDataAdapter1.Fill(datatable1);

            //if (datatable1.Rows.Count == 0)
            //{
            //    MessageBox.Show("Ingen rapporter fundet");
            //}
            //else
            //{
            //    MessageBox.Show("fundet =" + datatable1.Rows.Count);
            //}

            searchForm.dataGridView1.DataSource = datatable1;

            constring.Close();
            searchForm.Refresh();
        }
Exemplo n.º 4
0
        public void SøgSpecifiktEmnetyperFriTeskt(SearchForm searchForm)
        {
            DbConnection = new DBConnectionString();
            var constring = new SqlConnection(DbConnection.DbConnectionString);

            constring.Open();

            var sqlDataAdapter1 =
                new SqlDataAdapter(
                    "select tblSagsoplysninger.sagens_titel, tblSagsoplysninger.journalNr, tblKontaktpersoner.fornavn, tblKontaktpersoner.efternavn, tblEmnetyper.emnetype,tblPeriodetyper.periodetype, tblSagsoplysningerEmnetyperLink.sagsIDref from tblSagsoplysninger " +
                    "jOIN tblKontaktpersoner " +
                    "ON tblSagsoplysninger.kontaktpersonIDref = tblKontaktpersoner.kontaktpersonID " +
                    "join tblSagsoplysningerEmnetyperLink " +
                    "on tblSagsoplysninger.sagsID = tblSagsoplysningerEmnetyperLink.sagsIDref " +
                    "join tblEmnetyper " +
                    "on tblSagsoplysningerEmnetyperLink.emneIDref = tblEmnetyper.emneID " +
                     "join tblSagsoplysningerPeriodetyperLink " +
                    "on tblSagsoplysninger.sagsID = tblSagsoplysningerPeriodetyperLink.sagsIDref " +
                    "join tblPeriodetyper " +
                    "on tblSagsoplysningerPeriodetyperLink.periodeIDref = tblPeriodetyper.periodeID " +
                    "where sagens_titel " +
                    "like'%" + searchForm.textboxSagstitel.Text + "%' " +
                    "and emnetype " +
                    "like'%" + searchForm.comboEmnetyper.Text + "%'"+
                    "and periodetype like'%" + searchForm.PeriodeTPComboBox.Text+ "%'"
                    ,
                    constring);

            var datatable1 = new DataTable();
            sqlDataAdapter1.Fill(datatable1);

            if (datatable1.Rows.Count == 0)
            {
                MessageBox.Show("Ingen rapporter fundet");
            }
            else
            {
                MessageBox.Show("fundet =" + datatable1.Rows.Count);
            }

            searchForm.dataGridView1.DataSource = datatable1;

            constring.Close();
            searchForm.Refresh();
        }
        public void ÅrstalSøgBetween(SearchForm searchForm)
        {
            DbConnection = new DBConnectionString();
            var constring = new SqlConnection(DbConnection.DbConnectionString);

            constring.Open();

            //searchForm.dateTimePickerOprettet.Format = DateTimePickerFormat.Custom;
            //searchForm.dateTimePickerOprettet.CustomFormat = "dd-MM-yyyy";

            //searchForm.dateTimePickerAfslut.Format = DateTimePickerFormat.Custom;
            //searchForm.dateTimePickerAfslut.CustomFormat = "dd-MM-yyyy";

            var datoOprettetList = new List<string>();

            //var sqlDataAdapter1 =
            //    new SqlDataAdapter(
            //         "Select tblSagsoplysninger.dato_oprettet from tblSagsoplysninger"
            //        ,
            //        constring);

            //var datatable1 = new DataTable();
            //sqlDataAdapter1.Fill(datatable1);

            //searchForm.dataGridView1.DataSource = datatable1;

            var query = "Select tblSagsoplysninger.dato_oprettet from tblSagsoplysninger";

            var sqlcmd = new SqlCommand(query, constring);

            var reader = sqlcmd.ExecuteReader();

            while (reader.Read())
            {
                datoOprettetList.Add(reader.GetString(0));
            }

            searchForm.dataGridView1.DataSource = datoOprettetList;

            constring.Close();
            searchForm.Refresh();

            //Select* from tblSagsoplysninger where tblSagsoplysninger.dato_oprettet like '%1996%'
        }