Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ViewItem);
            myDB = new DBHelperClass(this);

            lv1 = FindViewById <ListView>(Resource.Id.listView1);
            sv1 = FindViewById <SearchView>(Resource.Id.searchView1);

            emailPrint = Intent.GetStringExtra("username");

            // Custom Adaptor Editing
            ICursor cs = myDB.SelectIteme();

            if (cs.MoveToFirst())
            {
                do
                {
                    string image = cs.GetString(cs.GetColumnIndexOrThrow("item_sub"));
                    int    im    = Convert.ToInt32(image);
                    myUsersList.Add(new UserObject(cs.GetString(cs.GetColumnIndexOrThrow("item_name")), cs.GetString(cs.GetColumnIndexOrThrow("email")),
                                                   cs.GetString(cs.GetColumnIndexOrThrow("description")), im));
                }while (cs.MoveToNext());
                {
                }
                cs.Close();
                // custom adapton code added
                MyCustomAdapterList myAdapter = new MyCustomAdapterList(this, myUsersList);
                lv1.Adapter          = myAdapter;
                lv1.ItemClick       += Lv1_ItemClick;
                sv1.QueryTextChange += Sv1_QueryTextChange;
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ViewConfession);
            myDB = new DBHelperClass(this);

            list1 = FindViewById <ListView>(Resource.Id.listView2);
            sr1   = FindViewById <SearchView>(Resource.Id.searchView2);

            emailPrint = Intent.GetStringExtra("email");

            // Custom Adaptor Editing
            ICursor cs = myDB.SelectConfession();

            if (cs.MoveToFirst())
            {
                do
                {
                    string cfid = cs.GetString(cs.GetColumnIndexOrThrow("con_id"));
                    UsersList.Add(new ConfessionUserObj(cs.GetString(cs.GetColumnIndexOrThrow("my_confession")), cs.GetString(cs.GetColumnIndexOrThrow("Confession_date"))));
                }while (cs.MoveToNext());
                {
                }
                cs.Close();
                // custom adapton code added
                ConfessionAdapterList myAdapter = new ConfessionAdapterList(this, UsersList);
                list1.Adapter        = myAdapter;
                list1.ItemClick     += Lv1_ItemClick;
                sr1.QueryTextChange += Sv1_QueryTextChange;
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.registration);

            myDB              = new DBHelperClass(this);
            alert             = new Android.App.AlertDialog.Builder(this);
            reg_username      = FindViewById <EditText>(Resource.Id.reguserID);
            reg_email         = FindViewById <EditText>(Resource.Id.reguserEmail);
            reg_contact       = FindViewById <EditText>(Resource.Id.regContact);
            reg_passwd        = FindViewById <EditText>(Resource.Id.pswd);
            reg_confirmpasswd = FindViewById <EditText>(Resource.Id.ConfirmPswd);
            RegSignUpBtn      = FindViewById <Button>(Resource.Id.signupBtn);

            //auto generate id

            myid = FindViewById <TextView>(Resource.Id.user_id);
            cr   = myDB.SelectMyId();
            cr.MoveToFirst();
            myid.Text = (cr.GetInt(cr.GetColumnIndex("id")) + 1).ToString();
            reg_confirmpasswd.TextChanged += check_password;
            reg_email.TextChanged         += login;
            //email validation

            RegSignUpBtn.Click += delegate
            {
                var ruserName        = reg_username.Text;
                var rEmail           = reg_email.Text;
                var rContact         = reg_contact.Text;
                var rPassword        = reg_passwd.Text;
                var rConfirmPassword = reg_passwd.Text;

                if (ruserName.Trim().Equals("") || ruserName.Length < 0 || rEmail.Trim().Equals("") ||
                    rEmail.Length < 0 || rContact.Trim().Equals("") ||
                    rContact.Length < 0 || rPassword.Trim().Equals("") || rPassword.Length < 0 ||
                    rConfirmPassword.Trim().Equals("") || rConfirmPassword.Length < 0)
                {
                    alert.SetTitle("Error");
                    alert.SetMessage("Field can not be empty");
                    alert.SetPositiveButton("OK", alertOKButton);
                    alert.SetNegativeButton("Cancel", alertOKButton);
                    Dialog myDialog = alert.Create();
                    myDialog.Show();
                }

                else
                {
                    myDB.InsertValue(myid.Text, ruserName, rEmail, rContact, rPassword);

                    myDB.SelectMydata();

                    Intent newScreen = new Intent(this, typeof(MainActivity));
                    newScreen.PutExtra("userName", reg_username.Text);
                    StartActivity(newScreen);
                }
            };
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            DBHelperClass myDB = new DBHelperClass(this.Context);

            myDB.Selectcomplain();
            i = myDB.Selectcomplain();
            while (i.MoveToNext())
            {
                string a = i.GetString(i.GetColumnIndexOrThrow("complaint"));
                Console.WriteLine(a);
                rsname.Add(a);
            }
            View     myView = inflater.Inflate(Resource.Layout.FFragmentLayout, container, false);
            ListView myList = myView.FindViewById <ListView>(Resource.Id.listID);

            myView.FindViewById <TextView>(Resource.Id.myNameIdl).Text = myName;

            myList.Adapter = new ArrayAdapter(myContext, Android.Resource.Layout.SimpleListItem1, rsname);
            return(myView);
        }
