Exemplo n.º 1
0
        async partial void Btn_SaveAfterMarket_Activated(UIBarButtonItem sender)
        {
            Btn_SaveAfterMarket.Enabled = false;
            var splitViewController = (UISplitViewController)AppDelegate.appDelegate.Window.RootViewController;

            Utility.ShowLoadingIndicator(splitViewController.View, "Saving...", true);

            SIMSResponseData responseData = await CallSaveAfterMarketFactoryOptions();

            Utility.HideLoadingIndicator(splitViewController.View);
            // Navigate to History
            if (null == masterViewController)
            {
                if (!UserInterfaceIdiomIsPhone)
                {
                    masterViewController = (MasterViewController)((UINavigationController)SplitViewController.ViewControllers[0]).TopViewController;
                }
            }

            ViewWorker viewWorker = new ViewWorker();

            viewWorker.WorkerDelegate = (ExtAppraisalApp.Utilities.WorkerDelegateInterface)masterViewController;

            if (!AppDelegate.appDelegate.IsAllDataSaved)
            {
                if (!AppDelegate.appDelegate.IsAftermarketSaved)
                {
                    viewWorker.PerformNavigation(4);
                    if (!AppDelegate.appDelegate.IsHistory)
                    {
                        viewWorker.ShowPartialDoneImg(4);
                    }

                    viewWorker.ShowDoneImg(3);

                    if (UserInterfaceIdiomIsPhone)
                    {
                        var dictionary = new NSDictionary(new NSString("1"), new NSString("AfterMarket"));

                        NSNotificationCenter.DefaultCenter.PostNotificationName((Foundation.NSString) "MenuSelection", null, dictionary);
                    }
                }
                else
                {
                    viewWorker.PerformNavigation(4);
                }
            }
            else
            {
                var storyboard = UIStoryboard.FromName("Main", null);
                SummaryViewController  summaryViewController  = (SummaryViewController)storyboard.InstantiateViewController("SummaryViewController");
                UINavigationController uINavigationController = new UINavigationController(summaryViewController);
                uINavigationController.ModalTransitionStyle   = UIModalTransitionStyle.CoverVertical;
                uINavigationController.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
                this.NavigationController.PresentViewController(uINavigationController, true, null);
            }

            AppDelegate.appDelegate.IsAftermarketSaved = true;
        }
