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); }
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); }
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; }
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); }
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("Не найден путь к файлу"); }
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); }
public virtual void AddWorkTime(BaseEmployee baseEmployee, float workTime, DateTime workingDate, string comment) { Journal timeJournal = new Journal(); timeJournal.AddWorkTime(baseEmployee, workTime, workingDate, comment); }
public override List <TimeRecord> GetPersonalTimeRecords(BaseEmployee baseEmployee, DateTime firstDate, DateTime lastDate, Journal timeJournal) { return(base.GetPersonalTimeRecords(this, firstDate, lastDate, timeJournal)); }
public override void AddWorkTime(BaseEmployee baseEmployee, float workTime, DateTime workingDate, string comment) { base.AddWorkTime(this, workTime, workingDate, comment); }