Esempio n. 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.FavConfessionList);
            list2 = FindViewById <ListView>(Resource.Id.conlist);
            // l2 = FindViewById<ListView>(Resource.Id.conDate);
            valueFromLoginUser = GlobalClass.GetEmail();
            myDB = new DBHelperClass(this);

            cr = myDB.SelectFavConfession(valueFromLoginUser);
            cr.MoveToFirst();
            // mypid.Text = cr.GetString(cr.GetColumnIndexOrThrow("id"));
            while (cr.MoveToNext())
            {
                var a = cr.GetString(cr.GetColumnIndexOrThrow("fav_confession"));
                var b = cr.GetString(cr.GetColumnIndexOrThrow("Confessionfav_date"));
                UsersList.Add(new ConfessionUserObj(a, b));
            }

            // custom adapton code added
            myAdapters    = new ConfessionAdapterList(this, UsersList);
            list2.Adapter = myAdapters;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.WelcomeScreen);
            myDB = new DBHelperClass(this);

            valueFromLoginUser = GlobalClass.GetEmail();

            mytextcomp = FindViewById <TextView>(Resource.Id.mycomp);

            toolb = FindViewById <Toolbar>(Resource.Id.my_toolbar);

            SetSupportActionBar(toolb);
            spinnerView = FindViewById <Spinner>(Resource.Id.spinner1);

            spinnerView.Adapter = new ArrayAdapter
                                      (this, Android.Resource.Layout.SimpleListItem1, myCategory);

            //  valueFromLoginUser = Intent.GetStringExtra("userName");
            myUser      = FindViewById <TextView>(Resource.Id.welcomeuser);
            myUser.Text = "Welcome," + valueFromLoginUser;


            spinnerView.ItemSelected += MyItemSelectedMethod;

            InitializeTabs();

            _viewPager = FindViewById <ViewPager>(Resource.Id.viewpager);
            _viewPager.PageSelected += ViewPager_PageSelected;
            _viewPager.Adapter       = new ViewPagerAdapter(SupportFragmentManager, _fragments);

            _navigationView = FindViewById <BottomNavigationView>(Resource.Id.bottom_navigation);
            RemoveShiftMode(_navigationView);
            _navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.ComplaintBoxLayout);

            toolb = FindViewById <Toolbar>(Resource.Id.my_toolbar);

            SetSupportActionBar(toolb);
            spinnerView = FindViewById <Spinner>(Resource.Id.spinner1);

            spinnerView.Adapter = new ArrayAdapter
                                      (this, Android.Resource.Layout.SimpleListItem1, myCategory);

            valueFromLoginUser        = Intent.GetStringExtra("email");
            myUser                    = FindViewById <TextView>(Resource.Id.welcomeuser);
            myUser.Text               = "Welcome," + valueFromLoginUser;
            spinnerView.ItemSelected += MyItemSelectedMethod;

            // Create your application here
            myDB = new DBHelperClass(this);

            // user_email = Intent.GetStringExtra("email");
            myAddBtn       = FindViewById <Button>(Resource.Id.AddBtn);
            myEditBtn      = FindViewById <Button>(Resource.Id.EditBtn);
            myDelBtn       = FindViewById <Button>(Resource.Id.DelBtn);
            mycomplaintBtn = FindViewById <Button>(Resource.Id.sub_complainBtn);
            myComplaint    = FindViewById <EditText>(Resource.Id.usercomplaint);

            //complain_cr id
            myid        = FindViewById <TextView>(Resource.Id.complaint_id);
            complain_cr = myDB.SelectComplainMyId();
            complain_cr.MoveToFirst();
            myid.Text = (complain_cr.GetInt(complain_cr.GetColumnIndex("c_id")) + 1).ToString();


            //mycomplaintBtn.Text = "Submit";

            mycomplaintBtn.Click += delegate
            {
                if (mycomplaintBtn.Text.ToLower() == "submit")
                {
                    myDB.InsertmyComplaint(myid.Text, myComplaint.Text, user_email, DateTime.Now.ToShortDateString().ToString());
                }
                else if (mycomplaintBtn.Text.ToLower() == "update")
                {
                    myDB.SelectMyDataToUpdate(myid.Text, myComplaint.Text);
                }
                else if (mycomplaintBtn.Text.ToLower() == "delete")
                {
                    //myDB.SelectMyDataToUpdate(myid.Text, myComplaint.Text, DateTime.Now.ToShortDateString().ToString());
                    myDB.Delete_data(myid.Text);
                }
            };

            myEditBtn.Click += delegate
            {
                //name.Enabled = true;
                myComplaint.Enabled = true;
                mycomplaintBtn.Text = "Update";
            };
            myDelBtn.Click += delegate
            {
                myComplaint.Enabled = true;
                mycomplaintBtn.Text = "Delete";
            };
            myAddBtn.Click += delegate
            {
                myComplaint.Enabled = true;
                mycomplaintBtn.Text = "Submit";
                myComplaint.Text    = "";
                complain_cr         = myDB.SelectComplainMyId();
                complain_cr.MoveToFirst();
                myid.Text = (complain_cr.GetInt(complain_cr.GetColumnIndex("c_id")) + 1).ToString();
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.LostandFound);

            //toolbar
            toolb = FindViewById <Toolbar>(Resource.Id.my_toolbar);

            SetSupportActionBar(toolb);
            //main spinner
            spinnerView = FindViewById <Spinner>(Resource.Id.spinner1);

            spinnerView.Adapter = new ArrayAdapter
                                      (this, Android.Resource.Layout.SimpleListItem1, myCategory);

            valueFromLoginUser        = Intent.GetStringExtra("email");
            myUser                    = FindViewById <TextView>(Resource.Id.welcomeuser);
            myUser.Text               = "Welcome," + valueFromLoginUser;
            spinnerView.ItemSelected += MyItemSelectedMethod;


            //cat spinner
            spinnerView1 = FindViewById <Spinner>(Resource.Id.spinner2);

            spinnerView1.Adapter = new ArrayAdapter
                                       (this, Android.Resource.Layout.SimpleListItem1, Item_cat);

            spinnerView1.ItemSelected += MycatItemSelectedMethod;

            myDB       = new DBHelperClass(this);
            user_email = Intent.GetStringExtra("email");

            itemName   = FindViewById <EditText>(Resource.Id.item_Name);
            lost       = FindViewById <RadioButton>(Resource.Id.radioLost);
            found      = FindViewById <RadioButton>(Resource.Id.radioFound);
            item_loc   = FindViewById <EditText>(Resource.Id.location);
            item_des   = FindViewById <EditText>(Resource.Id.decs);
            btn_Submit = FindViewById <Button>(Resource.Id.submit);
            btn_editt  = FindViewById <Button>(Resource.Id.edit);
            btn_delete = FindViewById <Button>(Resource.Id.delete);

            //item_cr id
            itemid  = FindViewById <TextView>(Resource.Id.item_Idd);
            item_cr = myDB.SelectmyItemId();
            item_cr.MoveToFirst();
            itemid.Text = (item_cr.GetInt(item_cr.GetColumnIndex("item_ID")) + 1).ToString();


            btn_Submit.Click += delegate
            {
                if (lost.Checked)
                {
                    myDB.InsertmyLostFound(itemid.Text, itemName.Text, lost.Text, item_loc.Text, item_des.Text, image, user_email);
                }
                else
                {
                    myDB.InsertmyLostFound(itemid.Text, itemName.Text, found.Text, item_loc.Text, item_des.Text, image, user_email);
                }
            };
            btn_editt.Click += delegate
            {
                myDB.SelectMyItemToUpdate(itemid.Text, itemName.Text, found.Text, item_loc.Text, item_des.Text);
            };
            btn_delete.Click += delegate
            {
                myDB.Delete_myItem(itemid.Text);
            };
            btn_View = FindViewById <Button>(Resource.Id.view);

            btn_View.Click += delegate
            {
                Android.Content.Intent newScreen = new Intent(this, typeof(ViewItemsLF));
                newScreen.PutExtra("email", valueFromLoginUser);
                StartActivity(newScreen);
            };
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.User_Profile);

            toolb = FindViewById <Toolbar>(Resource.Id.my_toolbar);

            SetSupportActionBar(toolb);
            spinnerView = FindViewById <Spinner>(Resource.Id.spinner1);

            spinnerView.Adapter = new ArrayAdapter
                                      (this, Android.Resource.Layout.SimpleListItem1, myCategory);

            valueFromLoginUser = Intent.GetStringExtra("userName");
            myUser             = FindViewById <TextView>(Resource.Id.welcomeuser);
            myUser.Text        = "Welcome," + valueFromLoginUser;
            // this.Title = "welcome admin";
            spinnerView.ItemSelected += MyItemSelectedMethod;

            alert = new Android.App.AlertDialog.Builder(this);

            //edit buttons
            myDB = new DBHelperClass(this);
            //alert = new Android.App.AlertDialog.Builder(this);
            mypid          = FindViewById <TextView>(Resource.Id.user_id);
            _username      = FindViewById <EditText>(Resource.Id.userNamee);
            _email         = FindViewById <EditText>(Resource.Id.userEmail);
            _contact       = FindViewById <EditText>(Resource.Id.userContact);
            _passwd        = FindViewById <EditText>(Resource.Id.userpswd);
            _confirmpasswd = FindViewById <EditText>(Resource.Id.userConfirmPswd);
            SubmitBtn      = FindViewById <Button>(Resource.Id.usersubmit);

            //disable email
            _email.Enabled = false;
            mypid.Enabled  = false;
            p_cursor       = myDB.SelectProfile(valueFromLoginUser);
            p_cursor.MoveToFirst();
            mypid.Text     = p_cursor.GetString(p_cursor.GetColumnIndexOrThrow("id"));
            _username.Text = p_cursor.GetString(p_cursor.GetColumnIndexOrThrow("names"));
            _email.Text    = valueFromLoginUser;
            _contact.Text  = p_cursor.GetString(p_cursor.GetColumnIndexOrThrow("contact"));
            _passwd.Text   = p_cursor.GetString(p_cursor.GetColumnIndexOrThrow("password"));

            _confirmpasswd.TextChanged += check_password;

            SubmitBtn.Click += delegate
            {
                string value  = _username.Text;
                string value1 = _contact.Text;
                string value2 = _passwd.Text;
                string value3 = _confirmpasswd.Text;



                System.Console.WriteLine("Text Value ---- > " + value);
                //check for empty value
                if (value.Trim().Equals("") || value.Length < 0 || value1.Trim().Equals("") || value1.Length < 0 ||
                    value2.Trim().Equals("") || value2.Length < 0 || value3.Trim().Equals("") || value3.Length < 0)
                {
                    alert.SetTitle("Error");
                    alert.SetMessage("Please Enter Valid Data");
                    alert.SetPositiveButton("OK", alertOKButton);
                    alert.SetNegativeButton("Cancel", alertOKButton);
                    Dialog myDialog = alert.Create();
                    myDialog.Show();
                }
                else
                {
                    myDB.SelectMyProfileToUpdate(mypid.Text, _username.Text, _contact.Text, _passwd.Text);
                }
            };
        }
