Exemplo n.º 1
0
        public SIMSResponseData SaveRecondition(ReconditionKBB recondata)
        {
            string result = null;
            HttpResponseMessage responseMessage = null;
            SIMSResponseData    response        = new SIMSResponseData();

            try
            {
                string request = JsonConvert.SerializeObject(recondata);

                responseMessage = RestClient.doPost(Url.SAVE_RECON_URL, request);

                if (responseMessage.IsSuccessStatusCode)
                {
                    result = responseMessage.Content.ReadAsStringAsync().Result;
                    SIMSResponseData rst = JsonConvert.DeserializeObject <SIMSResponseData>(result);

                    response = rst;

                    if (null != response)
                    {
                        //Utilities.Utility.ShowAlert("Appraisal App", "Vehicle Recondition saved", "OK");
                    }
                }
                else
                {
                    Utilities.Utility.ShowAlert("Appraisal App", "Recondition save failed!!", "OK");
                }
            }
            catch (Exception exc)
            {
                Console.WriteLine("Exception occured :: " + exc.Message);
            }
            return(response);
        }
Exemplo n.º 2
0
 Task CallSaveReconService(ReconditionKBB reconditionKBB)
 {
     return(Task.Factory.StartNew(() =>
     {
         savereconAPI(reconditionKBB);
     }));
 }
Exemplo n.º 3
0
        public void savereconAPI(ReconditionKBB reconditionKBB)
        {
            SIMSResponseData responseStatus;

            responseStatus = ServiceFactory.ServiceRecon.getWebServiceHandle().SaveRecondition(reconditionKBB);
            //InvokeOnMainThread(() =>
            //{
            //    Utility.HideLoadingIndicator(this.SplitViewController.View);
            //});
        }
Exemplo n.º 4
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;
            }
        }