Ejemplo n.º 1
0
        private void lvlist_ItemLongClick(object sender, AdapterView.ItemLongClickEventArgs e)
        {
            var item    = ((AdpAddressList)lvlist.Adapter).GetItemDetail(e.Position);
            var builder = new AlertDialog.Builder(this);

            builder.SetTitle("Census");
            builder.SetMessage(item.building_no + ", " + item.barangay + ", " + item.city + ", " + item.province);
            builder.SetPositiveButton("Edit", delegate {
                var intent = new Intent();
                intent.PutExtra("id", item.id.ToString());
                intent.SetClass(this, typeof(ActAddressEdit));
                StartActivity(intent);
            });
            builder.SetNegativeButton("Delete", delegate
            {
                var builderdel = new AlertDialog.Builder(this);
                builderdel.SetTitle("Census");
                builderdel.SetMessage("Are You Sure You Want To Delete Selected Address?\n" + item.building_no + ", " + item.barangay + ", " + item.city + ", " + item.province);
                builderdel.SetPositiveButton("Delete", delegate
                {
                    ConAddress.DeleteAddressList(item.id);
                    var builder1 = new AlertDialog.Builder(this);
                    builder1.SetTitle("Census");
                    builder1.SetTitle("Address Successfully Delete");
                    builder1.SetPositiveButton("Ok", delegate {
                        refreshItems();
                    });
                    builder1.Show();
                });
                builderdel.SetNegativeButton("Cancel", delegate { builderdel.Dispose(); });
                builderdel.Show();
            });
            builder.Show();
        }
Ejemplo n.º 2
0
        private void Save_Address(object sender, DialogClickEventArgs args)
        {
            tblAddressList updateaddress = new tblAddressList();

            updateaddress.id          = Convert.ToInt32(Intent.GetStringExtra("id"));
            updateaddress.province    = txtProvince.Text;
            updateaddress.city        = txtCity.Text;
            updateaddress.barangay    = txtBarangay.Text;
            updateaddress.building_no = txtNumber.Text;
            updateaddress.fname       = txtFname.Text;
            updateaddress.lname       = txtLname.Text;
            updateaddress.contact     = txtContact.Text;

            ConAddress.UpdateAddressList(updateaddress);

            var builder = new AlertDialog.Builder(this);

            builder.SetTitle("Census");
            builder.SetMessage("Updating Address Successful");
            builder.SetPositiveButton("Ok", delegate {
                var intent = new Intent();
                intent.SetClass(this, typeof(ActAddress));
                StartActivity(intent);
            });
            builder.Show();
        }
Ejemplo n.º 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.LayAddressAdd);


            txtProvince = FindViewById <EditText> (Resource.Id.txtProvince);
            txtCity     = FindViewById <EditText> (Resource.Id.txtCity);
            txtBarangay = FindViewById <EditText> (Resource.Id.txtBarangay);
            txtNumber   = FindViewById <EditText> (Resource.Id.txtBuilding_no);
            txtFname    = FindViewById <EditText> (Resource.Id.txtFname);
            txtLname    = FindViewById <EditText> (Resource.Id.txtLname);
            txtContact  = FindViewById <EditText> (Resource.Id.txtContact);

            lbladdresstitle      = FindViewById <TextView> (Resource.Id.lbladdresstitle);
            lbladdresstitle.Text = "UPDATE ADDRESS INFORMATION";
            btnAddaddress        = FindViewById <Button> (Resource.Id.btnAddAddress);
            btnAddaddress.Text   = "Update Address";
            btnAddaddress.Click += new EventHandler(btnAddaddress_Clicked);

            var items = ConAddress.GetListArray("select * from tblAddressList where id='" + Intent.GetStringExtra("id") + "'");

            txtProvince.Text = items.province;
            txtCity.Text     = items.city;
            txtBarangay.Text = items.barangay;
            txtNumber.Text   = items.building_no;
            txtFname.Text    = items.fname;
            txtLname.Text    = items.lname;
            txtContact.Text  = items.contact;
        }
