Пример #1
0
        //public bool permissionmethodAsync()
        //{

        //    GetPermissionAsync();
        //    return true;
        //}
        //private async Task GetPermissionAsync()
        //{
        //    List<String> permissions = new List<String>();
        //    try
        //    {

        //        if (ContextCompat.CheckSelfPermission(Activity, Manifest.Permission.AccessFineLocation) == Permission.Denied)
        //        {
        //            permissions.Add(Manifest.Permission.AccessFineLocation);
        //        }
        //        if (ContextCompat.CheckSelfPermission(Activity, Manifest.Permission.RecordAudio) == Permission.Denied)
        //        {
        //            permissions.Add(Manifest.Permission.RecordAudio);
        //        }
        //        if (ContextCompat.CheckSelfPermission(Activity, Manifest.Permission.AccessCoarseLocation) == Permission.Denied)
        //        {
        //            permissions.Add(Manifest.Permission.AccessCoarseLocation);
        //        }

        //        if (ContextCompat.CheckSelfPermission(Activity, Manifest.Permission.Camera) == Permission.Denied)
        //        {
        //            permissions.Add(Manifest.Permission.Camera);
        //        }

        //        if (ContextCompat.CheckSelfPermission(Activity, Manifest.Permission.ReadExternalStorage) == Permission.Denied)
        //        {
        //            permissions.Add(Manifest.Permission.ReadExternalStorage);
        //        }

        //        if (ContextCompat.CheckSelfPermission(Activity, Manifest.Permission.WriteExternalStorage) == Permission.Denied)
        //        {
        //            permissions.Add(Manifest.Permission.WriteExternalStorage);
        //        }

        //        if (ContextCompat.CheckSelfPermission(Activity, Manifest.Permission.CallPhone) == Permission.Denied)
        //        {
        //            permissions.Add(Manifest.Permission.CallPhone);
        //        }

        //        if (ContextCompat.CheckSelfPermission(Activity, Manifest.Permission.ReadPhoneState) == Permission.Denied)
        //        {
        //            permissions.Add(Manifest.Permission.ReadPhoneState);
        //        }



        //        if (permissions.Count > 0)
        //        {
        //            ActivityCompat.RequestPermissions(Activity, permissions.ToArray(), 100);
        //        }
        //        if (ContextCompat.CheckSelfPermission(Activity, Manifest.Permission.AccessFineLocation) == Permission.Granted)
        //        {
        //            geo = new Geolocation();
        //        }
        //    }
        //    catch (Exception e)
        //    {
        //        System.Console.WriteLine("Error", e.Message);
        //    }

        //}

        public async Task GetLogin()
        {
            Boolean result = ic.connectivity();

            if (result)
            {
                progress = new Android.App.ProgressDialog(Activity);
                progress.Indeterminate = true;
                progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                progress.SetCancelable(false);
                progress.SetMessage("Please wait...");
                progress.Show();
                JsonValue login_value = null;
                try
                {
                    login_value = await nextActivity("", "");
                }
                catch (Exception e)
                {
                }
                if (login_value != null)
                {
                    await ParseAndDisplay(login_value, "");
                }
            }
        }
Пример #2
0
        public async Task <string> Get_Licence_Id()
        {
            Boolean connectivity = ic.connectivity();

            if (connectivity)
            {
                // geolocation = geo.GetGeoLocation(ApplicationContext);
                dynamic value = new ExpandoObject();
                value.gcmid = "1";
                string json = JsonConvert.SerializeObject(value);
                // geolocation = geo.GetGeoLocation(ApplicationContext);
                try
                {
                    licenceId = await restService.GetLicenceId(Activity, geolocation, version, json).ConfigureAwait(false);
                }
                catch (Exception ex)
                {
                }

                ISharedPreferencesEditor editor = prefs.Edit();
                editor.PutString("LicenceId", licenceId);
                editor.Commit();
            }
            else
            {
                Toast.MakeText(Activity, "No Internet, Try after sometime", ToastLength.Short).Show();
            }

            return(licenceId);
        }
