public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            rootView = inflater.Inflate(Resource.Layout.gstn_verification, container, false);

            StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
            StrictMode.SetVmPolicy(builder.Build());
            StrictMode.ThreadPolicy.Builder builder1 = new StrictMode.ThreadPolicy.Builder().PermitAll();
            StrictMode.SetThreadPolicy(builder1.Build());


            con = new InternetConnection();

            searchGST            = (TextInputEditText)rootView.FindViewById(Resource.Id.searchGSTN);
            gstnProgress         = (ProgressBar)rootView.FindViewById(Resource.Id.progressGST);
            tradeName1           = (TextView)rootView.FindViewById(Resource.Id.tradeName);
            gstnIdText1          = (TextView)rootView.FindViewById(Resource.Id.gstnId);
            regDate1             = (TextView)rootView.FindViewById(Resource.Id.regDate);
            mobileNumber1        = (TextView)rootView.FindViewById(Resource.Id.mobileNumberVer);
            linear1              = (LinearLayout)rootView.FindViewById(Resource.Id.linearQuestion1);
            linear2              = (LinearLayout)rootView.FindViewById(Resource.Id.linearQuestion2);
            linear3              = (LinearLayout)rootView.FindViewById(Resource.Id.linearQuestion3);
            gridLayout           = (LinearLayout)rootView.FindViewById(Resource.Id.gridVer);
            submitDataVer        = (Button)rootView.FindViewById(Resource.Id.submitVerification);
            cameraVer            = (ImageButton)rootView.FindViewById(Resource.Id.cameraVer);
            gridViewVer          = (GridView)rootView.FindViewById(Resource.Id.gridViewVer);
            checkValidate        = (CheckBox)rootView.FindViewById(Resource.Id.checkVerification);
            rg1                  = (RadioGroup)rootView.FindViewById(Resource.Id.myRadioGroup1);
            rg2                  = (RadioGroup)rootView.FindViewById(Resource.Id.myRadioGroup2);
            rg3                  = (RadioGroup)rootView.FindViewById(Resource.Id.myRadioGroup3);
            rg4                  = (LinearLayout)rootView.FindViewById(Resource.Id.myRadioGroup4);
            Yes1                 = (RadioButton)rootView.FindViewById(Resource.Id.yes1);
            Yes2                 = (RadioButton)rootView.FindViewById(Resource.Id.yes2);
            Yes3                 = (RadioButton)rootView.FindViewById(Resource.Id.yes3);
            No1                  = (RadioButton)rootView.FindViewById(Resource.Id.no1);
            No2                  = (RadioButton)rootView.FindViewById(Resource.Id.no2);
            No3                  = (RadioButton)rootView.FindViewById(Resource.Id.no3);
            Manufacturer         = (CheckBox)rootView.FindViewById(Resource.Id.manufacturer);
            Trader               = (CheckBox)rootView.FindViewById(Resource.Id.trader);
            ServiceDealer        = (CheckBox)rootView.FindViewById(Resource.Id.serviceDealer);
            turnoverText         = (TextInputEditText)rootView.FindViewById(Resource.Id.turnOver);
            otherText            = (TextInputEditText)rootView.FindViewById(Resource.Id.otherText1);
            areaBusiness         = (TextInputEditText)rootView.FindViewById(Resource.Id.area1);
            businessSelectButton = (Button)rootView.FindViewById(Resource.Id.mySelection);

            grid_adapter        = new GridAdapter(Activity, Utilities.imageList);
            gridViewVer.Adapter = grid_adapter;

            tradeName1.Visibility  = ViewStates.Gone;
            gstnIdText1.Visibility = ViewStates.Gone;
            regDate1.Visibility    = ViewStates.Gone;

            mobileNumber1.Visibility = ViewStates.Gone;

            gridLayout.Visibility = ViewStates.Gone;

            submitDataVer.Visibility = ViewStates.Gone;

            cameraVer.Visibility     = ViewStates.Gone;
            gridViewVer.Visibility   = ViewStates.Gone;
            checkValidate.Visibility = ViewStates.Gone;

            linear1.Visibility = ViewStates.Gone;
            linear2.Visibility = ViewStates.Gone;
            linear3.Visibility = ViewStates.Gone;

            otherText.Visibility            = ViewStates.Gone;
            areaBusiness.Visibility         = ViewStates.Gone;
            turnoverText.Visibility         = ViewStates.Gone;
            rg4.Visibility                  = ViewStates.Gone;
            businessSelectButton.Visibility = ViewStates.Gone;


            Yes1.Click += RadioButtonClick;
            No1.Click  += RadioButtonClick;
            Yes2.Click += RadioButtonClick;
            No2.Click  += RadioButtonClick;
            Yes3.Click += RadioButtonClick;
            No3.Click  += RadioButtonClick;

            businessSelectButton.Click += delegate
            {
                try
                {
                    Intent i = new Intent(Activity, typeof(BusinessTypeFragment));
                    Activity.StartActivity(i);

                    //FragmentTransaction ft = FragmentManager.BeginTransaction();
                    //BusinessTypeFragment f4 = new BusinessTypeFragment();
                    //ft.Replace(Resource.Id.container, f4);
                    //ft.AddToBackStack("BusinessTypeFragment");
                    //ft.Commit();
                    // FragmentManager.BeginTransaction().Add(Resource.Id.container, new BusinessTypeFragment()).Commit();
                }catch (Exception ex)
                {
                }
            };



            mobileNumber1.Click += delegate
            {
                AlertDialog.Builder alertDiag = new AlertDialog.Builder(Activity);
                alertDiag.SetTitle("Call Dialog");
                alertDiag.SetMessage("Do you want to call?");
                alertDiag.SetPositiveButton("Call", (senderAlert, args) => {
                    try
                    {
                        var uri    = Android.Net.Uri.Parse("tel:" + phoneNumber);
                        var intent = new Intent(Intent.ActionDial, uri);
                        StartActivity(intent);
                    }catch (Exception e)
                    {
                    }
                });
                alertDiag.SetNegativeButton("Cancel", (senderAlert, args) => {
                    alertDiag.Dispose();
                });
                Android.App.Dialog diag = alertDiag.Create();
                diag.Show();
            };

            cameraVer.Click += delegate
            {
                CameraPic();
            };

            searchGST.TextChanged += delegate
            {
                if (searchGST.Text.ToString().Length >= 15)
                {
                    string searchText = searchGST.Text.ToString();
                    if (con.connectivity())
                    {
                        GSTNSearch(searchText).Wait();
                    }
                    else
                    {
                        Toast.MakeText(Activity, "Please connect to Internet.", ToastLength.Long).Show();
                    }
                }
                else
                {
                    tradeName1.Visibility    = ViewStates.Gone;
                    gstnIdText1.Visibility   = ViewStates.Gone;
                    regDate1.Visibility      = ViewStates.Gone;
                    mobileNumber1.Visibility = ViewStates.Gone;

                    gridLayout.Visibility    = ViewStates.Gone;
                    checkValidate.Visibility = ViewStates.Gone;
                    submitDataVer.Visibility = ViewStates.Gone;

                    cameraVer.Visibility   = ViewStates.Gone;
                    gridViewVer.Visibility = ViewStates.Gone;
                    linear1.Visibility     = ViewStates.Gone;
                    linear2.Visibility     = ViewStates.Gone;
                    linear3.Visibility     = ViewStates.Gone;

                    otherText.Visibility            = ViewStates.Gone;
                    areaBusiness.Visibility         = ViewStates.Gone;
                    turnoverText.Visibility         = ViewStates.Gone;
                    rg4.Visibility                  = ViewStates.Gone;
                    businessSelectButton.Visibility = ViewStates.Gone;
                }
            };

            submitDataVer.Click += delegate {
                other        = otherText.Text.ToString();
                premisesArea = areaBusiness.Text.ToString();
                if (checkValidate.Selected)
                {
                    compoundingEligible = "Yes";
                }
                else
                {
                    compoundingEligible = "No";
                }

                //if (Manufacturer.Selected)
                //{
                //    manuf = "Manufacturer";
                //}
                //if (Trader.Selected)
                //{
                //    trad = "Trader";
                //}
                //if (ServiceDealer.Selected)
                //{
                //    dealer = "Service Dealer";
                //}

                turnOver = turnoverText.Text.ToString();
                //if (!manuf.Equals(""))
                //{
                //    if (!combine.Equals(""))
                //    {
                //        combine += "," + manuf;
                //    }
                //    else
                //    {
                //        combine += manuf;
                //    }
                //}
                //if (!trad.Equals(""))
                //{
                //    if (!combine.Equals(""))
                //    {
                //        combine += "," + trad;
                //    }
                //    else
                //    {
                //        combine += trad;
                //    }
                //}
                //if (!dealer.Equals(""))
                //{
                //    if (!combine.Equals(""))
                //    {
                //        combine += "," + dealer;
                //    }
                //    else
                //    {
                //        combine += dealer;
                //    }
                //}
                try
                {
                    combine = string.Join(",", Utilities.GlobalBusinessList);
                }catch (Exception ex)
                {
                    combine = "";
                }


                if (address.Equals(""))
                {
                    Toast.MakeText(Activity, "Please Select Address Status", ToastLength.Short).Show();
                    return;
                }
                if (businessStatus.Equals(""))
                {
                    Toast.MakeText(Activity, "Please Select Business Status", ToastLength.Short).Show();
                    return;
                }

                if (registration.Equals(""))
                {
                    Toast.MakeText(Activity, "Please Select Registration Status", ToastLength.Short).Show();
                    return;
                }

                if (Utilities.imageList.Count < 1)
                {
                    Toast.MakeText(Activity, "Please Capture Atleast One Photograph.", ToastLength.Short).Show();
                    return;
                }


                if (con.connectivity())
                {
                    submitDataVer.Enabled = false;
                    try
                    {
                        sendToServer();
                    }catch (Exception ex)
                    {
                        Toast.MakeText(Activity, "Something went wrong. Please try after sometime.", ToastLength.Long).Show();

                        PackageManager manager = Activity.PackageManager;
                        PackageInfo    info    = manager.GetPackageInfo(Activity.PackageName, 0);
                        info.VersionName.ToString();
                        int i = dba.insertGSTINData(geo.GetGeoLocation(Activity), GSTIN, "", DateTime.Now.ToString("yyyy-MM-dd"),
                                                    address, businessStatus, registration, other, compoundingEligible, premisesArea,
                                                    combine, turnOver, info.VersionName.ToString(), "no");

                        for (int j = 0; j < Utilities.imageList.Count; j++)
                        {
                            dba.insertImageDetail(i, Utilities.imageList[j].ImagePath, geo.GetGeoLocation(Activity));
                        }
                    }
                }
                else
                {
                    submitDataVer.Enabled = false;
                    PackageManager manager = Activity.PackageManager;
                    PackageInfo    info    = manager.GetPackageInfo(Activity.PackageName, 0);
                    info.VersionName.ToString();
                    int i = dba.insertGSTINData(geo.GetGeoLocation(Activity), GSTIN, "", DateTime.Now.ToString("yyyy-MM-dd"),
                                                address, businessStatus, registration, other, compoundingEligible, premisesArea,
                                                combine, turnOver, info.VersionName.ToString(), "no");

                    for (int j = 0; j < Utilities.imageList.Count; j++)
                    {
                        dba.insertImageDetail(i, Utilities.imageList[j].ImagePath, geo.GetGeoLocation(Activity));
                    }
                    Toast.MakeText(Activity, "Data Saved in Database.", ToastLength.Long).Show();

                    combine = "";
                    GSTIN   = "";
                    rg1.ClearCheck();
                    address = "";
                    rg2.ClearCheck();
                    businessStatus = "";
                    rg3.ClearCheck();
                    registration          = "";
                    other                 = "";
                    otherText.Text        = "";
                    checkValidate.Checked = false;
                    compoundingEligible   = "";
                    premisesArea          = "";
                    areaBusiness.Text     = "";
                    turnoverText.Text     = "";
                    Utilities.imageList.Clear();
                    turnOver              = "";
                    Manufacturer.Checked  = false;
                    Trader.Checked        = false;
                    ServiceDealer.Checked = false;
                    submitDataVer.Enabled = true;
                    manuf  = "";
                    trad   = "";
                    dealer = "";
                    grid_adapter.NotifyDataSetChanged();
                    Utilities.GlobalBusinessList.Clear();
                }
            };

            return(rootView);
        }
        public async Task sendToServer()
        {
            List <GSTINVerFiles1> imageList = new List <GSTINVerFiles1>();

            for (int i = 0; i < Utilities.imageList.Count; i++)
            {
                byte[] img = GetStreamFromFile(Utilities.imageList[i].ImagePath);
                var    url = await ic.UploadPhotoAsync(img, Utilities.imageList[i].ImagePath.Substring(Utilities.imageList[i].ImagePath.LastIndexOf("/") + 1));

                if (url != null)
                {
                    imageList.Add(new GSTINVerFiles1
                    {
                        VerFileName = url,
                        GeoLocation = geo.GetGeoLocation(Activity),
                    });
                }
            }

            GSTINModel model = new GSTINModel();

            model.GeoLocation           = geo.GetGeoLocation(Activity);
            model.GSTINID               = GSTIN;
            model.WentNotVerified       = "";
            model.AppDateTime           = DateTime.Now.ToString("yyyy-MM-dd");
            model.AddressStatus         = address;
            model.BusinessStatus        = businessStatus;
            model.RegistrationAccording = registration;
            model.Other = other;
            model.CompoundingEligible  = compoundingEligible;
            model.PremisesArea         = premisesArea;
            model.GSTINVerFiles        = imageList;
            model.ManufacturerOrTrader = combine;
            model.TurnOver             = turnOver;
            PackageManager manager = Activity.PackageManager;
            PackageInfo    info    = manager.GetPackageInfo(Activity.PackageName, 0);

            model.versionName = info.VersionName.ToString();

            string dt       = JsonConvert.SerializeObject(model);
            string response = "";

            try
            {
                response = await restService.PostServiceMethod(Activity, "SetGSTINCertification", dt);
            }catch (Exception ex)
            {
            }
            if (response.Contains("Success"))
            {
                Toast.MakeText(Activity, "Data Submitted Successfully.", ToastLength.Long).Show();
                GSTIN = "";
                rg1.ClearCheck();
                address = "";
                rg2.ClearCheck();
                businessStatus = "";
                rg3.ClearCheck();
                registration          = "";
                other                 = "";
                otherText.Text        = "";
                checkValidate.Checked = false;
                compoundingEligible   = "";
                premisesArea          = "";
                areaBusiness.Text     = "";
                turnoverText.Text     = "";
                Utilities.imageList.Clear();
                combine  = "";
                turnOver = "";
                submitDataVer.Enabled = true;
                Manufacturer.Checked  = false;
                Trader.Checked        = false;
                ServiceDealer.Checked = false;
                manuf  = "";
                trad   = "";
                dealer = "";
                grid_adapter.NotifyDataSetChanged();
                info.VersionName.ToString();
                Utilities.GlobalBusinessList.Clear();
                try
                {
                    int i = dba.insertGSTINData(geo.GetGeoLocation(Activity), GSTIN, "", DateTime.Now.ToString("yyyy-MM-dd"),
                                                address, businessStatus, registration, other, compoundingEligible, premisesArea,
                                                combine, turnOver, info.VersionName.ToString(), "yes");

                    for (int j = 0; j < imageList.Count; j++)
                    {
                        dba.insertImageDetail(i, imageList[j].VerFileName, geo.GetGeoLocation(Activity));
                    }
                }catch (Exception ex)
                {
                }
            }
            else
            {
                Toast.MakeText(Activity, "Something went wrong. Please try after sometime.", ToastLength.Long).Show();
                submitDataVer.Enabled = true;
                int i = dba.insertGSTINData(geo.GetGeoLocation(Activity), GSTIN, "", DateTime.Now.ToString("yyyy-MM-dd"),
                                            address, businessStatus, registration, other, compoundingEligible, premisesArea,
                                            combine, turnOver, info.VersionName.ToString(), "no");

                for (int j = 0; j < Utilities.imageList.Count; j++)
                {
                    dba.insertImageDetail(i, Utilities.imageList[j].ImagePath, geo.GetGeoLocation(Activity));
                }
            }
        }