public void CreateDraftedIncident()
 {
     _incidentReport = new Incident_Report();
     _reportVersion = new Incident_Report_Version();
     _incidentReport.IsDraft = true;
     _reportVersion.Version = 0;
 }
 public void CreateNewIncident()
 {
     _incidentReport = new Incident_Report();
     _incidentReport.IsDraft = false;    // Make sure it's not marked as draft any more.
     _reportVersion = new Incident_Report_Version();
     _reportVersion.Version = 1;
 }
        public void CreateNewIncident(int incidentID)
        {
            _incidentReport = APF.Searcher.Find_Incident_Report(incidentID);
            _incidentReport.IsDraft = false;    // Make sure it's not marked as draft any more.
            IIncident_Report_Version _oldVersion = GetIncidentVersion(_incidentReport);
            _reportVersion = new Incident_Report_Version();
            _reportVersion.Version = 1;
            if (_oldVersion.InjuredParty != null)
            {
                _reportVersion.InjuredParty = _oldVersion.InjuredParty;
            }

            // This assignment is now in the Incident_Handler. In the SetTMPassenger()
            //if (_oldVersion.TMPassenger != null)
            //{
            //    _reportVersion.TMPassenger = _oldVersion.TMPassenger;
            //}
        }
        public void CreateNewIncidentReportVersion(int incidentID)
        {
            _incidentReport = APF.Searcher.Find_Incident_Report(incidentID);

            _reportVersion = new Incident_Report_Version();

            //IIncident_Report_Version _oldVersion = GetIncidentVersion(_incidentReport);
            IIncident_Report_Version _oldVersion = _incidentReport.GetLatestVersion();
            _reportVersion.Version = _oldVersion.Version + 1;
            if (_oldVersion.InjuredParty != null)
            {
                _reportVersion.InjuredParty = _oldVersion.InjuredParty;
            }

            // This assignment is now in the Incident_Handler. In the SetTMPassenger()
            //if (_oldVersion.TMPassenger != null)
            //{
            //    _reportVersion.TMPassenger = _oldVersion.TMPassenger;
            //}
        }
        public void Test(String user_id)
        {
            ////Here is some sample code
                //IUser i_user = APF.Searcher.Find_User(user_id);

                //IPerson person = APF.Searcher.Find_Person(1);
                //person.First_Name = "Fred";
                //APF.Persist(person);

                //ICertificate certificate = APF.Searcher.Find_Certificate(1);
                //certificate.Code = "E";
                //APF.Persist(certificate);

                //person.Certificate = certificate;
                //APF.Persist(person);

                //Console.WriteLine();

            //Here is some sample code
            //IUser i_user = APF.Searcher.Find_User(user_id);

            //IPerson person = new Person();
            //person.First_Name = "Mia";
            //person.Last_Name = "Fey";
            //person.Age = 33;
            //person.Australian_Parachute_Foundation = (Australian_Parachute_Federation)APF;
            //person.Gender = (Gender)APF.Searcher.Find_Gender(2);
            //APF.Persist(person);
            ////IPerson person = APF.Searcher.Find_Person(3);

            //ICertificate certificate = APF.Searcher.Find_Certificate(3);
            //ICertificate_Holder certificate_holder = new Certificate_Holder();
            //certificate_holder.Person = (Person)person;
            //certificate_holder.Certificate = (Certificate)certificate;
            //certificate_holder.Jumps_Last_Month = 13;
            //certificate_holder.Jumps_Last_Six_Months = 34;
            //APF.Persist(certificate_holder);

            ////person.Certificate = certificate;
            ////APF.Persist(person);

            //Console.WriteLine();

            //IIncident_Report report = new Incident_Report();
            //report.Drop_Zone = APF.Searcher.Find_Drop_Zone(1);
            //String dateTimeText = "14/12/2010";
            //report.Incident_Date = DateTime.ParseExact(dateTimeText, "dd/MM/yyyy",
            //    CultureInfo.InvariantCulture);
            //report.Closed = false;
            //report.IsDraft = false;
            //APF.Persist(report);

            IIncident_Report report = APF.Searcher.Find_Incident_Report(1);
            String dateTimeText = "17/12/2010";
            report.Incident_Date = DateTime.ParseExact(dateTimeText, "dd/MM/yyyy",
                CultureInfo.InvariantCulture);
            APF.Persist(report);

            IIncident_Report_Version version = new Incident_Report_Version();
            Edit_Incident_Handler mih = new Edit_Incident_Handler();
            IIncident_Report_Version old = mih.GetIncidentVersion(report);
            version.Incident_Report = report;

            version.Reporter = old.Reporter;
            version.aspnet_Roles = (Role) APF.Searcher.Find_Role("70CAAFBC-B595-4D98-85CF-FCDC913FDB9D");
            version.Version = old.Version + 1;
            version.Container = (Container) APF.Searcher.Find_Container(2);
            version.Handycam = false;
            version.Incident_Summary = "blah";

            version.InjuredParty = old.InjuredParty;

            version.Jump_Type = (Jump_Type) APF.Searcher.Find_Jump_Type(2);
            version.Main_Canopy_ID = 1;
            version.Main_Canopy_Size = 200;
            version.Recurrence_Prevention = "blah";
            //version.Suspected_Injury_ID = 1;
            //version.TMPassenger = null;
            version.Weather = (Weather) APF.Searcher.Find_Weather(2);
            //version.Wind_Speed = "3";
            version.Wind_Direction = "North";
            APF.Persist(version);

            IPerson InjuredParty = old.InjuredParty;
            InjuredParty.First_Name = "Nick";
            APF.Persist(InjuredParty);
            version.InjuredParty = InjuredParty;
            APF.Persist(version);
        }