public MainPage() { InitializeComponent(); timepicker tp = new timepicker(); tp.otend = OTenddateTimePicker; tp.otstart = OTstartdateTimePicker; tp.start = startdateTimePicker; tp.end = enddateTimePicker; tp.toiladded = toiladdeddateTimePicker; tp.toiltaked = toiltakeddateTimePicker; tp.isA = isAcheckBox; tp.isN = isNcheckBox; tp.isM = isMcheckBox; tp.isECO = isECOcheckBox; tp.isDrive = isDrivecheckBox; tp.otTimes = otTimelabel; tp.isSPday = isSPdaycheckBox; tp.isStandby = isStandbycheckBox; this.tp = tp; database = new LoadData(); LoginPage lp = new LoginPage(database); lp.ShowDialog(); if (lp.isclosed()) { this.Close(); } userId = lp.getUserId(); Calendar.Rows.Add(Calendar.Rows); Calendar.Rows.Add(Calendar.Rows); Calendar.Rows.Add(Calendar.Rows); Calendar.Rows.Add(Calendar.Rows); Calendar.Rows.Add(Calendar.Rows); Calendar.Rows.Add(Calendar.Rows); Calendar.Rows[0].Height = 40; Calendar.Rows[1].Height = 40; Calendar.Rows[2].Height = 40; Calendar.Rows[3].Height = 40; Calendar.Rows[4].Height = 40; Calendar.Rows[5].Height = 40; Calendar.Rows[0].Cells[0].Selected = false; foreach (DataGridViewColumn dgvc in Calendar.Columns) { dgvc.SortMode = DataGridViewColumnSortMode.NotSortable; } foreach (DataGridViewColumn dgvc in historyList.Columns) { dgvc.SortMode = DataGridViewColumnSortMode.NotSortable; } MonthcomboBox.SelectedItem = MonthcomboBox.Items[DateTime.Now.Month - 1]; this.MonthcomboBox.SelectedIndexChanged += new System.EventHandler(this.MonthcomboBox_SelectedIndexChanged); for (int i = 2000; i <= DateTime.Now.Year; i++) { yearcomboBox.Items.Add(i); } yearcomboBox.SelectedItem = DateTime.Now.Year; initiCalendar calendar = new initiCalendar(Calendar); calendar.createCalendar(DateTime.Now.Month, DateTime.Now.Year, userId.ToString()); HistoryList history = new HistoryList(userId, historyList); history.createHistory(); Admin admin = new Admin(namelistView); admin.createNameList(); this.admin = admin; this.calendar = calendar; this.tabControl1.Controls.Remove(this.tabPage2); this.tabControl1.Controls.Remove(this.tabPage3); this.tabControl1.Controls.Remove(this.Toilexport); }
private void MonthcomboBox_SelectedIndexChanged(object sender, EventArgs e) { calendar.createCalendar(monthToInt(MonthcomboBox.Text), DateTime.Now.Year, userId.ToString()); }