Esempio n. 10
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.MyConfessions);
            toolb = FindViewById <Toolbar>(Resource.Id.my_toolbar);
            SetSupportActionBar(toolb);
            spinnerv = FindViewById <Spinner>(Resource.Id.spinners);

            spinnerv.Adapter = new ArrayAdapter
                                   (this, Android.Resource.Layout.SimpleListItem1, myCategory);

            valueFromLoginUser     = Intent.GetStringExtra("email");
            myUser                 = FindViewById <TextView>(Resource.Id.welcomeuser);
            myUser.Text            = "Welcome," + valueFromLoginUser;
            spinnerv.ItemSelected += MyItemSelectedMethod;

            // Create your application here
            myDB         = new DBHelperClass(this);
            emailPrint   = Intent.GetStringExtra("email");
            user_email   = Intent.GetStringExtra("email");
            myAddBtn     = FindViewById <Button>(Resource.Id.AddConBtn);
            myEditBtn    = FindViewById <Button>(Resource.Id.EditConBtn);
            myDelBtn     = FindViewById <Button>(Resource.Id.DelConBtn);
            myconBtn     = FindViewById <Button>(Resource.Id.sub_conBtn);
            myconfession = FindViewById <EditText>(Resource.Id.userConfession);

            //complain_cr id
            mycid  = FindViewById <TextView>(Resource.Id.con_id);
            con_cr = myDB.SelectConfessionMyId();
            con_cr.MoveToFirst();
            mycid.Text = (con_cr.GetInt(con_cr.GetColumnIndex("con_id")) + 1).ToString();

            eye = FindViewById <ImageView>(Resource.Id.imageeye);

            //mycomplaintBtn.Text = "Submit";

            myconBtn.Click += delegate
            {
                if (myconBtn.Text.ToLower() == "submit")
                {
                    myDB.InsertmyConfession(mycid.Text, myconfession.Text, user_email, DateTime.Now.ToShortDateString().ToString());
                }
                else if (myconBtn.Text.ToLower() == "update")
                {
                    myDB.SelectMyConfessionToUpdate(mycid.Text, myconfession.Text);
                }
                else if (myconBtn.Text.ToLower() == "delete")
                {
                    myDB.Delete_condata(mycid.Text);
                }
            };

            myEditBtn.Click += delegate
            {
                //name.Enabled = true;
                myconfession.Enabled = true;
                myconBtn.Text        = "Update";
            };
            myDelBtn.Click += delegate
            {
                myconfession.Enabled = true;
                myconBtn.Text        = "Delete";
            };
            myAddBtn.Click += delegate
            {
                myconfession.Enabled = true;
                myconBtn.Text        = "Submit";
                myconfession.Text    = "";
                con_cr = myDB.SelectConfessionMyId();
                con_cr.MoveToFirst();
                mycid.Text = (con_cr.GetInt(con_cr.GetColumnIndex("con_id")) + 1).ToString();
            };
            eye.Click += delegate
            {
                Intent newScreen = new Intent(this, typeof(ViewConfessionList));
                newScreen.PutExtra("email", valueFromLoginUser);
                StartActivity(newScreen);
            };
        }
