using esoft.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace esoft.Class
{
    /// <summary>
    /// Класс для заполнения коэффицентов
    /// </summary>
    public class CoefficientFill : Manager
    {
        public static CoefficientFill CoefficientFills(int managerId)
        {
            try
            {
                ActualContext actualContext = new ActualContext();
                var manager = esoftEntities.GetContext().Manager
                    .FirstOrDefault(m => m.ID == managerId);

                if (manager != null)
                {
                    return new CoefficientFill
                    {
                        ID = manager.ID,
                        JuniorMinimum = manager.JuniorMinimum,
                        MiddleMinimum = manager.MiddleMinimum,
                        SeniorMinimum = manager.SeniorMinimum,
                        AnalysisCoefficient = manager.AnalysisCoefficient,
                        InstallationCoefficient = manager.InstallationCoefficient,
                        SupportCoefficient = manager.SupportCoefficient,
                        TimeCoefficient = manager.TimeCoefficient,
                        DifficultyCoefficient = manager.DifficultyCoefficient,
                        ToMoneyCoefficient = manager.ToMoneyCoefficient,
                        // Добавьте остальные свойства, если необходимо
                    };
                }
            }
            catch
            {
                MessageBox.Show("Ошибка при заполнении коэффициентов",
                    "Ошибка",
                    MessageBoxButton.OK,
                    MessageBoxImage.Error);
            }

            return null;
        }
    }
}