private void saveStatusbutton_Click(object sender, EventArgs e) { DutyStatus status = new DutyStatus(selcetCellcommentId); status.saveStatus(tp, userId, oldbalance); saveStatusbutton.Enabled = false; Calendar.Enabled = true; modifybutton.Enabled = true; startdateTimePicker.Enabled = false; enddateTimePicker.Enabled = false; OTenddateTimePicker.Enabled = false; OTstartdateTimePicker.Enabled = false; toiladdeddateTimePicker.Enabled = false; toiltakeddateTimePicker.Enabled = false; isAcheckBox.Enabled = false; isNcheckBox.Enabled = false; isMcheckBox.Enabled = false; isECOcheckBox.Enabled = false; isDrivecheckBox.Enabled = false; isSPdaycheckBox.Enabled = false; isStandbycheckBox.Enabled = false; }
private void Calendar_SelectionChanged(object sender, EventArgs e) { /*check the selcet status, siganl of muilti?*/ if (Calendar.SelectedCells.Count == 1) { duplicateThisDayToolStripMenuItem.Enabled = true; selcetCellcommentId = Convert.ToInt32(Calendar.SelectedCells[0].Tag); isNcheckBox.CheckedChanged -= new System.EventHandler(this.isNcheckBox_CheckedChanged); isMcheckBox.CheckedChanged -= new System.EventHandler(this.isMcheckBox_CheckedChanged); isAcheckBox.CheckedChanged -= new System.EventHandler(this.isAcheckBox_CheckedChanged); if (!(Calendar.SelectedCells[0].Tag == null)) { DutyStatus status = new DutyStatus(selcetCellcommentId); status.updatestatus(tp, Convert.ToDateTime(calendar.getDateByCaleandar(Calendar.SelectedCells[0].RowIndex, Calendar.SelectedCells[0].ColumnIndex))); modifybutton.Enabled = true; notificationlabel.Text = database.getTable("select * from comment where commentId = " + Calendar.SelectedCells[0].Tag, "comment").Rows[0]["daystatus"].ToString(); } else { DutyStatus status = new DutyStatus(); status.setByDefult(tp, Convert.ToDateTime(calendar.getDateByCaleandar(Calendar.SelectedCells[0].RowIndex, Calendar.SelectedCells[0].ColumnIndex))); modifybutton.Enabled = false; notificationlabel.Text = "No data"; } isNcheckBox.CheckedChanged += new System.EventHandler(this.isNcheckBox_CheckedChanged); isMcheckBox.CheckedChanged += new System.EventHandler(this.isMcheckBox_CheckedChanged); isAcheckBox.CheckedChanged += new System.EventHandler(this.isAcheckBox_CheckedChanged); otTimelabel.Text = (OTenddateTimePicker.Value - OTstartdateTimePicker.Value).Hours.ToString() + "." + (((OTenddateTimePicker.Value - OTstartdateTimePicker.Value).Minutes) * 10 / 60).ToString(); } if (Calendar.SelectedCells.Count > 1) { duplicateThisDayToolStripMenuItem.Enabled = false; } selectcells = Calendar.SelectedCells; }