Exemplo n.º 2
0
        async partial void ReconditionSaveBtn_Activated(UIBarButtonItem sender)
        {
            string labeltext    = null;
            string segmentIndex = null;
            List <ReconditionValue> Saverecon = new List <ReconditionValue>();
            var            documentsPath      = Environment.GetFolderPath(Environment.SpecialFolder.Personal);         // Documents Folder
            var            libraryPath        = Path.Combine(documentsPath, DBConstant.SEPARATOR, DBConstant.LIBRARY); // Library Folder
            var            DbPath             = Path.Combine(libraryPath, DBConstant.DB_NAME);
            ReconditionKBB recondata          = new ReconditionKBB();
            var            connac             = new SQLite.SQLiteConnection(DbPath);

            connac.CreateTable <ReconditionValue>();

            for (int i = 2; i >= 0; i--)
            {
                string segmentKey = i.ToString();
                var    existings  = (connac.Table <ReconditionValue>().Where(
                                         c => c.SegmentIndex == segmentKey)).SingleOrDefault();
                if (existings == null)
                {
                    if (i == 0)
                    {
                        globalInde.selectedSegmentIndex = "0";
                        setObjectRecon("0");

                        labeltext = "Mechanical";
                        ReconditionSegment.SelectedSegment = 0;
                    }
                    else if (i == 1)
                    {
                        globalInde.selectedSegmentIndex = "1";
                        setObjectRecon("1");

                        labeltext = "Interior";
                        ReconditionSegment.SelectedSegment = 1;
                    }
                    else if (i == 2)
                    {
                        globalInde.selectedSegmentIndex = "2";
                        setObjectRecon("2");

                        labeltext = "Exterior";
                        ReconditionSegment.SelectedSegment = 2;
                    }
                    //ReconditionSaveBtn.TintColor = UIColor.Red;


                    ReconditionSaveBtn.Title      = "Next";
                    selectionAlertLabel.Hidden    = false;
                    selectionAlertLabel.Text      = "Please choose one of the " + labeltext + " options below";
                    selectionAlertLabel.TextColor = UIColor.Red;

                    var splitViewController = (UISplitViewController)AppDelegate.appDelegate.Window.RootViewController;
                    Utility.HideLoadingIndicator(splitViewController.View);
                }
                else
                {
                    recondata.VehicleID = AppDelegate.appDelegate.vehicleID;
                    recondata.StoreID   = AppDelegate.appDelegate.storeId;
                    recondata.InvtrID   = AppDelegate.appDelegate.invtrId;
                    recondata.UserName  = "******";
                    if (existings.SegmentIndex.ToString() == "0")
                    {
                        existings.SegmentIndex = "Mechanical";
                        ReconditionValue record1 = new ReconditionValue();
                        record1.RowOption    = existings.RowOption.ToString();
                        record1.SegmentIndex = existings.SegmentIndex;
                        Saverecon.Add(record1);
                        string   optionvalue = setCondition(existings.RowOption.ToString());
                        ReconAns recon1      = new ReconAns()
                        {
                            VehicleConditionCategoryName = "Mechanical",
                            VehicleConditionCategory     = 0,
                            optionValue   = optionvalue,
                            optionValueId = Int16.Parse(existings.RowOption)
                        };
                        recondata.Answers.Add(recon1);
                    }
                    else if (existings.SegmentIndex.ToString() == "1")
                    {
                        segmentIndex = "Exterior";
                        ReconditionValue record2 = new ReconditionValue();

                        record2.SegmentIndex = segmentIndex;
                        record2.RowOption    = existings.RowOption.ToString();
                        Saverecon.Add(record2);
                        string   optionvalue = setCondition(existings.RowOption.ToString());
                        ReconAns recon2      = new ReconAns()
                        {
                            VehicleConditionCategoryName = "Exterior",
                            VehicleConditionCategory     = 1,
                            optionValue   = optionvalue,
                            optionValueId = Int16.Parse(existings.RowOption)
                        };
                        recondata.Answers.Add(recon2);
                    }
                    else if (existings.SegmentIndex.ToString() == "2")
                    {
                        segmentIndex = "Interior";
                        ReconditionValue record3 = new ReconditionValue();

                        record3.SegmentIndex = segmentIndex;
                        record3.RowOption    = existings.RowOption.ToString();
                        Saverecon.Add(record3);
                        string   optionvalue = setCondition(existings.RowOption.ToString());
                        ReconAns recon3      = new ReconAns()
                        {
                            VehicleConditionCategoryName = "Interior",
                            VehicleConditionCategory     = 2,
                            optionValue   = optionvalue,
                            optionValueId = Int16.Parse(existings.RowOption)
                        };
                        recondata.Answers.Add(recon3);
                    }
                }
            }

            if ((Saverecon.Count >= 3))
            {
                ReconditionSaveBtn.TintColor = UIColor.FromRGB(95, 165, 53);
                ReconditionSaveBtn.Enabled   = false;
                var splitViewController = (UISplitViewController)AppDelegate.appDelegate.Window.RootViewController;
                Utility.ShowLoadingIndicator(splitViewController.View, "Saving...", true);
                await CallSaveReconService(recondata);

                Utility.HideLoadingIndicator(splitViewController.View);
                if (UserInterfaceIdiomIsPhone)
                {
                    ReconditionSaveBtn.Title = "Save";
                }
                else
                {
                    ReconditionSaveBtn.Title = "Next";
                }

                selectionAlertLabel.Text = "";

                //savereconAPI(recondata);
                //alert.TextColor = UIColor.Black;
                //save recond api

                // Navigate to Photograph
                if (null == masterViewController)
                {
                    if (!UserInterfaceIdiomIsPhone)
                    {
                        masterViewController = (MasterViewController)((UINavigationController)SplitViewController.ViewControllers[0]).TopViewController;
                    }
                }
                ViewWorker viewWorker = new ViewWorker();
                viewWorker.WorkerDelegate = (ExtAppraisalApp.Utilities.WorkerDelegateInterface)masterViewController;

                if (!AppDelegate.appDelegate.IsAllDataSaved)
                {
                    if (!AppDelegate.appDelegate.IsReconditionsSaved)
                    {
                        viewWorker.PerformNavigation(6);
                        viewWorker.ShowPartialDoneImg(6);
                        viewWorker.ShowDoneImg(5);

                        if (UserInterfaceIdiomIsPhone)
                        {
                            var dictionary = new NSDictionary(new NSString("1"), new NSString("Reconditions"));

                            NSNotificationCenter.DefaultCenter.PostNotificationName((Foundation.NSString) "MenuSelection", null, dictionary);
                        }
                    }
                    else
                    {
                        viewWorker.PerformNavigation(6);
                    }
                }
                else
                {
                    var storyboard = UIStoryboard.FromName("Main", null);
                    SummaryViewController  summaryViewController  = (SummaryViewController)storyboard.InstantiateViewController("SummaryViewController");
                    UINavigationController uINavigationController = new UINavigationController(summaryViewController);
                    uINavigationController.ModalTransitionStyle   = UIModalTransitionStyle.CoverVertical;
                    uINavigationController.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
                    this.NavigationController.PresentViewController(uINavigationController, true, null);
                }

                AppDelegate.appDelegate.IsReconditionsSaved = true;
            }
        }
        async partial void Save_Activated(UIBarButtonItem sender)
        {
            value1        = Segment1.SelectedSegment.ToString();
            value2        = Segment2.SelectedSegment.ToString();
            value3        = Segment3.SelectedSegment.ToString();
            value2_Answer = label2.Text.ToString();
            if ((value1 == "0" || value1 == "1") && (value2 == "0" || value2 == "1") && (value3 == "0" || value3 == "1"))
            {
                if (value2_Answer != "" || value2 == "1")
                {
                    if (value1.ToString() == "0")
                    {
                        value1 = "Yes";
                    }
                    else
                    {
                        value1 = "No";
                    }
                    if (value2.ToString() == "0")
                    {
                        value2 = "Yes";
                    }
                    else
                    {
                        value2 = "No";
                    }
                    if (value3.ToString() == "0")
                    {
                        value3 = "Yes";
                    }
                    else
                    {
                        value3 = "No";
                    }
                    ReconAnsKBB History1 = new ReconAnsKBB()
                    {
                        questionId                   = "qp/82",
                        questionType                 = "Boolean",
                        label                        = "Do you have a free and clear title? Select “No” if your vehicle is leased or financed.",
                        maximumValue                 = 0,
                        minimumValue                 = 0,
                        comment                      = null,
                        tags                         = null,
                        value                        = value1,
                        vehicleSectionName           = null,
                        vehicleSectionId             = 0,
                        vehicleConditionCategoryName = null,
                        vehicleConditionCategory     = 0
                    };
                    ReconAnsKBB History2 = new ReconAnsKBB()
                    {
                        questionId                   = "qp/76",
                        questionType                 = "Boolean",
                        label                        = "Has an insurance claim ever been filed on this vehicle?",
                        maximumValue                 = 0,
                        minimumValue                 = 0,
                        comment                      = null,
                        tags                         = null,
                        value                        = value2,
                        vehicleSectionName           = null,
                        vehicleSectionId             = 0,
                        vehicleConditionCategoryName = null,
                        vehicleConditionCategory     = 0
                    };
                    ReconAnsKBB History3 = new ReconAnsKBB()
                    {
                        questionId                   = "qp/76/amount",
                        questionType                 = "Integer",
                        label                        = "How much were the total claims?",
                        maximumValue                 = 0,
                        minimumValue                 = 0,
                        comment                      = null,
                        tags                         = null,
                        value                        = value2_Answer.ToString(),
                        vehicleSectionName           = null,
                        vehicleSectionId             = 0,
                        vehicleConditionCategoryName = null,
                        vehicleConditionCategory     = 0
                    };
                    ReconAnsKBB History4 = new ReconAnsKBB()
                    {
                        questionId                   = "qp/79",
                        questionType                 = "Boolean",
                        label                        = "Are 2 sets of keys and alarm pad (if applicable) available?",
                        maximumValue                 = 0,
                        minimumValue                 = 0,
                        comment                      = null,
                        tags                         = null,
                        value                        = value3,
                        vehicleSectionName           = null,
                        vehicleSectionId             = 0,
                        vehicleConditionCategoryName = null,
                        vehicleConditionCategory     = 0
                    };

                    HistoryRequest data = new HistoryRequest();
                    data.Answers.Add(History1);
                    data.Answers.Add(History2);
                    data.Answers.Add(History3);
                    data.Answers.Add(History4);
                    data.VehicleID = AppDelegate.appDelegate.vehicleID;
                    data.StoreID   = AppDelegate.appDelegate.storeId;
                    data.InvtrID   = AppDelegate.appDelegate.invtrId;
                    data.UserName  = "******";
                    Save.Enabled   = false;
                    var splitViewController = (UISplitViewController)AppDelegate.appDelegate.Window.RootViewController;
                    Utility.ShowLoadingIndicator(splitViewController.View, "Saving...", true);
                    await CallSaveHistory(data);

                    Utility.HideLoadingIndicator(splitViewController.View);
                    // Navigate to Recondition
                    if (null == masterViewController)
                    {
                        if (!UserInterfaceIdiomIsPhone)
                        {
                            masterViewController = (MasterViewController)((UINavigationController)SplitViewController.ViewControllers[0]).TopViewController;
                        }
                    }

                    ViewWorker viewWorker = new ViewWorker();
                    viewWorker.WorkerDelegate = (ExtAppraisalApp.Utilities.WorkerDelegateInterface)masterViewController;

                    if (!AppDelegate.appDelegate.IsAllDataSaved)
                    {
                        if (!AppDelegate.appDelegate.IsHistorySaved)
                        {
                            viewWorker.PerformNavigation(5);
                            viewWorker.ShowPartialDoneImg(5);
                            viewWorker.ShowDoneImg(4);

                            if (UserInterfaceIdiomIsPhone)
                            {
                                var dictionary = new NSDictionary(new NSString("1"), new NSString("History"));

                                NSNotificationCenter.DefaultCenter.PostNotificationName((Foundation.NSString) "MenuSelection", null, dictionary);
                            }
                        }
                        else
                        {
                            viewWorker.PerformNavigation(5);
                        }
                    }
                    else
                    {
                        var storyboard = UIStoryboard.FromName("Main", null);
                        SummaryViewController  summaryViewController  = (SummaryViewController)storyboard.InstantiateViewController("SummaryViewController");
                        UINavigationController uINavigationController = new UINavigationController(summaryViewController);
                        uINavigationController.ModalTransitionStyle   = UIModalTransitionStyle.CoverVertical;
                        uINavigationController.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
                        this.NavigationController.PresentViewController(uINavigationController, true, null);
                    }

                    AppDelegate.appDelegate.IsHistorySaved = true;
                }
                else
                {
                    label2.BackgroundColor = UIColor.FromRGB(255, 213, 213);
                    label1.BackgroundColor = UIColor.FromRGB(255, 213, 213);
                    label3.TextColor       = UIColor.FromRGB(215, 4, 27);//Label 2 highlight with red color
                }
            }
            if (!(value1 == "1" || value1 == "0" || value1 == "Yes" || value1 == "No"))
            {
                Segment1.TintColor = UIColor.Red;
            }
            if (!(value2 == "1" || value2 == "0" || value2 == "Yes" || value2 == "No"))
            {
                Segment2.TintColor = UIColor.Red;
            }
            if (!(value3 == "1" || value3 == "0" || value3 == "Yes" || value3 == "No"))
            {
                Segment3.TintColor = UIColor.Red;
            }
        }