コード例 #1
0
ファイル: Reports.cs プロジェクト: RomanGanyushin/Profholod
        public void CreatePerformReport(DateTime From, DateTime To)
        {
            dateFrom           = From;
            dateTo             = To;
            PrettyPeriodString = new MDTime().MonthToString(dateFrom.Month) + " " + dateFrom.Year.ToString();
            Caption            = "Отчет по выполненным регламентным работам";

            content = new List <AnyMaintanace>();

            var performMaintenanceReports = db.PerformMaintenanceReports.Include(p => p.MaintenacesObject)
                                            .Where(p => p.IsConfirm == true).
                                            Where(c => c.DateTimeStart >= From).
                                            Where(c => c.DateTimeStart <= To);


            foreach (PerformMaintenanceReport maintenace in performMaintenanceReports.ToList())
            {
                content.Add(new AnyMaintanace()
                {
                    NativeID                 = maintenace.Id,
                    MaintanaceObject         = maintenace.MaintenacesObject.Description,
                    MaintanaceObjectNativeID = maintenace.MaintenacesObject.Id,
                    Object           = maintenace.MaintenacesObject.MachineObject.Name,
                    ObjectNativeID   = maintenace.MaintenacesObject.MachineObject.Id,
                    Action           = maintenace.MaintenacesObject.MaintenaceAction.Caption,
                    ActionNativeID   = maintenace.MaintenacesObject.MaintenaceAction.Id,
                    StartDateTime    = maintenace.DateTimeStart,
                    EndDateTime      = maintenace.DateTimeEnd,
                    ReportText       = maintenace.ReportText,
                    RecordAuthorText = ConvertUserToString(maintenace.CreateUserName)
                });
            }
        }
コード例 #2
0
ファイル: Reports.cs プロジェクト: RomanGanyushin/Profholod
        public void  CreatePerformReport(DateTime From, DateTime To)
        {
            dateFrom           = From;
            dateTo             = To;
            PrettyPeriodString = new MDTime().MonthToString(dateFrom.Month) + " " + dateFrom.Year.ToString();
            Caption            = "Общий отчет о проделанной работе";

            content = new List <AnyOperation>();

            var complitedRepairReports = db.ComplitedRepairReports.
                                         Where(c => c.DateTimeStart >= From).
                                         Where(c => c.DateTimeStart <= To).
                                         Include(c => c.MachineObject).
                                         Include(c => c.MaintenaceAction).
                                         Include(c => c.TypeOfFault);


            foreach (ComplitedRepairReport complite_repair in complitedRepairReports.ToList())
            {
                content.Add(new AnyOperation()
                {
                    OperationReportSource = "отчет о ремонтных работах",
                    NativeID         = complite_repair.Id,
                    Object           = complite_repair.MachineObject.Name,
                    ObjectNativeID   = complite_repair.MachineObject.Id,
                    Action           = complite_repair.MaintenaceAction.Caption,
                    ActionNativeID   = complite_repair.MaintenaceAction.Id,
                    StartDateTime    = complite_repair.DateTimeStart,
                    EndDateTime      = complite_repair.DateTimeEnd,
                    Reason           = complite_repair.TypeOfFault.Name,
                    ReasonNativeID   = complite_repair.TypeOfFault.Id,
                    ReportText       = complite_repair.ReportText,
                    RecordAuthorText = ConvertUserToString(complite_repair.CreateUserName)
                });
            }


            var performNoteRepairs = db.PerformNoteRepairs.
                                     Where(c => c.DateTimeStart >= From).
                                     Where(c => c.DateTimeStart <= To);

            foreach (PerformNoteRepair note_repair in performNoteRepairs.ToList())
            {
                content.Add(new AnyOperation()
                {
                    OperationReportSource = "записки о ремнонтных работах",
                    NativeID         = note_repair.Id,
                    Object           = note_repair.RepairObjectText,
                    ObjectNativeID   = -1,
                    Action           = note_repair.RepairActionText,
                    ActionNativeID   = -1,
                    StartDateTime    = note_repair.DateTimeStart,
                    EndDateTime      = note_repair.DateTimeEnd,
                    Reason           = note_repair.TypeOfFaultText,
                    ReasonNativeID   = -1,
                    ReportText       = note_repair.ReportText,
                    RecordAuthorText = ConvertUserToString(note_repair.CreateUserName)
                });
            }

            var performMaintenanceReports = db.PerformMaintenanceReports.Include(p => p.MaintenacesObject)
                                            .Where(p => p.IsConfirm == true).
                                            Where(c => c.DateTimeStart >= From).
                                            Where(c => c.DateTimeStart <= To);


            foreach (PerformMaintenanceReport maintenace in performMaintenanceReports.ToList())
            {
                content.Add(new AnyOperation()
                {
                    OperationReportSource = "отчет регламентых работ",
                    NativeID         = maintenace.Id,
                    Object           = maintenace.MaintenacesObject.MachineObject.Name,
                    ObjectNativeID   = maintenace.MaintenacesObject.MachineObject.Id,
                    Action           = maintenace.MaintenacesObject.MaintenaceAction.Caption,
                    ActionNativeID   = maintenace.MaintenacesObject.MaintenaceAction.Id,
                    StartDateTime    = maintenace.DateTimeStart,
                    EndDateTime      = maintenace.DateTimeEnd,
                    Reason           = "Регламентная работа",
                    ReasonNativeID   = -1,
                    ReportText       = maintenace.ReportText,
                    RecordAuthorText = ConvertUserToString(maintenace.CreateUserName)
                });
            }


            content.Sort(delegate(AnyOperation op1, AnyOperation op2)
                         { return(op1.StartDateTime.CompareTo(op2.StartDateTime)); });
        }