Ejemplo n.º 1
0
        private void Save_Address1()
        {
            ConHousing.AddHousing(Intent.GetStringExtra("address_id").ToString(), spnbuilding.SelectedItem.ToString(), spnwall.SelectedItem.ToString(), spnroof.SelectedItem.ToString(), spnlight.SelectedItem.ToString(), spndrink.SelectedItem.ToString(), spncook.SelectedItem.ToString(), spntenure.SelectedItem.ToString());
            var builder = new AlertDialog.Builder(this);

            builder.SetTitle("Census");
            builder.SetMessage("Updating Housing Question Successful");
            builder.SetPositiveButton("Ok", Save_success);
            builder.SetCancelable(false);
            builder.Show();
        }
Ejemplo n.º 2
0
        public async void ApiRSTlist()
        {
            var progressDialog = ProgressDialog.Show(this, "Please wait...", "Updating Data From Server...", true);

            try
            {
                var address = ConAddress.GetListArray1("select * from tblAddressList where sync='1'");
                foreach (var x in address)
                {
                    await(ApiConnection1.AddressId(GlobalVariables.GlobalUrl + "/addressid"));
                    await(ApiConnection1.Updatedata(GlobalVariables.GlobalUrl + "/address/" + GlobalVariables.GlobalUserid + "/" + x.province + "/" + x.city + "/" + x.barangay + "/" + x.building_no + "/" + x.fname + "/" + x.lname + "/" + x.contact));
                    var member = ConMember.GetListArray1("select * from tblmember where address_id='" + x.id + "'");
                    foreach (var m in member)
                    {
                        var ename = m.ename;
                        if (m.ename == "")
                        {
                            ename = "000";
                        }
                        await(ApiConnection1.Updatedata(GlobalVariables.GlobalUrl + "/member/" + GlobalVariables.GlobalAddressId + "/" + m.fname + "/" + m.mname + "/" + m.lname + "/" + ename + "/" + m.rhousehold + "/" + m.gender + "/" + m.birthday + "/" + m.birth_certificate + "/" + m.marital_status + "/" + m.religion + "/" + m.school_attendance + "/" + m.literacy + "/" + m.highest_grade + "/" + m.work_status + "/" + m.occupation + "/" + m.pwd));
                    }
                    var housing = ConHousing.GetListSingle("select * from tblHousing where address_id='" + x.id + "'");
                    await(ApiConnection1.Updatedata(GlobalVariables.GlobalUrl + "/housing/" + GlobalVariables.GlobalAddressId + "/" + housing.building + "/" + housing.roof + "/" + housing.wall + "/" + housing.light + "/" + housing.drink + "/" + housing.cooking + "/" + housing.tenure));

                    var death = ConDeath.GetListArray1("select * from tblDeath where address_id='" + x.id + "'");
                    foreach (var d in death)
                    {
                        await(ApiConnection1.Updatedata(GlobalVariables.GlobalUrl + "/death/" + GlobalVariables.GlobalAddressId + "/" + d.fname + "/" + d.lname + "/" + d.gender + "/" + d.age_death + "/" + d.register + "/" + d.birthcertificate));
                    }

                    //ConAddress.DeleteAddressQuery("delete from tblAddressList where id='"+ housing.address_id +"'");
                    //ConMember.DeleteMemberQuery("delete from tblmember where address_id='"+ housing.address_id +"'");
                    //ConHousing.DeleteHousingQuery("delete from tblHousing where address_id='"+ housing.address_id +"'");
                    //ConDeath.DeleteDeathQuery("delete from tblDeath where address_id='"+ housing.address_id +"'");

                    Toast.MakeText(this, "Saving Successful..", ToastLength.Long).Show();
                    refreshItems();
                }
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, "Unable To Update Data.\n" + ex.Message, ToastLength.Long).Show();
            }

            progressDialog.Cancel();
        }
Ejemplo n.º 3
0
        public override void OnBackPressed()
        {
            var member = ConMember.GetListSingle("select * from tblmember where address_id='" + Intent.GetStringExtra("address_id") + "'");
            var house  = ConHousing.GetListSingle("select * from tblHousing where address_id='" + Intent.GetStringExtra("address_id") + "'");

            if (member != null && house != null)
            {
                ConAddress.GetListupdate("update tblAddressList set status='Done' where id='" + Intent.GetStringExtra("address_id") + "'");
            }
            else
            {
                ConAddress.GetListupdate("update tblAddressList set status='Open' where id='" + Intent.GetStringExtra("address_id") + "'");
            }
            var intent = new Intent();

            intent.SetClass(this, typeof(ActAddress));
            StartActivity(intent);
        }
Ejemplo n.º 4
0
        private void Save_success(object sender, DialogClickEventArgs args)
        {
            var member = ConMember.GetListSingle("select * from tblmember where address_id='" + Intent.GetStringExtra("address_id") + "'");
            var house  = ConHousing.GetListSingle("select * from tblHousing where address_id='" + Intent.GetStringExtra("address_id") + "'");

            if (member != null && house != null)
            {
                ConAddress.GetListupdate("update tblAddressList set status='Done' where id='" + Intent.GetStringExtra("address_id") + "'");
            }
            else
            {
                ConAddress.GetListupdate("update tblAddressList set status='Open',sync='0' where id='" + Intent.GetStringExtra("address_id") + "'");
            }
            var intent = new Intent();

            intent.PutExtra("address_id", Intent.GetStringExtra("address_id"));
            intent.PutExtra("fulladdress", Intent.GetStringExtra("fulladdress"));
            intent.SetClass(this, typeof(ActAddress));
            StartActivity(intent);
        }