Пример #3
0
        public async void Validate()
        {
            var errorMsg = "";

            if (user.Text.Length == 0 && pass.Text.Length == 0)
            {
                if (user.Text.Length == 0 || pass.Text.Length == 0)
                {
                    errorMsg = "Please enter User Name ";
                }
                if (pass.Text.Length == 0 || pass.Text.Length == 0)
                {
                    errorMsg = errorMsg + "Please enter Password";
                }

                Toast.MakeText(this, errorMsg, ToastLength.Long).Show();
                return;
            }
            else
            {
                Boolean result = ic.connectivity();
                if (result)
                {
                    progress = new Android.App.ProgressDialog(this);
                    progress.Indeterminate = true;
                    progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                    progress.SetCancelable(false);
                    progress.SetMessage("Please wait...");
                    progress.Show();
                    JsonValue login_value = null;
                    try
                    {
                        login_value = await nextActivity(user.Text, pass.Text);
                    }
                    catch (Exception e)
                    {
                    }
                    if (login_value != null)
                    {
                        await ParseAndDisplay(login_value, user.Text);
                    }
                    else
                    {
                        Toast.MakeText(this, "No Internet", ToastLength.Long).Show();
                    }

                    //  loginId1 = user.Text;
                    // password1 = pass.Text;
                }
                else
                {
                    Toast.MakeText(this, "No Internet", ToastLength.Long).Show();
                }
            }
        }
Пример #4
0
 public void storeDataBaseAsync()
 {
     db.ComplianceInsert(task_id, markingtype, taskstatus, taskcreatedby, creationdate, task_name, task_description, markingDate, rownum, meatingid, deadline, comp.lstAddedCompliance, geolocation, "no");
     db.InsertcompliancejoinTable(comp.lstAddedCompliance);
     if (ic.connectivity())
     {
         compliances = db.GetCompliance(filetype, task_id);
         //  if (geo != null && geo.Count > 0)
         if (compliances != null && compliances.Count > 0)
         {
             long Id;
             foreach (var val in compliances)
             {
                 Id = val.id;
                 postserviceCompliance(Id);
             }
         }
         // complianceJoinTables = dbHelper.GetComplianceJoinTable(taskid);
         //compliances = dbHelper.GetCompliance(filetype, taskid).Join(dbHelper.GetComplianceJoinTable(taskid).Where(m => m.taskId == taskid).Select(t => new ComplianceJoinTable
         //{
         //    taskId = t.taskId
         //}).ToList());
         // compliances=dbHelper.tab
     }
 }
Пример #5
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View rootView = inflater.Inflate(Resource.Layout.frequent, container, false);

            gv          = rootView.FindViewById <GridView>(Resource.Id.gv);
            prefs       = PreferenceManager.GetDefaultSharedPreferences(Activity);
            desig_Id    = prefs.GetString("DesignationId", "");
            geo         = new Geolocation();
            db          = new DbHelper();
            con         = new InternetConnection();
            geolocation = geo.GetGeoLocation(Activity);

            Boolean connectivity = con.connectivity();

            if (connectivity)
            {
                getData();
            }
            else
            {
                freq = db.GetFrequentList();
                if (freq.Count > 0)
                {
                    adapter = new FrequentAdapter(Activity, freq);
                }
                else
                {
                    Toast.MakeText(Activity, "Couldn't find data for frequents. Please connect to the internet", ToastLength.Long).Show();
                }
                gv.Adapter = adapter;
            }

            return(rootView);
        }
Пример #6
0
        public async System.Threading.Tasks.Task markdataAsync()
        {
            if (con.connectivity())
            {
                string file_extension = await restService.Saveforlater(Activity, "", geolocation);

                initialtaskservicelist = JsonConvert.DeserializeObject <List <InitialTaskModel> >(file_extension);
                db.Insert_InitialTask(initialtaskservicelist);
                if (initialtaskservicelist.Count != 0)
                {
                    recyclerview_layoutmanger = new LinearLayoutManager(Activity, LinearLayoutManager.Vertical, false);
                    recyclerview.SetLayoutManager(recyclerview_layoutmanger);
                    recyclerview_adapter = new SavedTaskAdapter(Activity, initialtaskservicelist, recyclerview, FragmentManager);
                    recyclerview.SetAdapter(recyclerview_adapter);
                }
            }
            else
            {
                //dbtasklist= db.GetinitialTaskssavelist(initialtaskservicelist[0].task_id);
                if (initialTasks.Count != 0)
                {
                    recyclerview_layoutmanger = new LinearLayoutManager(Activity, LinearLayoutManager.Vertical, false);
                    recyclerview.SetLayoutManager(recyclerview_layoutmanger);
                    recyclerview_adapter = new SavedTaskAdapter(Activity, dbtasklist, recyclerview, FragmentManager);
                    recyclerview.SetAdapter(recyclerview_adapter);
                    Toast.MakeText(Activity, "you have not internet connection.. check your internet connection", ToastLength.Long).Show();
                }
            }
        }
