Example #1
0
        private void savedrafts_btn_Clicked(object sender, EventArgs e)
        {
            _StationInformation.ReportType  = "Station Information" + _StationInformation.Id.ToString();
            _StationInformation.DateOfEvent = DateTime.Now;
            _StationInformation.Created     = DateTime.Now;
            _StationInformation.Attachments = _attachementView.GetAttachmentInfoAsString();

            _StationInformation = App.DAUtil.SaveOrUpdate(_StationInformation);

            DependencyService.Get <IMessage>().ShortAlert("Item drafted");
        }
        private void savedrafts_btn_Clicked(object sender, EventArgs e)
        {
            _flightcrew.ReportType  = string.IsNullOrEmpty(_flightcrew.ReportType) ? "Flight Crew" + _flightcrew.Id.ToString() : _flightcrew.ReportType;
            _flightcrew.DateOfEvent = DateTime.Now;
            if (!ValidatePeoplePickers())
            {
                return;
            }
            _flightcrew.Created     = DateTime.Now;
            _flightcrew.Attachments = _attachementView.GetAttachmentInfoAsString();

            _flightcrew = App.DAUtil.SaveOrUpdate(_flightcrew);
            DependencyService.Get <IMessage>().ShortAlert("Item drafted");
        }
        private void savedrafts_btn_Clicked(object sender, EventArgs e)
        {
            try
            {
                switch (_classname)
                {
                case "safety":
                    idval = new Random().Next(1, 1000);
                    FlightSafetyReportModel sf = (FlightSafetyReportModel)_viewobject;
                    sf.IsExtendedView = Formcheck.IsToggled;
                    sf.ReportType     = "Safety" + idval.ToString();
                    sf.MOR            = Convert.ToString(MORpicker.SelectedIndex);
                    sf.Created        = DateTime.Now;

                    if (FlightSafetyReportView.PeoplePickerCommander != null)
                    {
                        sf.CommandersEmail = FlightSafetyReportView.PeoplePickerCommander.Id.ToString();
                    }

                    if (FlightSafetyReportView.PeoplePickercrew1email != null)
                    {
                        sf.FlightCrew1 = FlightSafetyReportView.PeoplePickercrew1email.Id.ToString();
                    }

                    if (FlightSafetyReportView.PeoplePickercrew2email != null)
                    {
                        sf.FlightCrew2 = FlightSafetyReportView.PeoplePickercrew2email.Id.ToString();
                    }

                    sf.Attachments = _attachementView.GetAttachmentInfoAsString();
                    sf             = App.DAUtil.SaveOrUpdate(sf);
                    if (sf != null)
                    {
                        _viewobject = sf;
                    }
                    break;

                case "security":
                    idval = new Random().Next(1, 1000);
                    SecurityModel sd = (SecurityModel)_viewobject;
                    sd.IsExtendedView = Formcheck.IsToggled;
                    sd.ReportType     = "Security" + idval.ToString();
                    sd.MOR            = Convert.ToString(MORpicker.SelectedIndex);
                    sd.Created        = DateTime.Now;
                    sd.Attachments    = _attachementView.GetAttachmentInfoAsString();
                    sd = App.DAUtil.SaveOrUpdate(sd);
                    if (sd != null)
                    {
                        _viewobject = sd;
                    }

                    break;

                case "ground":
                    idval = new Random().Next(1, 1000);
                    GroundSafetyReport gd = (GroundSafetyReport)_viewobject;
                    gd.IsExtendedView = Formcheck.IsToggled;
                    gd.ReportType     = "GroundSafety" + idval.ToString();
                    gd.MOR            = Convert.ToString(MORpicker.SelectedIndex);
                    gd.Created        = DateTime.Now;
                    gd.Attachments    = _attachementView.GetAttachmentInfoAsString();
                    gd = App.DAUtil.SaveOrUpdate(gd);
                    if (gd != null)
                    {
                        _viewobject = gd;
                    }

                    break;

                case "fatigue":
                    idval = new Random().Next(1, 1000);
                    FatigueReport ft = (FatigueReport)_viewobject;
                    ft.IsExtendedView = Formcheck.IsToggled;
                    ft.ReportType     = "Fatigue" + idval.ToString();
                    ft.MOR            = Convert.ToString(MORpicker.SelectedIndex);
                    ft.Created        = DateTime.Now;
                    ft.Attachments    = _attachementView.GetAttachmentInfoAsString();
                    ft = App.DAUtil.SaveOrUpdate(ft);
                    if (ft != null)
                    {
                        _viewobject = ft;
                    }

                    break;

                case "Injury":
                    idval = new Random().Next(1, 1000);
                    InjuryIllnessReport injr = (InjuryIllnessReport)_viewobject;
                    injr.IsExtendedView = Formcheck.IsToggled;
                    injr.ReportType     = "InjuryIllness" + idval.ToString();
                    injr.MOR            = Convert.ToString(MORpicker.SelectedIndex);
                    injr.Created        = DateTime.Now;
                    injr.Attachments    = _attachementView.GetAttachmentInfoAsString();
                    injr = App.DAUtil.SaveOrUpdate(injr);
                    if (injr != null)
                    {
                        _viewobject = injr;
                    }

                    break;

                case "cabin":
                    idval = new Random().Next(1, 1000);
                    CabibSafetyReport cd = (CabibSafetyReport)_viewobject;
                    cd.IsExtendedView = Formcheck.IsToggled;
                    cd.ReportType     = "Cabin" + idval.ToString();
                    cd.MOR            = Convert.ToString(MORpicker.SelectedIndex);
                    cd.Created        = DateTime.Now;
                    cd.Attachments    = _attachementView.GetAttachmentInfoAsString();
                    cd = App.DAUtil.SaveOrUpdate(cd);
                    if (cd != null)
                    {
                        _viewobject = cd;
                    }

                    break;
                }

                DependencyService.Get <IMessage>().ShortAlert("Item drafted");
            }
            catch (Exception)
            {
            }
        }