예제 #1
0
        public virtual List <TimeRecord> GetPersonalTimeRecords(BaseEmployee baseEmployee, DateTime firstDate, DateTime lastDate, Journal timeJournal)
        {
            List <TimeRecord> Journal = timeJournal.TimeJournal.Where(q => q.WorkingDate >= firstDate &&
                                                                      q.WorkingDate <= lastDate &&
                                                                      q.FirstName == baseEmployee.FirstName &&
                                                                      q.LastName == baseEmployee.LastName).OrderBy(q => q.WorkingDate).ToList();

            return(Journal);
        }
예제 #2
0
        public virtual decimal GetSalary(BaseEmployee baseEmployee, DateTime firstDate, DateTime lastDate, Journal timeJournal)
        {
            List <TimeRecord> ListRecordForSalary = GetPersonalTimeRecords(baseEmployee, firstDate, lastDate, timeJournal);

            decimal Salary = 0;

            foreach (TimeRecord Record in ListRecordForSalary)
            {
                Salary = Salary + (decimal)Record.Time * baseEmployee.Salary;
            }

            return(Salary);
        }
예제 #3
0
        public override void AddWorkTime(BaseEmployee baseEmployee, float workTime, DateTime workingDate, string comment)
        {
            var checkDate = (DateTime.Today - workingDate).Days;

            if (checkDate > 2)
            {
                throw new Exception("Поздно!");
            }

            base.AddWorkTime(this, workTime, workingDate, comment);

            return;
        }
예제 #4
0
        public void AddWorkTime(BaseEmployee baseEmployee, float workTime, DateTime workingDate, string comment)
        {
            TimeRecord timeRecord = new TimeRecord
            {
                FirstName    = baseEmployee.FirstName,
                LastName     = baseEmployee.LastName,
                Time         = workTime,
                WorkingDate  = workingDate,
                DateOfRecord = DateTime.Today,
                Comment      = comment
            };

            SaveToFile saveTime = new SaveFile.SaveToFile();

            saveTime.Save(GetPath(baseEmployee), timeRecord);
        }
예제 #5
0
        private string GetPath(BaseEmployee baseEmployee)
        {
            if (baseEmployee is Employee)
            {
                return(Settings1.Default.PathToEmployeeJournal);
            }
            if (baseEmployee is Head)
            {
                return(Settings1.Default.PathToHeadJournal);
            }
            if (baseEmployee is Freelancer)
            {
                return(Settings1.Default.PathToFreelancerJournal);
            }

            throw new Exception("Не найден путь к файлу");
        }
예제 #6
0
        public void CreateEmployee(string firstName, string lastName, EmployeeType employeeType)
        {
            BaseEmployee employee = null;

            SaveToFile saveToFile = new SaveToFile();

            switch (employeeType)
            {
            case EmployeeType.Employee:
                employee = new Employee(firstName, lastName);
                break;

            case EmployeeType.Head:
                employee = new Head(firstName, lastName);
                break;

            case EmployeeType.Freelanser:
                employee = new Freelancer(firstName, lastName);
                break;

            default: throw new Exception("Ошибка!");
            }
            saveToFile.Save(Settings1.Default.PathToAllEmployees, employee);
        }
예제 #7
0
        public virtual void AddWorkTime(BaseEmployee baseEmployee, float workTime, DateTime workingDate, string comment)
        {
            Journal timeJournal = new Journal();

            timeJournal.AddWorkTime(baseEmployee, workTime, workingDate, comment);
        }
예제 #8
0
 public override List <TimeRecord> GetPersonalTimeRecords(BaseEmployee baseEmployee, DateTime firstDate, DateTime lastDate, Journal timeJournal)
 {
     return(base.GetPersonalTimeRecords(this, firstDate, lastDate, timeJournal));
 }
예제 #9
0
 public override void AddWorkTime(BaseEmployee baseEmployee, float workTime, DateTime workingDate, string comment)
 {
     base.AddWorkTime(this, workTime, workingDate, comment);
 }