private void cB_To_SelectionChangeCommitted(object sender, EventArgs e) { int from = Convert.ToInt32(cB_From.SelectedValue), to = Convert.ToInt32(cB_To.SelectedValue); if (from > to) { cB_From.SelectedIndex = 0; cB_To.SelectedIndex = 0; from = Convert.ToInt32(cB_From.SelectedValue); to = Convert.ToInt32(cB_To.SelectedValue); } DA_Uplate.getUplate_by_Year_statistika(dt_Uplate, from, to); this.rV_Uplate_matrix.RefreshReport(); this.rV_Uplate_Chart.RefreshReport(); }
private void frm_Uplate_Load(object sender, EventArgs e) { DA_Uplate.getUplate(ds_uplate.view_Uplate); dataGridView.AutoGenerateColumns = false; dataGridView.DataSource = ds_uplate.view_Uplate; using (DS_PretragaKandidata ds_Kurs = new DS_PretragaKandidata()) //Punjenje comboboxa { DA_Training.getTrainingType(ds_Kurs.TrainingType); DS_PretragaKandidata.TrainingTypeRow TTRow = ds_Kurs.TrainingType.NewTrainingTypeRow(); TTRow.Name = "Izaberi kurs"; TTRow.TrainingTypeID = 0; ds_Kurs.TrainingType.Rows.InsertAt(TTRow, 0); cB_Kursevi.ValueMember = "TrainingTypeID"; cB_Kursevi.DisplayMember = "Name"; cB_Kursevi.DataSource = ds_Kurs.TrainingType; } }
private void btn_search_Click(object sender, EventArgs e) { if (cB_Kursevi.SelectedIndex < 1) { if (txt_fName.TextLength > 0 || txt_lName.TextLength > 0 || (dTP_From.Value != new DateTime(2000, 1, 1) || dTP_To.Value != DateTime.Today)) { DA_Uplate.getUplate_by_NameAndDate(ds_uplate.view_Uplate, txt_fName.Text, txt_lName.Text, dTP_From.Value, dTP_To.Value); dataGridView.DataSource = ds_uplate.view_Uplate; } else { DA_Uplate.getUplate(ds_uplate.view_Uplate); dataGridView.DataSource = ds_uplate.view_Uplate; } } else { DA_Uplate.getUplate_by_NameAndDateAndTrainingType(ds_uplate.view_Uplate, txt_fName.Text, txt_lName.Text, dTP_From.Value, dTP_To.Value, (int)cB_Kursevi.SelectedValue); dataGridView.DataSource = ds_uplate.view_Uplate; } }
private void frm_StatistikaPoslovanja_Load(object sender, EventArgs e) { DA_Uplate.getUplate_by_Year_statistika(dt_Uplate, 2000, DateTime.Today.Year); dt_izvorniPodaci = dt_Uplate.DefaultView.ToTable(); //tabela za filtriranje(jednom dobavljamo podatke iz baze) //YEAR TAB statistika_Uplate_MatrixDataTableBindingSource.DataSource = dt_Uplate; ReportDataSource rds = new ReportDataSource("DS_statistika_Uplate", statistika_Uplate_MatrixDataTableBindingSource); rV_Uplate_matrix.LocalReport.DataSources.Add(rds); rV_Uplate_Chart.LocalReport.DataSources.Add(rds); this.rV_Uplate_matrix.RefreshReport(); this.rV_Uplate_Chart.RefreshReport(); DataTable dt = dt_Uplate.DefaultView.ToTable(true, "Year"); // Distinct values; cB_From.DataSource = dt; cB_From.DisplayMember = "Year"; cB_From.ValueMember = "Year"; DataView dv = new DataView(dt); // Pravim DataView da bih mogao sortirati tabelu dv.Sort = "Year DESC"; // Sortiranje cB_To.DataSource = dv.ToTable(); cB_To.DisplayMember = "Year"; cB_To.ValueMember = "Year"; //MONTH TAB cb_monthYears.DataSource = dv.ToTable(); cb_monthYears.DisplayMember = "Year"; cb_monthYears.ValueMember = "Year"; yearMonthTab = Convert.ToInt32(cb_monthYears.SelectedValue).ToString(); ReportDataSource rdsMonth = new ReportDataSource("DS_UplateMonths", DS_UplateMonth_BS); rv_MonthTab.LocalReport.DataSources.Add(rdsMonth); rv_MonthTab.LocalReport.SetParameters(new ReportParameter("SingleYear", yearMonthTab)); cb_monthYears_SelectionChangeCommitted(null, null); //DAY TAB cB_Year_DayTab.DataSource = dv; cB_Year_DayTab.DisplayMember = "Year"; cB_Year_DayTab.ValueMember = "Year"; DataTable dtDay = dt_Uplate.DefaultView.ToTable(true, "Month"); DataView dvDay = new DataView(dtDay); dvDay.Sort = "Month ASC"; cB_Month_DayTab.DataSource = dvDay; cB_Month_DayTab.DisplayMember = "Month"; cB_Month_DayTab.ValueMember = "Month"; ReportDataSource rdsDay = new ReportDataSource("DS_Uplate_Day", DS_UplateBindingSource); rV_DayTab.LocalReport.DataSources.Add(rdsDay); yearDayTab = Convert.ToString(cB_Year_DayTab.SelectedValue); monthDayTab = Convert.ToString(cB_Month_DayTab.SelectedValue); rV_DayTab.LocalReport.SetParameters(new ReportParameter("SingleMonth", monthDayTab)); rV_DayTab.LocalReport.SetParameters(new ReportParameter("SingleYear", yearDayTab)); cB_Year_DayTab_SelectionChangeCommitted(null, null); }