Пример #7
0
        public async Task getextensionmethodAsync(string filetype)
        {
            try
            {
                if (ic.connectivity())
                {
                    geolocation = geo.GetGeoLocation(Context);
                    string file_extension = await restservice.FileExtension(Activity, filetype, geolocation);

                    List <FileExtension> fileExtensions = JsonConvert.DeserializeObject <List <FileExtension> >(file_extension);
                    db.insertfileextension(fileExtensions);
                    fileextgetlist.Add(new FileExtension {
                        Text = "Select Extension", Value = "0"
                    });
                    for (int i = 0; i < fileExtensions.Count; i++)
                    {
                        fileextgetlist.Add(new FileExtension {
                            Text = fileExtensions[i].Text, Value = fileExtensions[i].Value
                        });
                    }
                    spinnerextension.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinnertype_ItemSelected2);
                    ArrayAdapter adapter1 = new ArrayAdapter(Activity, Android.Resource.Layout.SimpleListItem1, fileextgetlist);
                    spinnerextension.Adapter = adapter1;
                }
                else
                {
                    List <FileExtension> fileExtensions = db.getfileextension(filetype);
                    fileextgetlist.Add(new FileExtension {
                        Text = "Select Extension", Value = "0"
                    });
                    for (int i = 0; i < fileExtensions.Count; i++)
                    {
                        fileextgetlist.Add(new FileExtension {
                            Text = fileExtensions[i].Text, Value = fileExtensions[i].Value
                        });
                    }
                    spinnerextension.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(Spinnertype_ItemSelected2);
                    ArrayAdapter adapter1 = new ArrayAdapter(Activity, Android.Resource.Layout.SimpleListItem1, fileextgetlist);
                    spinnerextension.Adapter = adapter1;
                }
            }
            catch (Exception ex)
            {
            }
        }
Пример #8
0
        public void checkInternet()
        {
            Boolean connectivity = con.connectivity();

            if (connectivity)
            {
                getData();
            }
            else
            {
                listoutbox = dbHelper.Getoutboxdata();
                for (int i = 0; i < listoutbox.Count; i++)
                {
                    TaskOutboxModel detail = new TaskOutboxModel
                    {
                        TaskPercentage     = listoutbox[i].TaskPercentage,
                        Task_id            = listoutbox[i].Task_id,
                        Task_name          = listoutbox[i].Task_name,
                        Description        = listoutbox[i].Description,
                        deadline_date      = listoutbox[i].deadline_date,
                        mark_to            = listoutbox[i].mark_to,
                        task_status        = listoutbox[i].task_status,
                        Task_created_by    = listoutbox[i].Task_created_by,
                        Task_creation_date = listoutbox[i].Task_creation_date,
                        task_mark_by       = listoutbox[i].task_mark_by,
                        MarkingDate        = listoutbox[i].MarkingDate,
                        task_marking_type  = listoutbox[i].task_marking_type
                    };


                    im_model.Add(detail);
                }
                if (im_model.Count != 0)
                {
                    recyclerview_layoutmanger = new LinearLayoutManager(Activity, LinearLayoutManager.Vertical, false);
                    recyclerview.SetLayoutManager(recyclerview_layoutmanger);
                    recyclerview_adapter = new TaskOutboxAdapter(Activity, im_model, recyclerview, FragmentManager);
                    recyclerview.SetAdapter(recyclerview_adapter);
                }
                else
                {
                    TextView textView = new TextView(Activity);

                    textView.Text = "Oops ! You haven't assigned any task yet";
                    LinearLayout.AddView(textView);
                }
            }
        }
