public FW_File(File file)
        {
            InitializeComponent();

            this.Loaded += new RoutedEventHandler(EV_Start);

            this.file     = file;
            db            = new AgileManagerDB();
            reports       = db.Reports.Where(r => r.FileID == file.FileID).Include(r => r.employee).ToList();
            interventions = db.Interventions.Where(r => r.FileID == file.FileID).Include(i => i.employee).ToList();
            FrameWorkDB.V1.Application app = db.Applications.First(a => a.ApplicationID == file.license.ApplicationID);

            TX_License1.Text = app.Name;
            TX_License2.Text = $"Versión {app.Version}";
            TX_License4.Text = $"Fin mantenimiento {String.Format("{0:dd/MM/yyyy}", file.license.DateEnd)}";

            if (file.employee != null)
            {
                TB_Employee.Text = $"{file.employee.Code} - {file.employee.Name}";
            }

            TB_State.Text     = $"{file.state.Name}";
            TB_DateStart.Text = $"{String.Format("{0:dd/MM/yyyy}", file.DateStart)}";
            TB_DateEnd.Text   = $"{String.Format("{0:dd/MM/yyyy}", file.DateEnd)}";
            TB_Issue.Text     = $"{file.issue.Name}";
            TB_Priority.Text  = $"{file.priority.Name}";
        }
예제 #2
0
        public void UpdateTable()
        {
            switch (mode)
            {
            case 1:
                files = db.Files.Where(f => f.StateID == 1 && (f.license.application.DepartmentID == ((MainWindow)System.Windows.Application.Current.MainWindow).employee.DepartmentID || f.EmployeeID == ((MainWindow)System.Windows.Application.Current.MainWindow).employee.EmployeeID || f.EmployeeID == null)).Include(f => f.client).Include(f => f.priority).Include(f => f.issue).Include(f => f.license.application).ToList();
                break;

            case 3:
                files = db.Files.Where(f => (f.StateID == 3 && (f.license.application.DepartmentID == ((MainWindow)System.Windows.Application.Current.MainWindow).employee.DepartmentID || f.EmployeeID == ((MainWindow)System.Windows.Application.Current.MainWindow).employee.EmployeeID)))
                        .Include(f => f.client).Include(f => f.priority).Include(f => f.issue).ToList();
                break;

            case 5:
                files = db.Files.Where(f => (f.StateID == 5 && (f.license.application.DepartmentID == ((MainWindow)System.Windows.Application.Current.MainWindow).employee.DepartmentID || f.EmployeeID == ((MainWindow)System.Windows.Application.Current.MainWindow).employee.EmployeeID)))
                        .Include(f => f.client).Include(f => f.priority).Include(f => f.issue).ToList();
                break;

            case 11:
                files = db.Files.Where(f => (f.ClientID == client.ClientID))
                        .Include(f => f.client).Include(f => f.priority).Include(f => f.issue)
                        .Include(f => f.license).Include(f => f.employee).Include(f => f.state).ToList();
                break;

            default:
                files = db.Files.Include(f => f.client).ToList();
                break;
            }


            dt.Clear();
            foreach (File item in files)
            {
                switch (mode)
                {
                case 1:
                    dt.Rows.Add(item.FileID, item.Code, $"{item.client.Code} {item.client.Name} ({item.license.application.Name})",
                                $"{String.Format("{0:dd/MM/yyyy}", item.DateStart)}", item.priority.Name, item.issue.Name);
                    break;

                case 3:
                    dt.Rows.Add(item.FileID, item.Code, $"{item.client.Code} {item.client.Name}",
                                $"{String.Format("{0:dd/MM/yyyy}", item.DateStart)}", item.priority.Name, item.issue.Name);
                    break;

                case 5:
                    dt.Rows.Add(item.FileID, item.Code, $"{item.client.Code} {item.client.Name}",
                                $"{String.Format("{0:dd/MM/yyyy}", item.DateStart)}", $"{String.Format("{0:dd/MM/yyyy}", item.DateEnd)}", item.priority.Name, item.issue.Name);
                    break;

                case 11:
                    FrameWorkDB.V1.Application app = db.Applications.First(a => a.ApplicationID == item.license.ApplicationID);
                    if (item.employee != null)
                    {
                        dt.Rows.Add(item.FileID, item.Code, $"{item.license.Code} {app.Name} {app.Version}", $"{item.employee.Code} {item.employee.Name}",
                                    $"{String.Format("{0:dd/MM/yyyy}", item.DateStart)}", $"{String.Format("{0:dd/MM/yyyy}", item.DateEnd)}",
                                    item.state.Name, item.priority.Name, item.issue.Name);
                    }
                    else
                    {
                        dt.Rows.Add(item.FileID, item.Code, $"{item.license.Code} {app.Name} {app.Version}", $"",
                                    $"{String.Format("{0:dd/MM/yyyy}", item.DateStart)}", $"{String.Format("{0:dd/MM/yyyy}", item.DateEnd)}", item.priority.Name, item.issue.Name);
                    }
                    break;

                default:
                    dt.Rows.Add(item.FileID, item.Code, $"{item.client.Code} {item.client.Name}",
                                $"{String.Format("{0:dd/MM/yyyy}", item.DateStart)}", item.priority.Name, item.issue.Name);
                    break;
                }
            }
        }