Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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;
            }
        }
Exemplo n.º 3
0
        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.");
        }