コード例 #1
0
        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();
        }
コード例 #2
0
        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();
            }
        }