public Statistics(int id) { emp_id = id; InitializeComponent(); controllerObj = new Controller(); YearComboBox.DisplayMember = "stat_year"; YearComboBox.ValueMember = "stat_year"; YearComboBox.DataSource = controllerObj.DisStatYears(); YearComboBox.Update(); if (!(controllerObj.checkSuperid(emp_id))) { EditButton7.Enabled = false; DeleteButton.Enabled = false; insert.Enabled = false; } DataTable dt = controllerObj.DisStatFMonths((int)YearComboBox.SelectedValue); FromComboBox.DisplayMember = "from_month"; FromComboBox.ValueMember = "from_month"; FromComboBox.DataSource = dt; FromComboBox.Update(); ToComboBox.DisplayMember = "till_month"; ToComboBox.ValueMember = "till_month"; ToComboBox.DataSource = controllerObj.DisStatTMonths((int)YearComboBox.SelectedValue); ToComboBox.Update(); }
private void YearComboBox_SelectedIndexChanged(object sender, EventArgs e) { DataTable dt = controllerObj.DisStatFMonths((int)YearComboBox.SelectedValue); FromComboBox.DisplayMember = "from_month"; FromComboBox.ValueMember = "from_month"; FromComboBox.DataSource = dt; FromComboBox.Update(); ToComboBox.DisplayMember = "till_month"; ToComboBox.ValueMember = "till_month"; ToComboBox.DataSource = controllerObj.DisStatTMonths((int)YearComboBox.SelectedValue); ToComboBox.Update(); }
private void DeleteButton_Click(object sender, EventArgs e) { if ((int)FromComboBox.SelectedValue >= (int)ToComboBox.SelectedValue) { MessageBox.Show("Please choose a valid date"); } else { controllerObj.DeleteStat((int)YearComboBox.SelectedValue, (int)FromComboBox.SelectedValue, (int)ToComboBox.SelectedValue); MessageBox.Show("Selected Statistic has been deleted successfully!"); YearComboBox.DataSource = controllerObj.DisStatYears(); YearComboBox.DisplayMember = "stat_year"; YearComboBox.ValueMember = "stat_year"; YearComboBox.Update(); FromComboBox.Update(); ToComboBox.Update(); } }
private void btnSelectFromComboBox_Click(object sender, EventArgs e) { FromComboBox?.Invoke(this, new WinFormsTestControlEventArgs(cbContent.SelectedItem as string)); }
set => SetComboBoxValue(FromComboBox, value);