private void btnCalc_Click(object sender, EventArgs e) { if (rdbPartTime.Checked is false && rdbFulltime.Checked is false) { MessageBox.Show("You must choose the job's frequency."); return; } txtDailyW.Text = WorkActions.CalculateDay(workDays, rdbPartTime, dtpWork.Value).ToString(); txtMonthW.Text = WorkActions.CalculateMonth(workDays, rdbPartTime, dtpWork.Value.Month, dtpWork.Value.Year).ToString(); txtYearW.Text = WorkActions.CalculateYear(workDays, rdbPartTime, dtpWork.Value.Year).ToString(); }
private void dtpWork_Leave(object sender, EventArgs e) { try { if (lsbData.Items.Count == 0) { throw new Exception("No data."); } txtDailyW.Text = WorkActions.CalculateDay(workDays, rdbPartTime, dtpWork.Value).ToString(); txtMonthW.Text = WorkActions.CalculateMonth(workDays, rdbPartTime, dtpWork.Value.Month, dtpWork.Value.Year).ToString(); txtYearW.Text = WorkActions.CalculateYear(workDays, rdbPartTime, dtpWork.Value.Year).ToString(); } catch (Exception) { txtDailyW.Text = string.Empty; } }
private void btnDEL_Click(object sender, EventArgs e) { if (workDays.Capacity == 0) { MessageBox.Show("No days to delete."); return; } foreach (var day in workDays) { if (day.DateAndTime == dtpWork.Value) { lsbData.Items.Remove(day); workDays.Remove(day); txtDailyW.Text = WorkActions.CalculateDay(workDays, rdbPartTime, dtpWork.Value).ToString(); txtMonthW.Text = WorkActions.CalculateMonth(workDays, rdbPartTime, dtpWork.Value.Month, dtpWork.Value.Year).ToString(); MessageBox.Show(@"Success!"); return; } } MessageBox.Show(@"Failure. Day doesn't exist on the list."); }