Пример #9
0
        public void CreateTask()
        {
            Boolean connectivity = con.connectivity();

            if (connectivity)
            {
                geolocation = geo.GetGeoLocation(Context);
                CreatetaskService();
            }
            else
            {
                // db.InsertCreateTaskData(taskname, taskdescri, deadline,"mobile",markto,"no",listmapping2);
                Android.App.AlertDialog.Builder alertDiag = new Android.App.AlertDialog.Builder(Activity);
                alertDiag.SetTitle("You don't have Internet connection. Check your connection or Save Task for Later");
                alertDiag.SetMessage("press Ok to continue");
                alertDiag.SetPositiveButton("Save", (senderAlert, args) =>
                {
                    //markingtaskforlaterAsync();
                    db.InsertCreateTaskData(taskname, taskdescri, deadline, "mobile", markto, "unassign", listmapping2, CreateTaskFrag.modelsaddcompliance);
                    Toast.MakeText(Activity, "Task have been saved successfully. To assign Task manually sync the data. ", ToastLength.Long).Show();
                });
                alertDiag.SetNegativeButton("Cancel", (senderAlert, args) =>
                {
                    alertDiag.Dispose();
                });
                Android.App.Dialog diag = alertDiag.Create();
                diag.Show();

                tasknametext.Text    = null;
                taskdescription.Text = null;

                deadlinetext.Text = null;
                markedontext.Text = null;

                designationtext.Text = null;
                nametext.Text        = null;

                Toast.MakeText(Activity, "No Internet Connection. Data has been saved locally.", ToastLength.Long).Show();
            }
        }
        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);
        }
Пример #11
0
        public async override void OnActivityResult(int requestCode, int resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (requestCode == Camera && resultCode == (int)Android.App.Result.Ok)
            {
                Bitmap bitmap;

                //Converstion Image Size
                int height = Resources.DisplayMetrics.HeightPixels;
                int width  = Resources.DisplayMetrics.WidthPixels;
                using (bitmap = fileImagePath.Path.LoadAndResizeBitmap(width / 4, height / 4))
                {
                }
                long   size1   = fileImagePath.Length() / 1024;
                string imgsize = size1.ToString();

                Comp_AttachmentModel attachmentModel = new Comp_AttachmentModel();
                attachmentModel.localPath   = imageURL;
                attachmentModel.file_type   = "Image";
                attachmentModel.FileName    = imageName;
                attachmentModel.taskId      = task_id_to_send;
                attachmentModel.GeoLocation = geolocation;
                attachmentModel.FileSize    = imgsize;
                attachmentModel.file_format = ".jpg";
                //attachmentModel.max_numbers = image_max.ToString();



                Android.App.AlertDialog.Builder alertDiag = new Android.App.AlertDialog.Builder(Activity);
                alertDiag.SetTitle("Upload Compliance");
                alertDiag.SetMessage("press upload to continue");
                alertDiag.SetPositiveButton("Upload", (senderAlert, args) =>
                {
                    db.InsertAttachmentData(attachmentModel, "no");
                    image_comp_lst.AddRange(db.GetAttachmentData(imageName));

                    adapter1          = new GridViewAdapter_Image(Activity, image_comp_lst, FragmentManager);
                    Gridview1.Adapter = adapter1;

                    if (ic.connectivity())
                    {
                        postattachmentcomplianceAsync(attachmentModel);
                        //db.updateComplianceattachmentstatus("yes");
                        //uploadcountimage++;
                        //uploadimage.Text = uploaded;
                    }
                });
                alertDiag.SetNegativeButton("Cancel", (senderAlert, args) =>
                {
                    alertDiag.Dispose();
                });
                Dialog diag = alertDiag.Create();
                diag.Show();
            }
            if (requestCode == Video && resultCode == (int)Android.App.Result.Ok)
            {
                long   size2     = fileVideoPath.Length() / 1024;
                string videosize = size2.ToString();

                Comp_AttachmentModel attachmentModel = new Comp_AttachmentModel();
                attachmentModel.localPath   = videoURL;
                attachmentModel.file_type   = "Video";
                attachmentModel.FileName    = videoName;
                attachmentModel.taskId      = task_id_to_send;
                attachmentModel.GeoLocation = geolocation;
                attachmentModel.FileSize    = videosize;
                attachmentModel.file_format = ".mp4";
                //attachmentModel.max_numbers = video_max.ToString();

                db.InsertAttachmentData(attachmentModel, "no");

                //comp_AttachmentModels.Add(attachmentModel);


                //imagelist.AddRange(comp_AttachmentModels.Where(p => p.Attachment_Type == "Image" ));
                video_comp_lst.AddRange(db.GetAttachmentData(videoName));
                // postattachmentcomplianceAsync(attachmentModel);
                adapter2          = new GridViewAdapter_Video(Activity, video_comp_lst, FragmentManager);
                Gridview2.Adapter = adapter2;

                if (ic.connectivity())
                {
                    postattachmentcomplianceAsync(attachmentModel);
                    //db.updateComplianceattachmentstatus("yes");
                    //uploadcountvideo++;
                    //uploadvideo.Text = uploaded;
                }
            }

            if (requestCode == VOICE && resultCode == (int)Android.App.Result.Ok)
            {
                var matches = data.GetStringArrayListExtra(RecognizerIntent.ExtraResults);
                if (matches.Count != 0)
                {
                    string textInput = Description.Text + matches[0];

                    // limit the output to 500 characters
                    if (textInput.Length > 500)
                    {
                        textInput = textInput.Substring(0, 500);
                    }
                    Description.Text = textInput;
                }
                else
                {
                    Description.Text = "No speech was recognised";
                }
            }

            uploadimage.Text = image_comp_lst.Count.ToString();
            uploadaudio.Text = audio_comp_lst.Count.ToString();
            uploadvideo.Text = video_comp_lst.Count.ToString();
        }