Ejemplo n.º 5
0
 private void btnAddaddress_Clicked(object sender, EventArgs e)
 {
     if (spnbuilding.SelectedItem.ToString() != "Select Building Type" && spnroof.SelectedItem.ToString() != "Select Roof Type" && spnwall.SelectedItem.ToString() != "Select Wall Type" && spnlight.SelectedItem.ToString() != "Select Source Of Light" && spndrink.SelectedItem.ToString() != "Select Source Of Drink" && spncook.SelectedItem.ToString() != "Select Use For Cooking" && spntenure.SelectedItem.ToString() != "Select Tenure Status")
     {
         var builder = new AlertDialog.Builder(this);
         builder.SetTitle("Census");
         var items = ConHousing.GetListSingle("select * from tblHousing where address_id='" + Intent.GetStringExtra("address_id") + "'");
         if (items == null)
         {
             builder.SetMessage("Are You Sure You Want To Save Housing Question?");
             builder.SetPositiveButton("Yes", Save_Address);
         }
         else
         {
             builder.SetMessage("Are You Sure You Want To Update Housing Question?");
             builder.SetPositiveButton("Yes", delegate
             {
                 tblHousing updatehousing = new tblHousing();
                 updatehousing.id         = items.id;
                 updatehousing.address_id = Intent.GetStringExtra("address_id");
                 updatehousing.building   = spnbuilding.SelectedItem.ToString();
                 updatehousing.roof       = spnroof.SelectedItem.ToString();
                 updatehousing.wall       = spnwall.SelectedItem.ToString();
                 updatehousing.light      = spnlight.SelectedItem.ToString();
                 updatehousing.drink      = spndrink.SelectedItem.ToString();
                 updatehousing.cooking    = spncook.SelectedItem.ToString();
                 updatehousing.tenure     = spntenure.SelectedItem.ToString();
                 ConHousing.UpdateHousing(updatehousing);
                 Save_Address1();
             });
         }
         builder.SetNegativeButton("Cancel", delegate { builder.Dispose(); });
         builder.Show();
     }
     else
     {
         Toast.MakeText(this, "Unable to continue.\n Please Complete The Field.", ToastLength.Long).Show();
     }
 }
Ejemplo n.º 6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.LayHousing);

            spnbuilding = FindViewById <Spinner> (Resource.Id.spnbuilding);
            spnroof     = FindViewById <Spinner> (Resource.Id.spnroof);
            spnwall     = FindViewById <Spinner> (Resource.Id.spnwall);
            spnlight    = FindViewById <Spinner> (Resource.Id.spnlight);
            spndrink    = FindViewById <Spinner> (Resource.Id.spndrink);
            spncook     = FindViewById <Spinner> (Resource.Id.spncook);
            spntenure   = FindViewById <Spinner> (Resource.Id.spntenure);

            btnAddaddress = FindViewById <Button> (Resource.Id.btnAddAddress);

            txtfulladdress = FindViewById <EditText> (Resource.Id.txtfulladdress);

            txtfulladdress.Text = Intent.GetStringExtra("fulladdress");

            btnAddaddress.Click += new EventHandler(btnAddaddress_Clicked);

            var adapterbuilding = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Building_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adapterbuilding.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spnbuilding.Adapter = adapterbuilding;

            var adapterroof = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Roof_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adapterroof.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spnroof.Adapter = adapterroof;

            var adpwall = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Wall_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adpwall.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spnwall.Adapter = adpwall;

            var adplight = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Light_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adplight.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spnlight.Adapter = adplight;

            var adpdrink = ArrayAdapter.CreateFromResource(
                this, Resource.Array.DRINK_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adpdrink.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spndrink.Adapter = adpdrink;

            var adpcook = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Cook_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adpcook.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spncook.Adapter = adpcook;

            var adptenure = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Tenure_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adptenure.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spntenure.Adapter = adptenure;


            string[] array;
            var      items = ConHousing.GetListSingle("select * from tblHousing where address_id='" + Intent.GetStringExtra("address_id") + "'");

            if (items != null)
            {
                array = Resources.GetStringArray(Resource.Array.Building_Spinner);
                fcnspinner(spnbuilding, array, items.building);
                array = Resources.GetStringArray(Resource.Array.Roof_Spinner);
                fcnspinner(spnroof, array, items.roof);
                array = Resources.GetStringArray(Resource.Array.Wall_Spinner);
                fcnspinner(spnwall, array, items.wall);
                array = Resources.GetStringArray(Resource.Array.Light_Spinner);
                fcnspinner(spnlight, array, items.light);
                array = Resources.GetStringArray(Resource.Array.DRINK_Spinner);
                fcnspinner(spndrink, array, items.drink);
                array = Resources.GetStringArray(Resource.Array.Cook_Spinner);
                fcnspinner(spncook, array, items.cooking);
                array = Resources.GetStringArray(Resource.Array.Tenure_Spinner);
                fcnspinner(spntenure, array, items.tenure);
            }
        }