Exemplo n.º 1
0
        public CabibSafetyReportSp getCabinSfetyJson(CabibSafetyReport sd)
        {
            CabibSafetyReportSp sddp = new CabibSafetyReportSp();

            sddp.MobileEntry      = true;
            sddp.ReportType       = "Cabin Safety Report"; //sd.ReportType;
            sddp.AircraftRegis    = sd.AircraftRegistration;
            sddp.EventTitle       = sd.EventTitle;
            sddp.DescribeEvent    = sd.DescribeEvent != null ? "<div class=\"ExternalClass733EA004DCC641EFAFED516F5D12CCA7\"><br>\u200b" + sd.DescribeEvent + "<br><\u002fdiv>" : null;
            sddp.FlightNumber     = sd.FlightNumber;
            sddp.DateOfEvent      = sd.DateOfEvent.ToString("yyyy-MM-dd") + "T07:00:00Z"; //"2018-03-14T07:00:00Z";//
            sddp.DepartureStation = sd.DepartureStation;
            sddp.ArrivalStation   = sd.ArrivalStation;
            sddp.DivertStation    = sd.DivertStation;
            sddp.Area_FIR         = sd.Area_FIR;
            sddp.Attachment       = sd.Attachment;
            sddp.MOR = SSIRShortForm.MORTypeID != null?Convert.ToString(SSIRShortForm.MORTypeID + 1) : null;

            sddp.ConfiReport = sd.ConfiReport == true ? "1" : "0";
            sddp.ssQ         = sd.ssQ == true ? "1" : "0";
            sddp.pax         = sd.pax;

            sddp.turbulenceIndex           = CabinSafetyReportView.turbulenceValue;
            sddp.seatBeltsign              = sd.seatBeltsign == true ? "1" : "0";
            sddp.adviceStop                = sd.adviceStop == true ? "1" : "0";
            sddp.dangerPaxIndex            = CabinSafetyReportView.dangergoodsValue;
            sddp.identifiedWhenCabinIndex  = CabinSafetyReportView.dangerWhenValue;
            sddp.identifiedWhereCabinIndex = CabinSafetyReportView.dangerWhereValue;

            sddp.SubmitterEmail  = sd.SubmitterEmail;
            sddp.NameStaffNumber = sd.NameStaffNumber;

            return(sddp);
        }
Exemplo n.º 2
0
        public void intializeProperties()
        {
            switch (_classname)
            {
            case "safety":
                idval = new Random().Next(1, 1000);
                FlightSafetyReportModel sf = (FlightSafetyReportModel)_viewobject;
                sf.ReportType = "Safety" + idval.ToString();
                App.DAUtil.Save <FlightSafetyReportModel>(sf);
                break;

            case "security":
                idval = new Random().Next(1, 1000);
                SecurityModel sd = (SecurityModel)_viewobject;
                sd.ReportType = "Security" + idval.ToString();
                App.DAUtil.Save <SecurityModel>(sd);
                break;

            case "ground":
                idval = new Random().Next(1, 1000);
                GroundSafetyReport gd = (GroundSafetyReport)_viewobject;
                gd.ReportType = "GroundSafety" + idval.ToString();
                App.DAUtil.Save <GroundSafetyReport>(gd);
                break;

            case "fatigue":
                idval = new Random().Next(1, 1000);
                FatigueReport ft = (FatigueReport)_viewobject;
                ft.ReportType = "Fatigue" + idval.ToString();
                App.DAUtil.Save <FatigueReport>(ft);
                break;

            case "Injury":
                idval = new Random().Next(1, 1000);
                InjuryIllnessReport injr = (InjuryIllnessReport)_viewobject;
                injr.ReportType = "InjuryIllness" + idval.ToString();
                App.DAUtil.Save <InjuryIllnessReport>(injr);
                break;

            case "cabin":
                idval = new Random().Next(1, 1000);
                CabibSafetyReport cd = (CabibSafetyReport)_viewobject;
                cd.ReportType = "Cabin" + idval.ToString();
                App.DAUtil.Save <CabibSafetyReport>(cd);
                break;
            }
        }
Exemplo n.º 3
0
        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)
            {
            }
        }
