public IncidentReport(IncidentReport ir)
 {
     DropZoneName = ir.DropZoneName;
     DropZoneStaffID = ir.DropZoneStaffID;
     IncidentStatus = ir.IncidentStatus;
     IncidentSummary = ir.IncidentSummary;
     IncidentReportCollection = ir.IncidentReportCollection;
     VersionNumber = ir.VersionNumber + 1;
     this.Weather = ir.Weather;
     this.WeatherID = ir.WeatherID;
     CurrentReport = this;
 }
        public IncidentReport CreateNewIncidentReport()
        {
            // Version: 20100508_2112_gino
            // Time: 9.27pm

            IncidentReport _parentReport = new IncidentReport();
            _parentReport.DropZoneStaff = this;
            _parentReport.IncidentStatus = "Pending";
            _parentReport.IncidentSummary = "First Version logged for the Incident Report";
            _parentReport.DropZoneName = DropZoneName;
                //_parentReport.VersionNumber = 1;

            // ...

            return _parentReport;
        }
Beispiel #3
0
 public void CreateNewVersion(IncidentReport parent, IncidentReport newReport)
 {
     this.ParentIRID = parent.IncidentReportID;
     this.VersionIRID = newReport.IncidentReportID;
     this.VersionNumber = newReport.VersionNumber;
 }
 public void ChooseReport(int index)
 {
     _selectedReport = _incidentReportObjectSet[index];
     Console.WriteLine("Chosen Report/Parent Report:\n\t" + _selectedReport.IncidentReportID + "." + _selectedReport.VersionNumber);
 }
        public void SelectIncidentReport()
        {
            // Show the list of already logged Incident Reports.

            Console.WriteLine("--------------");

            Console.WriteLine("List of logged Incident Reports");

            Console.WriteLine("--");

            foreach (IncidentReport loggedIR in _incidentReportObjectSet)
            {

            Console.WriteLine("Incident Report ID: " + loggedIR.IncidentReportID + "\n" +

                "Reporter: " + loggedIR.DropZoneStaff.FirstName + " " + loggedIR.DropZoneStaff.LastName + "\n" +

                "Incident Status: " + loggedIR.IncidentStatus + "\n" +

                "Version Number: " + loggedIR.VersionNumber);

            Console.WriteLine("--------------");

            }

            // Make the user select which one to later modify

            Console.WriteLine("Select which Incident Report you require by typing its Incident Report ID:");

            int sIRInt = int.Parse(Console.ReadLine()); // Selected Index of IR

            sIRInt--;   // For arraylistindex is lower than ID

            // May 6, 2010 - Gino
            // IncidentReport sIR = _incidentReportObjectSet[sIRInt]; // Selected Incident Report

            _selectedReport = _incidentReportObjectSet[sIRInt]; // Selected Incident Report

            Console.WriteLine("The full details of the Incident Report you have selected....:");

            Console.WriteLine("Incident Report ID: " + _selectedReport.IncidentReportID + "\n" +

                "Reporter: " + _selectedReport.DropZoneStaff.FirstName + " " + _selectedReport.DropZoneStaff.LastName + "\n" +

                "Incident Status: " + _selectedReport.IncidentStatus + "\n" +

                "Version Number: " + _selectedReport.VersionNumber + "\n" +

                "Incident Summary: " + _selectedReport.IncidentSummary + "\n" +

                "Weather: " + _selectedReport.Weather.WeatherType + "\n" +

                "Drop Zone:" + _selectedReport.DropZoneName

                );

            // Ask user if they want to modify the selected Incident Report

            Console.WriteLine("Do you want to modify this report?" + "\t" + "Y/N");

            string yesno1 = Console.ReadLine().ToUpper();

            if ("Y" == yesno1)
            {

            if (_selectedReport.VersionNumber > 1)
            {

                Console.WriteLine("There are many versions of this report. " +

                    "Do you want to modify the latest version of this report?" + "\t" + "Y/N");

                string yesno2 = Console.ReadLine().ToUpper();

                if ("N" == yesno2)
                {

                    Console.WriteLine("Sorry. You cannot modify an earlier version of this report.");

                    Console.WriteLine("Shutting down....");

                }

                else if ("Y" != yesno2 & "N" != yesno2)
                {

                    Console.WriteLine("You didn't type in Y or N.");

                    Console.WriteLine("Shutting down....");

                }

            }

            //

            // Pass sIR to the ModifyIncidentReport() in IncidentReport.cs

            //

            }

            else if ("Y" != yesno1 & "N" != yesno1)
            {

            Console.WriteLine("You didn't type in Y or N.");

            Console.WriteLine("Shutting down....");

            }

            else
            {

            Console.WriteLine("Shutting down....");

            }
        }
 public void DraftIncidentReport(IncidentReport ir)
 {
     //ir.DraftIncidentReport(this._ir);
 }
 public void CreateNewIncidentReport( )
 {
     _newReport = _reporter.CreateNewIncidentReport();
 }
 public void ProcessIncidentReport( IncidentReport ir )
 {
 }
Beispiel #9
0
 public void LogIncidentReport( IncidentReport ir )
 {
 }
        private IncidentReport CreateNewReport(IncidentReport parent)
        {
            IncidentReport _newReport = new IncidentReport();
            _newReport.DropZoneName = parent.DropZoneName;
            _newReport.Weather = this.Weather;
            _newReport.IncidentSummary = "create based on parent report";
            _newReport.VersionNumber = ++VersionNumber;
            _newReport.IncidentStatus = "Version " + parent.IncidentReportID + "." + VersionNumber;
            _newReport.DropZoneStaff = parent.DropZoneStaff;

            return _newReport;
        }
        public void ModifyReport(IncidentReport parent, ObjectContext context)
        {
            // cant really modify a report that is not the latest version...
            // still trying to figure out a way to get the parent report for this situation...
            IncidentReport _newModifiedIR = CreateNewReport(parent);
            context.PersistChanges(_newModifiedIR);

            Version _newVersion = CreateNewVersion(parent, _newModifiedIR, context);
            //Version vp = GetParentReportVersion(_newVersion, context);  // there is still a bug
            //Version vv = GetLatestReportVersion(_newVersion, context);  // its when a report is selected to be modified and the correct parent id and version id has to be used
            context.PersistChanges(_newVersion);

            _newModifiedIR.VersionNumber = _newVersion.VersionNumber;
            context.PersistChanges(_newModifiedIR);
            Console.WriteLine("Modified successfully!");
        }
        // Version: 20100508_2112_gino
        // Time: 9.32pm
        public void LogIncidentReport(IncidentReport parent, ObjectContext context)
        {
            //the new report has to log itself and should pass its parent report as an argument

            IncidentReport _newReport = CreateNewReport(parent);
            context.PersistChanges(_newReport);
            Version _newVersion = CreateNewVersion(_newReport, _newReport);
            context.PersistChanges(_newVersion);
            Console.WriteLine("Logged successfully!");
        }
 public Version CreateNewVersion(IncidentReport parent, IncidentReport newReport, ObjectContext context)
 {
     Version fv = GetLatestVersion(parent.IncidentReportID, context);
     //Version lv = GetLatestReportVersion(fv, context);
     Version _newVersion = new Version(fv.ParentIRID, newReport.IncidentReportID, fv.VersionNumber);
     return _newVersion;
 }
 public Version CreateNewVersion(IncidentReport parent, IncidentReport newReport)
 {
     Version _newVersion = new Version(parent, newReport);
     return _newVersion;
 }