Example #1
0
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            string businessName = textName.Text;

            businessName = business.CheckEmploymentFormat(businessName);

            if (businessName == "")
            {
                MessageBox.Show("Будьте так любезны, введите название", "Телепатия временно недоступна");
            }
            else
            {
                if (AddSchedule.Schedule == null)
                {
                    business.WriteEmploymentToFile($"{businessName}!{business.GetLastCode}!N!{DateTime.Now.ToShortDateString()}");
                }
                else
                {
                    business.WriteEmploymentToFile($"{businessName}!{business.GetLastCode}!{AddSchedule.Schedule}!{DateTime.Now.ToShortDateString()}");
                }
            }
            BtnCancel_Click(null, null);
        }
Example #2
0
        private void CheckIsGoalDone()
        {
            string goalStatus;

            achiveOneHourToGoal.CheckCondition();

            if ((employments.HoursGoal <= employments.HoursDone || employments.DateGoal < DateTime.Now) && employments.HoursGoal != 0)
            {
                achiveCompleteGoal.CheckCondition();
                goalStatus = employments.DateGoal.Day < DateTime.Now.Day ? "просрочена" : "достигнута";

                var result = MessageBox.Show($"Ваша цель \"{employments.Name}\" {goalStatus}" +
                                             $"\nСделать из нее постоянную цель?", $"Цель {goalStatus}!", MessageBoxButtons.YesNo);

                if (result == DialogResult.Yes)
                {
                    employments.WriteEmploymentToFile($"{employments.Name} (постоянный)!{employments.GetLastCode}!0!{DateTime.Now.ToShortDateString()}");
                }

                employments.DeleteEmpFromFile(employments.Name);
                FillGrid();
            }
        }