Ejemplo n.º 4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.LayLogin);
            CopyExistingDB();
            var url = ConAddress.GetConnectionURL();

            GlobalVariables.GlobalUrl = url.url;
            txtuser = FindViewById <EditText> (Resource.Id.txtusername);
            txtpass = FindViewById <EditText> (Resource.Id.txtpassword);

            btnlogin        = FindViewById <Button>(Resource.Id.btnlogin);
            btnlogin.Click += new EventHandler(btnlogin_click);

            //var intent1 = new Intent ();
            //intent1.SetClass (this, typeof(ActMemberAdd));
            //StartActivity (intent1);

            var users = ConAddress.GetUser();

            if (users.username != "")
            {
                GlobalVariables.GlobalUserid = users.user_id;
                GlobalVariables.GlobalFname  = users.fname;
                GlobalVariables.GlobalLname  = users.lname;
                var intent = new Intent();
                intent.SetClass(this, typeof(ActAddress));
                Toast.MakeText(this, "Login Successfully\n" + users.fname + " " + users.lname + ".", ToastLength.Long).Show();
                StartActivity(intent);
            }
        }
Ejemplo n.º 5
0
        public static async Task <bool> UserLogin(string url)
        {
            bool result  = false;
            var  request = System.Net.WebRequest.Create(url) as HttpWebRequest;

            if (request != null)
            {
                request.Method = "GET";
                request.ServicePoint.Expect100Continue = false;
                request.Timeout     = 20000;
                request.ContentType = "application/json";
                using (WebResponse response = await request.GetResponseAsync())
                {
                    using (Stream stream = response.GetResponseStream())
                    {
                        string     x    = JsonObject.Load(stream).ToString();
                        JsonObject jObj = (JsonObject)JsonObject.Parse(x);
                        JsonArray  jArr = (JsonArray)jObj["result"];
                        foreach (var item in jArr)
                        {
                            tblUser user = new tblUser();
                            user.id       = 1;
                            user.user_id  = Convert.ToString((Int32)item ["number"]);
                            user.fname    = Convert.ToString((string)item ["fname"]);
                            user.lname    = Convert.ToString((string)item ["lname"]);
                            user.username = Convert.ToString((string)item ["user"]);
                            user.password = Convert.ToString((string)item ["password"]);
                            ConAddress.UpdateUser(user);
                        }
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.aspinnertest);

            var spinner = FindViewById <Spinner>(Resource.Id.spntest);

            _address = ConAddress.GetList("");
            var adapter = new CustomSpinnerAdapter(this, _address);

            spinner.Adapter       = adapter;
            spinner.ItemSelected += SpinnerItemSelected;
        }
Ejemplo n.º 7
0
        private void OkDialog_Clicked(object sender, DialogClickEventArgs args)
        {
            tblConnection connection = new tblConnection();
            var           dialog     = (AlertDialog)sender;
            var           txtnewurl  = (EditText)dialog.FindViewById(Resource.Id.txturl);

            connection.id  = 1;
            connection.url = txtnewurl.Text;
            ConAddress.UpdateConnectionURL(connection);
            var url = ConAddress.GetConnectionURL();

            GlobalVariables.GlobalUrl = url.url;
        }
Ejemplo n.º 8
0
        private void Save_Address(object sender, DialogClickEventArgs args)
        {
            ConAddress.AddAddressList(txtProvince.Text, txtCity.Text, txtBarangay.Text, txtNumber.Text, txtFname.Text, txtLname.Text, txtContact.Text, GlobalVariables.GlobalYear);

            var builder = new AlertDialog.Builder(this);

            builder.SetTitle("Census");
            builder.SetMessage("Saving Address Successful");
            builder.SetPositiveButton("Ok", delegate {
                var intent = new Intent();
                intent.SetClass(this, typeof(ActAddress));
                StartActivity(intent);
            });
            builder.Show();
        }
Ejemplo n.º 9
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.º 10
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.º 11
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.º 12
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            LinearLayout   view;
            tblAddressList item;
            CheckBox       chkbox;

            item = _items.ElementAt(position);

            view = (convertView
                    ?? _context.LayoutInflater.Inflate(Resource.Layout.LayAddressLists, parent, false)
                    ) as LinearLayout;

            view.FindViewById <TextView>(Resource.Id.lvladdress).Text  = item.building_no + ", " + item.barangay + ", " + item.city + ", " + item.province + ".";
            view.FindViewById <TextView>(Resource.Id.lvlfullname).Text = item.fname + " " + item.lname;
            view.FindViewById <TextView>(Resource.Id.lvlstatus).Text   = item.status;
            chkbox = view.FindViewById <CheckBox> (Resource.Id.checkBox1);
            if (item.status != "Done")
            {
                chkbox.Visibility = ViewStates.Invisible;
            }
            if (item.sync == "1")
            {
                chkbox.Checked = true;
            }
            chkbox.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) =>
            {
                if (e.IsChecked.Equals(true))
                {
                    ConAddress.GetListupdate("update tblAddressList set sync='1' where id='" + item.id + "'");
                }
                else
                {
                    ConAddress.GetListupdate("update tblAddressList set sync='0' where id='" + item.id + "'");
                }
            };

            return(view);
        }