Пример #12
0
        public async Task getData()
        {
            if (ic.connectivity())
            {
                progress = new Android.App.ProgressDialog(Activity);
                progress.Indeterminate = true;
                progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                progress.SetCancelable(false);
                progress.SetMessage("Please wait...");
                progress.Show();
                dynamic value = new ExpandoObject();
                value.task_id = task_id_to_send;

                string json = JsonConvert.SerializeObject(value);
                try
                {
                    JsonValue item = await restService.GetComplianceTask(Activity, json, geolocation);

                    comp         = JsonConvert.DeserializeObject <ComplianceModel>(item);
                    taskuploaded = comp.lstUploadedCompliance;
                    db.complianceoutbox_insert(comp);
                }
                catch (Exception ex)
                {
                    progress.Dismiss();
                }
            }
            else
            {
                datacomp = db.GetCompliance_for_outbox(task_id_to_send);
                db.insertuploadedtask_for_outbox(comp.lstUploadedCompliance);
                taskuploaded = db.gettaskuploaded(task_id_to_send);
                // taskuploaded = comp.lstUploadedCompliance;

                db.insertCommunicationdetail(comp.lstCommunication, task_id_to_send);
                List <CommunicationModel> lstCommunication = db.GetCommunicationModels(task_id_to_send);
            }
            //if (datacomp.Count == 0)
            //{
            //    Toast.MakeText(Activity, "Please connect to the Internet.", ToastLength.Long).Show();
            //}
            //else
            //{


            //}
            // List<CommunicationModel> lstCommunication = comp.lstCommunication;

            if (taskuploaded != null)
            {
                for (int i = 0; i < taskuploaded.Count; i++)
                {
                    if (taskuploaded[i].file_type.Equals("Image"))
                    {
                        imagelistoutbox.Add(taskuploaded[i]);
                    }
                    else if (taskuploaded[i].file_type.Equals("Video"))
                    {
                        videolistoutbox.Add(taskuploaded[i]);
                    }
                    else if (taskuploaded[i].file_type.Equals("Audio"))
                    {
                        audiolistoutbox.Add(taskuploaded[i]);
                    }
                }

                for (int i = 0; i < taskuploaded.Count; i++)
                {
                    filetype    = taskuploaded[i].file_type;
                    filename    = taskuploaded[i].FileName;
                    file_format = taskuploaded[i].file_format;
                    path        = taskuploaded[i].Path;
                    geolocation = taskuploaded[i].GeoLocation;
                    filesize    = taskuploaded[i].FileSize;
                    if (filetype == "Image")
                    {
                        gridimagecomp     = new GridImagecomplianceoutbox(Activity, imagelistoutbox, FragmentManager);
                        imagegrid.Adapter = gridimagecomp;
                        imagegrid.setExpanded(true);
                    }
                    if (filetype == "Video")
                    {
                        gridvideocomp         = new GridVideocomplianceoutbox(Activity, videolistoutbox, FragmentManager);
                        videolistview.Adapter = gridvideocomp;
                        videolistview.setExpanded(true);
                    }
                    if (filetype == "Audio")
                    {
                        gridaudiocomp         = new GridAudiocomplianceOutbox(Activity, audiolistoutbox, FragmentManager);
                        audiolistview.Adapter = gridaudiocomp;
                        audiolistview.setExpanded(true);
                    }
                }

                //task_id = comp.task_id;
                //task_description = comp.description;
                //deadline = comp.deadline_date;
                //meatingid = comp.Meeting_ID;
                //rownum = comp.RowNo;
                ////taskcreationDate = comp.task_creation_date;
                //markby = comp.task_mark_by;
                //taskstatus = comp.taskStatus;
                //markto = comp.markTo;
                //markingtype = comp.task_marking_type;
                //taskcreatedby = comp.task_created_by;
                //markingDate = comp.MarkingDate;
                //creationdate = comp.task_creation_date;
                //shapes_from_Comp = comp.shapes;
                //task_name = comp.task_name;


                progress.Dismiss();
            }

            settingValues();

            for (int i = 0; i <= taskuploaded.Count; i++)
            {
                max_num     = comp.lstUploadedCompliance[i].max_numbers;
                file_format = comp.lstUploadedCompliance[i].file_format;
                filetype    = comp.lstUploadedCompliance[i].file_type;
                //  taskoverview = comp.lstUploadedCompliance[i].task_overview;
                //uploaded = comp.lstUploadedCompliance[i].Uploaded;

                if (filetype.Equals("Image"))
                {
                    image_max = Convert.ToInt32(max_num);
                }
                else if (filetype.Equals("Video"))
                {
                    video_max = Convert.ToInt32(max_num);
                }
                else if (filetype.Equals("Audio"))
                {
                    audio_max = Convert.ToInt32(max_num);
                }
                //Image_no.Text = image_max.ToString();
                //Video_no.Text = video_max.ToString();
                //Audio_no.Text = audio_max.ToString();
            }
        }