Esempio n. 11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            //fatching information from login page
            myUserName   = FindViewById <EditText>(Resource.Id.uname);
            myUserPasswd = FindViewById <EditText>(Resource.Id.userpassword);
            myLoginbtn   = FindViewById <Button>(Resource.Id.loginBtn);
            mySignupBtn  = FindViewById <Button>(Resource.Id.button1);

            alert = new Android.App.AlertDialog.Builder(this);
            myDB  = new DBHelperClass(this);

            //fatching information from signup page

            mySignupBtn.Click += delegate
            {
                Intent newScreen = new Intent(this, typeof(SignUp));
                StartActivity(newScreen);
            };
            myLoginbtn.Click += delegate
            {
                if (myUserName.Equals("") || myUserPasswd.Equals(""))
                {
                    alert.SetTitle("Error");
                    alert.SetMessage("Please Enter Valid Data");
                    alert.SetPositiveButton("OK", alertOKButton);
                    alert.SetNegativeButton("Cancel", alertOKButton);

                    Dialog myDialog = alert.Create();

                    myDialog.Show();
                }
                else
                {
                    var email      = myUserName.Text;
                    var myPassword = myUserPasswd.Text;

                    string userValue        = myUserName.Text.ToString();
                    var    showResult       = FindViewById <TextView>(Resource.Id.emailResult);
                    var    emailLoginResult = isValidEmail(userValue);

                    System.Console.WriteLine("Username: ---- > " + email);
                    System.Console.WriteLine("Password: ---- > " + myPassword);

                    //myUserName.Error = "Plase enter Email Id";

                    c_login = myDB.Validate_LogIn(myUserName.Text);
                    c_login.MoveToFirst();


                    var uname = c_login.GetString(c_login.GetColumnIndexOrThrow("email"));
                    var upass = c_login.GetString(c_login.GetColumnIndexOrThrow("password"));
                    if (uname == myUserName.Text && myUserPasswd.Text == upass)

                    {
                        Intent newScreen = new Intent(this, typeof(WelcomeScreen));
                        GlobalClass.Setemail(email);
                        StartActivity(newScreen);
                    }

                    else
                    {
                        alert.SetTitle("Error");
                        alert.SetMessage("Please Enter Valid Data");
                        alert.SetPositiveButton("OK", alertOKButton);
                        alert.SetNegativeButton("Cancel", alertOKButton);
                        Dialog myDialog = alert.Create();
                        myDialog.Show();
                    }
                }
            };
        }