private void ReportViewRecentSlides_Load(object sender, EventArgs e) { lookupServices = new LookUpServices(); //get Speciece Specifics dictionarySpecifics = lookupServices.fetchLookupTables("species_specifics"); dictionarySCatgerory = lookupServices.fetchLookupTables("species_category"); dictionaryStages = lookupServices.fetchLookupTables("species_stages"); dictionaryDCatgerory = lookupServices.fetchLookupTables("density_category"); ReportDocument reportDocumument = new ReportDocument(); DataGridView recentSLideDataGridView = new DataGridView(); //just getting the Form 2 instance, you can implement it in any way you choose to (e.g. make it global...) //Slides slideFormsFromReport = this.ParentForm.MdiChildren.Any(child => child is Slides).().SingleOrDefault(); Slides slideFormsFromReport = Application.OpenForms.OfType <Slides>().FirstOrDefault(); if (slideFormsFromReport != null) { //MessageBox.Show("got SLides"); recentSLideDataGridView = slideFormsFromReport.getDataGridView(); //added created date as filter of todays eneter slides String query = "SELECT TOP (500) s.id, s.bar_code, s.sequence, s.donor_id, s.cabinet_number, s.drawer_number, s.box_number, s.isDamaged, s.isReserved, s.isBorrowed, s.isActive, s.updated_date, s.created_date, s.created_by, s.updated_by, d.id AS donor_donor_id, d.donor_code, d.species_specific_id, d.species_stage_id, d.species_catgeroy_id, d.lower_density, d.average_density, d.upper_density, d.density_category_id, d.owner_id, d.acquired_date, d.country_code, d.comment, d.validation_id FROM dbo.slides AS s INNER JOIN dbo.donors AS d ON d.id = s.donor_id WHERE(d.isActive = 1) AND(s.isActive = 1) AND(s.isBorrowed = 0) ORDER BY s.created_date desc;"; SqlDataAdapter dataAdapter = new SqlDataAdapter(query, DBConnectionSingltonServices.GetConnection()); dataAdapter.SelectCommand.CommandText = query; DataTable sqldatatable = new DataTable(); dataAdapter.Fill(sqldatatable); CrystalReportRecentSlides crpt1Recent = new CrystalReportRecentSlides(); crpt1Recent.Database.Tables["recent_slide_dataset"].SetDataSource(sqldatatable); crystalReportViewer1.ReportSource = crpt1Recent; } }
private void Checkout_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'sbmsDataSet.species_category' table. You can move, or remove it, as needed. this.species_categoryTableAdapter.Fill(this.sbmsDataSet.species_category); // TODO: This line of code loads data into the 'sbmsDataSet.species_stages' table. You can move, or remove it, as needed. this.species_stagesTableAdapter.Fill(this.sbmsDataSet.species_stages); // TODO: This line of code loads data into the 'sbmsDataSet1.density_category' table. You can move, or remove it, as needed. this.density_categoryTableAdapter.Fill(this.sbmsDataSet1.density_category); // TODO: This line of code loads data into the 'sbmsDataSet.borrower_contact_list' table. You can move, or remove it, as needed. this.borrower_contact_listTableAdapter.Fill(this.sbmsDataSet.contact_list); // TODO: This line of code loads data into the 'sbmsDataSet.slides_for_checkout' table. You can move, or remove it, as needed. this.slidesCheckoutTableAdapter.Fill(this.sbmsDataSet.slides_for_checkout); Dictionary <int, string> borrowerDic = new Dictionary <int, string>(); borrowerDic.Add(0, "--Select Borrower/Contact---"); foreach (DataRow row in this.sbmsDataSet.contact_list.Rows) { borrowerDic.Add(Convert.ToInt32(row["id"]), row["fname"] + " " + row["lname"] + " Org: " + row["organisation"] + " Position: " + row["job_title"]); } cmb_borrowers.DataSource = new BindingSource(borrowerDic, null); ; cmb_borrowers.DisplayMember = "Value"; cmb_borrowers.ValueMember = "Key"; //cmb_borrowers.SelectedItem = 0; //cmb_borrowers.Bind(); // this.borr.Fill(this.sbmsDataSet.slides_for_checkout); DataGridViewCheckBoxColumn dgvCheckBox = new DataGridViewCheckBoxColumn(); dgvCheckBox.HeaderText = "Select"; dgvCheckBox.ReadOnly = false; dgvCheckBox.DefaultCellStyle.BackColor = Color.Red; dgvCheckBox.Name = "DGVCheckBox"; grd_slides_for_checkout.Columns.Insert(0, dgvCheckBox); grd_slides_for_checkout.ReadOnly = false; lookupServices = new LookUpServices(); //get Speciece Specifics dictionarySpecifics = lookupServices.fetchLookupTables("species_specifics"); cmb_specice_specifics.DataSource = new BindingSource(dictionarySpecifics, null); cmb_specice_specifics.ValueMember = "Key"; cmb_specice_specifics.DisplayMember = "Value"; cmb_specice_specifics.SelectedIndex = 0; //get Speciece Specifics dictionarySCatgerory = lookupServices.fetchLookupTables("species_category"); cmb_specice_category.DataSource = new BindingSource(dictionarySCatgerory, null); cmb_specice_category.ValueMember = "Key"; cmb_specice_category.DisplayMember = "Value"; cmb_specice_category.SelectedIndex = 0; //get Speciece Stage dictionaryStages = lookupServices.fetchLookupTables("species_stages"); cmb_specice_stage.DataSource = new BindingSource(dictionaryStages, null); cmb_specice_stage.ValueMember = "Key"; cmb_specice_stage.DisplayMember = "Value"; cmb_specice_stage.SelectedIndex = 0; //get Speciece Specifics dictionaryDCatgerory = lookupServices.fetchLookupTables("density_category"); cmb_density_category.DataSource = new BindingSource(dictionaryDCatgerory, null); cmb_density_category.ValueMember = "Key"; cmb_density_category.DisplayMember = "Value"; cmb_density_category.SelectedIndex = 0; }