Пример #13
0
        //public override bool OnCreateOptionsMenu(IMenu menu)
        //{
        //    MenuInflater.Inflate(Resource.Menu.menu_main, menu);
        //    return true;
        //}
        public async Task ManualSyncData()
        {
            if (ic.connectivity())
            {
                try
                {
                    progress = new ProgressDialog(this);
                    progress.Indeterminate = true;
                    progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                    progress.SetCancelable(false);
                    progress.SetMessage("Please wait...");
                    progress.Show();
                    List <CreateTaskModel> dataList = db.getCreateTaskData("no");
                    if (dataList != null && dataList.Count > 0)
                    {
                        long id;
                        foreach (var val in dataList)
                        {
                            id = val.Id;
                            CreateTaskModel model = new CreateTaskModel();
                            model.taskname           = val.taskname;
                            model.taskdescrip        = val.taskdescrip;
                            model.deadline           = val.deadline;
                            model.through            = val.through;
                            model.markto             = val.markto;
                            model.lstTaskFileMapping = val.lstTaskFileMapping;
                            string json = JsonConvert.SerializeObject(model);

                            try
                            {
                                string item = await restService.CreateTaskMethod(this, json, location);

                                if (item.Contains("Success"))
                                {
                                    //db.InsertCreateTaskData(taskname, taskdescri, deadline, "mobile", markto, "yes");
                                    //Toast.MakeText(Activity, "Task Assign Successfully..", ToastLength.Long).Show();
                                    Toast.MakeText(this, "Oops! something went wrong. Please try again later.", ToastLength.Long).Show();
                                    progress.Dismiss();
                                }
                                else
                                {
                                    //db.InsertCreateTaskData(taskname, taskdescri, deadline, "mobile", markto, "yes");
                                    Toast.MakeText(this, "Data Synced", ToastLength.Long).Show();
                                    db.updatetaskstatus(id);
                                    //Toast.MakeText(Activity, "Oops! something went wrong. Please try again later.", ToastLength.Long).Show();
                                    progress.Dismiss();
                                }
                            }
                            catch (Exception ex)
                            {
                                progress.Dismiss();
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    progress.Dismiss();
                }
                progress.Dismiss();
            }
            progress.Dismiss();
        }
Пример #14
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = View;

            view        = inflater.Inflate(Resource.Layout.marking, container, false);
            restService = new ServiceHelper();
            con         = new InternetConnection();
            geo         = new Geolocation();
            db          = new DbHelper();
            prefs       = PreferenceManager.GetDefaultSharedPreferences(Activity);


            list   = view.FindViewById <ListView>(Resource.Id.listView1);
            audio  = view.FindViewById <ImageView>(Resource.Id.imageView1);
            search = view.FindViewById <SearchView>(Resource.Id.searchview);


            search.QueryTextChange += sv_QueryTextChange;
            location = geo.GetGeoLocation(Context);

            markinglist = new List <MarkingListModel>();

            list.ItemClick += ListItemSelected;
            Boolean connectivity = con.connectivity();

            if (connectivity)
            {
                getData();
            }
            else
            {
                markinglist = db.GetMarkingList();
                if (markinglist.Count != 0)
                {
                    marked = new MarkingListAdapter(Activity, markinglist);
                    list.SetAdapter(marked);
                }
                else
                {
                    Toast.MakeText(Activity, "Couldn't find data for marking. Please connect to the internet", ToastLength.Long).Show();
                }
            }

            string rec = Android.Content.PM.PackageManager.FeatureMicrophone;

            if (rec != "android.hardware.microphone")
            {
                // no microphone, no recording. Disable the button and output an alert
                var alert = new Android.App.AlertDialog.Builder(audio.Context);
                alert.SetTitle("You don't seem to have a microphone to record with");
                alert.SetPositiveButton("OK", (sender, e) =>
                {
                    //task_name.Text = "No microphone present";
                    audio.Enabled = false;

                    return;
                });

                alert.Show();
            }
            else
            {
                audio.Click += delegate
                {
                    // change the text on the button

                    isRecording = !isRecording;
                    if (isRecording)
                    {
                        // create the intent and start the activity
                        var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
                        voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm);

                        // put a message on the modal dialog
                        voiceIntent.PutExtra(RecognizerIntent.ExtraPrompt, Android.App.Application.Context.GetString(Resource.String.messageSpeakNow));

                        // if there is more then 1.5s of silence, consider the speech over
                        voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 1500);
                        voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1500);
                        voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 15000);
                        voiceIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1);

                        // you can specify other languages recognised here, for example
                        // voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.German);
                        // if you wish it to recognise the default Locale language and German
                        // if you do use another locale, regional dialects may not be recognised very well

                        voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default);
                        StartActivityForResult(voiceIntent, VOICE);
                    }
                };
            }
            return(view);
        }