Ejemplo n.º 13
0
        private async void btnlogin_click(object sender, EventArgs e)
        {
            var url = ConAddress.GetConnectionURL();

            GlobalVariables.GlobalUrl = url.url;

            if (txtuser.Text != "" && txtpass.Text != "")
            {
                var progressDialog = ProgressDialog.Show(this, "Please wait...", "Verifying Credentials...", true);
                try {
                    await(ApiConnection1.UserLogin(GlobalVariables.GlobalUrl + "/login/" + txtuser.Text + "/" + txtpass.Text));
                    var users = ConAddress.GetUser();
                    if (users.username != "")
                    {
                        GlobalVariables.GlobalUserid = users.user_id;
                        GlobalVariables.GlobalFname  = users.fname;
                        GlobalVariables.GlobalLname  = users.lname;
                        var intent = new Intent();
                        intent.SetClass(this, typeof(ActAddress));
                        Toast.MakeText(this, "Login Successfully\n" + users.fname + " " + users.lname + ".", ToastLength.Long).Show();
                        StartActivity(intent);
                    }
                    else
                    {
                        Toast.MakeText(this, "Login Failed\nIncorect UserName Or Password..", ToastLength.Long).Show();
                    }
                } catch (Exception ex) {
                    Toast.MakeText(this, "Unable To Connect To Server.\n" + ex.Message, ToastLength.Long).Show();
                }
                progressDialog.Cancel();
            }
            else
            {
                Toast.MakeText(this, "Unable To Login.\nPlease Complete Your Credential..", ToastLength.Long).Show();
            }
            txtpass.Text = "";
        }
Ejemplo n.º 14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.LayAddress);

            var menuButton = FindViewById(Resource.Id.menuHdrButton);

            menuButton.Click += (sender, e) => {
                leftdrawer();
            };

            var MenuUserName = FindViewById <TextView>(Resource.Id.MenuUserName);

            MenuUserName.Text = " " + GlobalVariables.GlobalFname + " " + GlobalVariables.GlobalLname;

            var MenuInterviewer = FindViewById(Resource.Id.MenuInterviewer);

            MenuInterviewer.Click += (sender, e) => { leftdrawer(); };

            var MenuLogout = FindViewById(Resource.Id.MenuLogout);

            MenuLogout.Click += (sender, e) =>
            {
                tblUser user = new tblUser();
                GlobalVariables.GlobalUserid = "";
                user.id       = 1;
                user.user_id  = "";
                user.username = "";
                user.password = "";
                user.fname    = "";
                user.lname    = "";
                ConAddress.UpdateUser(user);

                var intent = new Intent();
                intent.SetClass(this, typeof(ActLogin));
                StartActivity(intent);
            };

            lvlist                = FindViewById <ListView>(Resource.Id.lvlist);
            lvlist.ItemClick     += new System.EventHandler <AdapterView.ItemClickEventArgs>(lvlist_ItemClicked);
            lvlist.ItemLongClick += new     System.EventHandler <AdapterView.ItemLongClickEventArgs>(lvlist_ItemLongClick);


            txtsearch = FindViewById <EditText>(Resource.Id.txtsearch);
            txtsearch.AfterTextChanged += delegate
            {
                refreshItems();
            };

            btnSync        = FindViewById <Button> (Resource.Id.btnSync);
            btnSync.Click += delegate
            {
                ApiRSTlist();
            };

            btnAddaddress        = FindViewById <Button> (Resource.Id.btnAddaddress);
            btnAddaddress.Click += delegate {
                var intent = new Intent();
                intent.SetClass(this, typeof(ActAddressAdd));
                StartActivity(intent);
            };

            refreshItems();
        }
Ejemplo n.º 15
0
        public void refreshItems()
        {
            var items = ConAddress.GetList(txtsearch.Text);

            lvlist.Adapter = new AdpAddressList(this, items);
        }