Exemplo n.º 4
0
        private async void Save_clicked(object sender, EventArgs e)
        {
            if (Convert.ToString(EventTitleEntry.Text).Length == 0 || dtevntPicker.Date == null || Convert.ToString(MORpicker.SelectedItem).Length == 0)
            {
                if (Convert.ToString(EventTitleEntry.Text).Length == 0)
                {
                    EventTitle.TextColor = Color.OrangeRed;
                    EventTitleEntry.Focus();
                }
                else if (Convert.ToString(MORpicker.SelectedItem).Length == 0)
                {
                    MOR.TextColor = Color.OrangeRed;
                    MORpicker.Focus();
                }
                DependencyService.Get <IMessage>().ShortAlert("Please fill all required fields");
            }
            else
            {
                try
                {
                    EventTitle.TextColor = Color.Black;
                    MOR.TextColor        = Color.Black;
                    switch (_classname)
                    {
                    case "safety":
                        FlightSafetyReportModel sf = (FlightSafetyReportModel)_viewobject;
                        sf.ReportType = "Safety" + sf.Id.ToString();
                        MORTypeID     = MORpicker.SelectedIndex;
                        CreateItems(jsonInitObj.getflightSafetyJson(sf), ReportType.FlightSafety);
                        App.DAUtil.Delete(sf);
                        break;

                    case "security":
                        SecurityModel sd = (SecurityModel)_viewobject;
                        sd.ReportType = "Security" + sd.Id.ToString();
                        MORTypeID     = MORpicker.SelectedIndex;
                        DataContracts.FlightSecuritySharepointData spData = null;
                        try
                        {
                            spData = jsonInitObj.getSecurity(sd);
                        }
                        catch (Exception ex)
                        {
                            await DisplayAlert("Please fill valid data", ex.Message, "Ok");

                            return;
                        }

                        CreateItems(spData, ReportType.Security);
                        App.DAUtil.Delete(sd);
                        break;

                    case "ground":
                        GroundSafetyReport gd = (GroundSafetyReport)_viewobject;
                        gd.ReportType = "GroundSafety" + gd.Id.ToString();
                        CreateItems(jsonInitObj.getGroundSafety(gd), ReportType.GroundSafety);
                        App.DAUtil.Delete(gd);
                        break;

                    case "fatigue":
                        FatigueReport ft = (FatigueReport)_viewobject;
                        ft.ReportType = "Fatigue" + ft.Id.ToString();
                        CreateItems(jsonInitObj.getFatigue(ft), ReportType.Fatigue);
                        App.DAUtil.Delete(ft);
                        break;

                    case "Injury":
                        InjuryIllnessReport injr = (InjuryIllnessReport)_viewobject;
                        injr.ReportType = "InjuryIllness" + injr.Id.ToString();
                        CreateItems(jsonInitObj.getInjuryJson(injr), ReportType.InjuryIllness);
                        App.DAUtil.Delete(injr);
                        break;

                    case "cabin":
                        CabibSafetyReport cd = (CabibSafetyReport)_viewobject;
                        cd.ReportType = "Cabin" + cd.Id.ToString();
                        CreateItems(jsonInitObj.getCabinSfetyJson(cd), ReportType.CabinSafety);
                        App.DAUtil.Delete(cd);
                        break;
                    }
                }
                catch (Exception ex)
                {
                    await DisplayAlert("Please fill valid data", ex.Message, "Ok");
                }
            }
        }
        private async void navigateToReport(int id)
        {
            switch (_reportType)
            {
            case "safety":
                FlightSafetyReportModel listitem = (from itm in App.safetyReport
                                                    where itm.Id == id
                                                    select itm).FirstOrDefault();
                await Navigation.PushAsync(new SSIRShortForm(listitem, "safety"));

                break;

            case "ground":
                GroundSafetyReport listitem1 = (from itm in App.groundSafety
                                                where itm.Id == id
                                                select itm).FirstOrDefault();
                await Navigation.PushAsync(new SSIRShortForm(listitem1, "ground"));

                break;

            case "cabin":

                CabibSafetyReport listitem2 = (from itm in App.cabinSafety
                                               where itm.Id == id
                                               select itm).FirstOrDefault();
                await Navigation.PushAsync(new SSIRShortForm(listitem2, "cabin"));

                break;

            case "security":
                SecurityModel listitem3 = (from itm in App.security
                                           where itm.Id == id
                                           select itm).FirstOrDefault();
                await Navigation.PushAsync(new SSIRShortForm(listitem3, "security"));

                break;

            case "illness":
                InjuryIllnessReport listitem4 = (from itm in App.injuryIllness
                                                 where itm.Id == id
                                                 select itm).FirstOrDefault();
                await Navigation.PushAsync(new SSIRShortForm(listitem4, "Injury"));

                break;

            case "fatigue":
                FatigueReport listitem5 = (from itm in App.fatigue
                                           where itm.Id == id
                                           select itm).FirstOrDefault();
                await Navigation.PushAsync(new SSIRShortForm(listitem5, "fatigue"));

                break;

            case "kaizen":
                KaizenReportModel listitem6 = (from itm in App.kaizen
                                               where itm.Id == id
                                               select itm).FirstOrDefault();
                await Navigation.PushAsync(new KaizenReport(listitem6, "kaizen"));

                break;

            case "fcVoyage":
                FlightCrewVoyageRecordModel listitem7 = (from itm in App.fcVoyage
                                                         where itm.Id == id
                                                         select itm).FirstOrDefault();
                await Navigation.PushAsync(new FlightCrewVoyageRecord(listitem7, "fcVoyage"));

                break;

            case "stsnInfo":
                StationInformationModel listitem8 = (from itm in App.statInfo
                                                     where itm.Id == id
                                                     select itm).FirstOrDefault();
                await Navigation.PushAsync(new StationInformation(listitem8));

                break;
            }
        }