Пример #15
0
        public async Task getData()
        {
            Boolean connectivity = con.connectivity();

            if (connectivity)
            {
                progress = new Android.App.ProgressDialog(Activity);
                progress.Indeterminate = true;
                progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                progress.SetCancelable(false);
                progress.SetMessage("Please wait...");
                progress.Show();
                dynamic value = new ExpandoObject();
                value.UserId = u_id;

                string json = JsonConvert.SerializeObject(value);
                try
                {
                    JsonValue item = await restService.TaskInbox(Activity, json, geolocation);

                    freq = JsonConvert.DeserializeObject <List <TaskInboxModel> >(item);
                    dbHelper.insertdatainbox(freq);
                    progress.Dismiss();

                    //if (freq.Count != 0)
                    //{
                    //    recyclerview_layoutmanger = new LinearLayoutManager(Activity, LinearLayoutManager.Vertical, false);
                    //    recyclerview.SetLayoutManager(recyclerview_layoutmanger);
                    //    recyclerview_adapter = new TaskInboxAdapter(Activity, freq, recyclerview, FragmentManager);
                    //    recyclerview.SetAdapter(recyclerview_adapter);
                    //}

                    //else
                    //{
                    //    LayoutParams lparams = new LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent);
                    //    TextView textView = new TextView(Activity);
                    //    textView.LayoutParameters = lparams;
                    //    lparams.Gravity = GravityFlags.Center;
                    //    textView.Text = "Oops ! You haven't assigned any task yet";
                    //    linearLayout.AddView(textView);
                    //}
                    //progress.Dismiss();
                }
                catch (Exception ex)
                {
                    progress.Dismiss();
                }
            }
            taskdata = dbHelper.GetTaskInbox();
            if (taskdata.Count != 0)
            {
                recyclerview_layoutmanger = new LinearLayoutManager(Activity, LinearLayoutManager.Vertical, false);
                recyclerview.SetLayoutManager(recyclerview_layoutmanger);
                recyclerview_adapter = new TaskInboxAdapter(Activity, taskdata, recyclerview, FragmentManager);
                recyclerview.SetAdapter(recyclerview_adapter);
            }

            else
            {
                LayoutParams lparams  = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
                TextView     textView = new TextView(Activity);
                textView.LayoutParameters = lparams;
                textView.Text             = "Oops ! You haven't assigned any task yet";
                linearLayout.AddView(textView);
            }
        }