Ejemplo n.º 1
0
        public void CollectCalendarEvents(ContentResolver contentResolver)
        {
            AddTitle("Calendar events");
            var calendarUri = CalendarContract.Events.ContentUri;
            var posixTime   = DateTime.SpecifyKind(new DateTime(1970, 1, 1), DateTimeKind.Utc);

            string[] eventsProjection =
            {
                CalendarContract.Events.InterfaceConsts.Title,
                CalendarContract.Events.InterfaceConsts.Dtstart
            };
            ICursor cur = contentResolver.Query(calendarUri, eventsProjection, null, null, null);

            cur.MoveToFirst();

            var events = new List <string>();

            while (cur.MoveToNext())
            {
                string title = cur.GetString(cur.GetColumnIndexOrThrow(CalendarContract.Events.InterfaceConsts.Title));
                string date  = cur.GetString(cur.GetColumnIndexOrThrow(CalendarContract.Events.InterfaceConsts.Dtstart));
                events.Add("Title: " + title + " .Date: " + posixTime.AddMilliseconds(double.Parse(date)).ToShortDateString());
            }
            AddTotalCount(events.Count);
        }
Ejemplo n.º 2
0
        public void selectMydata()
        {
            String selectStm = "Select * from " + TableName;
            //myresut.Count >0 ;

            ICursor myresut = myDBObj.RawQuery(selectStm, null);



            while (myresut.MoveToNext())
            {
                var Fname = myresut.GetString(myresut.GetColumnIndexOrThrow(ColumnFName));
                System.Console.WriteLine("The firstname from ColumnFName " + Fname);


                var Lname = myresut.GetString(myresut.GetColumnIndexOrThrow(ColumnLName));
                System.Console.WriteLine("The Lastname from ColumnLName " + Lname);


                var age = myresut.GetString(myresut.GetColumnIndexOrThrow(ColumnAge));
                System.Console.WriteLine(" The age from ColumnAge " + age);



                var email = myresut.GetString(myresut.GetColumnIndexOrThrow(ColumnEmail));
                System.Console.WriteLine(" Email from ColumnEmail " + email);

                var pass = myresut.GetInt(myresut.GetColumnIndexOrThrow(ColumnPassword));
                System.Console.WriteLine("ColumnPassword from ColumnPassword " + pass);
            }
        }
Ejemplo n.º 3
0
        public List <SMS> GetAllSMS(string folderName)
        {
            List <SMS> SMSList = new List <SMS>();
            SMS        SMS     = new SMS();

            Android.Net.Uri hh     = Android.Provider.Telephony.Sms.Inbox.ContentUri;
            ICursor         Cursor = ContentResolver.Query(hh, null, null, null, null);

            StartManagingCursor(Cursor);
            int TotalCount = Cursor.Count;

            if (Cursor.MoveToFirst())
            {
                do
                {
                    SMS = new SMS();
                    SMS.setId(Cursor.GetString(Cursor.GetColumnIndexOrThrow("_id")));
                    SMS.setAddress(Cursor.GetString(Cursor
                                                    .GetColumnIndexOrThrow("address")));
                    SMS.setMsg(Cursor.GetString(Cursor.GetColumnIndexOrThrow("body")));
                    SMS.setReadState(Cursor.GetString(Cursor.GetColumnIndex("read")));
                    SMS.setTime(Cursor.GetString(Cursor.GetColumnIndexOrThrow("date")));

                    SMSList.Add(SMS);
                } while (Cursor.MoveToNext());
            }

            return(SMSList);
        }
        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;
            }
        }
Ejemplo n.º 5
0
        private string GetAddress(string mmsId)
        {
            ContentResolver cr  = Application.Context.ContentResolver;
            Uri             uri = Uri.Parse("content://mms/" + mmsId + "/addr");

            string[] projection = new string[] { "type", "address" };
            string   selection  = "msg_id = " + mmsId;
            ICursor  cursor     = cr.Query(uri, projection, selection, null, null);

            string address = string.Empty;

            if (cursor != null)
            {
                if (cursor.Count > 0)
                {
                    while (cursor.MoveToNext())
                    {
                        int type = cursor.GetInt(cursor.GetColumnIndexOrThrow("type"));     //137은 from, 151은 to... 나중에 ENUM 으로 바꿔라 DEBUG!
                        if (type == 137)
                        {
                            address = cursor.GetString(cursor.GetColumnIndexOrThrow("address"));
                            break;
                        }
                    }
                }
                cursor.Close();
            }
            return(address);
        }
        //show data on screen
        public void SelectMydata()
        {
            String selectStm = "Select * from " + tableName;

            ICursor myresut = connectionObj.RawQuery(selectStm, null);


            //String selectStmwithId = "Select * from "+ tableName " where id="+id +"and name="+nameFiled;
            //myresut.Count >0


            while (myresut.MoveToNext())
            {
                var uId = myresut.GetString(myresut.GetColumnIndexOrThrow(userId));
                System.Console.WriteLine("ID from BD " + uId);

                var nameValue = myresut.GetString(myresut.GetColumnIndexOrThrow(nameFiled));
                System.Console.WriteLine("Name from BD " + nameValue);

                var Email = myresut.GetString(myresut.GetColumnIndexOrThrow(email));
                System.Console.WriteLine("Email from BD " + Email);


                var Contact = myresut.GetString(myresut.GetColumnIndexOrThrow(contact));
                System.Console.WriteLine("contact from BD " + contact);

                var Password = myresut.GetString(myresut.GetColumnIndexOrThrow(pass));
                System.Console.WriteLine("password from BD " + Password);
            }
        }
Ejemplo n.º 7
0
        public Boolean selectMydata(string N, string P, string T)
        {
            int     c         = 0;
            string  selectStm = "Select * from " + tableName + ";";
            ICursor myresut   = connectionObj.RawQuery(selectStm, null);



            //tring selectStmwithId = "Select * from "+ tableName " where id="+id +"and name="+nameFiled;
            // myresut.Count > 0;


            while (myresut.MoveToNext())
            {
                var nme = myresut.GetString(myresut.GetColumnIndexOrThrow(name));
                System.Console.WriteLine("Name from sD " + name);

                var email = myresut.GetString(myresut.GetColumnIndexOrThrow(topic));
                System.Console.WriteLine("Email from sD " + email);


                var age = myresut.GetString(myresut.GetColumnIndexOrThrow(news));
                System.Console.WriteLine("Age from BD " + age);
            }



            return(false);
        }
        public static long[] GetSongListByCursor(ICursor cursor)
        {
            if (cursor is null)
            {
                return(new long[0]);
            }
            var length = cursor.Count;
            var list   = new long[length];

            cursor.MoveToFirst();
            var colIndex = -1;

            try
            {
                colIndex = cursor.GetColumnIndexOrThrow(Playlists.Members.AudioId);
            }
            catch
            {
                colIndex = cursor.GetColumnIndexOrThrow(BaseColumns.Id);
            }

            for (var i = 0; i < length; i++)
            {
                list[i] = cursor.GetLong(colIndex);
                cursor.MoveToNext();
            }
            cursor.Close();
            return(list);
        }
Ejemplo n.º 9
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.favourite_mainactivity);
            vendor_id   = FindViewById <TextView>(Resource.Id.vendor_id_vendorList);
            vendor_name = FindViewById <TextView>(Resource.Id.vendor_name_list);
            contact     = FindViewById <TextView>(Resource.Id.contact);



            listView = FindViewById <ListView>(Resource.Id.favourite_list);
            myDB     = new DBHelper(this);
            ic       = myDB.favList();
            while (ic.MoveToNext())
            {
                var id      = ic.GetInt(ic.GetColumnIndexOrThrow("ven_id"));
                var name    = ic.GetString(ic.GetColumnIndexOrThrow("v_company_name"));
                var contact = ic.GetString(ic.GetColumnIndexOrThrow("v_contact_number"));
                favouriteList.Add(new UserObject_favourite(id, name, contact));
            }

            //myAdapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, myUsersList);
            myorderAdapter   = new Favourite_CustomAdapter(this, favouriteList);
            listView.Adapter = myorderAdapter;

            /*add.Click += delegate
             * {
             *  Intent newscreen = new Intent(this, typeof(Purchase));
             *  StartActivity(newscreen);
             * };*/
        }
Ejemplo n.º 10
0
        public string ValidateMember(string MobileNumber)
        {
            string Name = String.Empty;

            string[] columns = new string[] { ColumnID, ColumnMobileNumber, ColumnFirstName, ColumnLastName };

            using (ICursor cursor = _db.Query(TableName, columns, null, null, null, null, null))
            {
                while (cursor.MoveToNext())
                {
                    try
                    {
                        if (cursor.GetString(cursor.GetColumnIndexOrThrow(ColumnMobileNumber)).Contains(MobileNumber))
                        {
                            Name = cursor.GetString(cursor.GetColumnIndexOrThrow(ColumnFirstName)) + " " + cursor.GetString(cursor.GetColumnIndexOrThrow(ColumnLastName));
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            return(Name);
        }
Ejemplo n.º 11
0
        //select query forperson table
        public User Uservalue(string user_email)
        {
            var     selectQuery = "SELECT * FROM " + TableName + " WHERE " + ColumnEmail + " ='" + user_email + "'";
            ICursor c           = dbWritablObject.RawQuery(selectQuery, null);

            while (c.MoveToNext())
            {
                var nameInfo = c.GetString(c.GetColumnIndexOrThrow(ColumnName));
                System.Console.WriteLine("Value of name : " + nameInfo);

                var emailInfo = c.GetString(c.GetColumnIndexOrThrow(ColumnEmail));
                System.Console.WriteLine("Value of email : " + emailInfo);

                var ageInfo = c.GetInt(c.GetColumnIndexOrThrow(ColumnAge));

                var password1 = c.GetString(c.GetColumnIndexOrThrow(ColumnPassword));

                if (user_email.ToLower().Equals(emailInfo.ToLower()))
                {
                    User user = new User(nameInfo, emailInfo, ageInfo, password1);

                    c.Close();
                    return(user);
                }
            }
            return(null);
        }
Ejemplo n.º 12
0
        public void GetCalendar(ContentResolver contentResolver)
        {
            _collectData.Add("-------------Calendar event---------------");
            var calendarUri = CalendarContract.Events.ContentUri;
            var posixTime   = DateTime.SpecifyKind(new DateTime(1970, 1, 1), DateTimeKind.Utc);

            string[] eventsProjection =
            {
                CalendarContract.Events.InterfaceConsts.Title,
                CalendarContract.Events.InterfaceConsts.Dtstart,
                CalendarContract.Events.InterfaceConsts.Count
            };
            ICursor cur   = contentResolver.Query(calendarUri, eventsProjection, null, null, null);
            string  count = cur.GetString(cur.GetColumnIndexOrThrow(CalendarContract.Events.InterfaceConsts.Count));

            _collectData.Add($"Calendar {count}");

            var events = new List <string>();

            while (cur.MoveToNext())
            {
                string title = cur.GetString(cur.GetColumnIndexOrThrow(CalendarContract.Events.InterfaceConsts.Title));
                string date  = cur.GetString(cur.GetColumnIndexOrThrow(CalendarContract.Events.InterfaceConsts.Dtstart));
                events.Add("Title: " + title + " .Date: " + posixTime.AddMilliseconds(double.Parse(date)).ToShortDateString());
            }
            var result = events.Aggregate(new StringBuilder(), (sb, s) => sb.AppendLine(s)).ToString();

            _collectData.Add(result);
        }
Ejemplo n.º 13
0
        public static Reminder SelectReminder(Context context)
        {
            Reminder       reminder;
            SQLiteDatabase db = new DataStore(context).WritableDatabase;

            string[] columns  = new string[] { ColumnID, ColumnDate, ColumnTime, ColumnNote };
            string   datetime = DateTime.Now.ToString();

            string[] dt   = datetime.Split(' ');
            var      date = dt[0];
            var      tt   = dt[1].Split(':');
            var      time = tt[0] + ":" + tt[1] + " " + dt[2];


            using (ICursor cursor = db.Query(TableName, columns, ColumnDate + "=? AND " + ColumnTime + "=?", new string[] { date, time }, null, null, null))
            {
                if (cursor.MoveToNext())
                {
                    reminder = new Reminder
                    {
                        Id   = cursor.GetInt(cursor.GetColumnIndexOrThrow(ColumnID)),
                        Date = cursor.GetString(cursor.GetColumnIndexOrThrow(ColumnDate)),
                        Time = cursor.GetString(cursor.GetColumnIndexOrThrow(ColumnTime)),
                        Note = cursor.GetString(cursor.GetColumnIndexOrThrow(ColumnNote))
                    };
                }
                else
                {
                    reminder = null;
                }
            }
            return(reminder);
        }
        private SmsDatum GetSms(global::Android.Net.Uri uri)
        {
            SmsDatum smsDatum     = null;
            ICursor  queryResults = null;

            try
            {
                queryResults = Application.Context.ContentResolver.Query(uri, null, null, null, null);

                if (queryResults != null && queryResults.MoveToNext())
                {
                    string protocol = queryResults.GetString(queryResults.GetColumnIndex("protocol"));
                    var    type     = queryResults.GetInt(queryResults.GetColumnIndex("type"));

                    int sentMessageType;

                    // see the Backwards Compatibility article for more information
#if __ANDROID_19__
                    if (Build.VERSION.SdkInt >= BuildVersionCodes.Kitkat)
                    {
                        sentMessageType = (int)SmsMessageType.Sent;  // API level 19
                    }
                    else
#endif
                    {
                        sentMessageType = 2;
                    }

                    if (type != sentMessageType) //note:protocol is never coming in null for me
                    {
                        return(null);
                    }

                    string         toNumber   = queryResults.GetString(queryResults.GetColumnIndexOrThrow("address"));
                    long           unixTimeMS = queryResults.GetLong(queryResults.GetColumnIndexOrThrow("date"));
                    string         body       = queryResults.GetString(queryResults.GetColumnIndexOrThrow("body"));
                    DateTimeOffset timestamp  = DateTimeOffset.FromUnixTimeMilliseconds(unixTimeMS);

                    if (!string.IsNullOrWhiteSpace(body))
                    {
                        Contact contact   = SensusServiceHelper.GetContactAsync(toNumber).Result;
                        bool    isContact = contact != null;

                        smsDatum = new SmsDatum(timestamp, null, toNumber, body, true, isContact, contact?.Name, contact?.Email);
                    }
                }
            }
            finally
            {
                // always close cursor
                try
                {
                    queryResults.Close();
                }
                catch
                {
                }
            }
            return(smsDatum);
        }
Ejemplo n.º 15
0
        public override void BindView(View view, Context context, ICursor cursor)
        {
            if (cursor != null)
            {
                String   name     = cursor.GetString(cursor.GetColumnIndexOrThrow(Contacts.People.InterfaceConsts.DisplayName));
                TextView textView = view.FindViewById <TextView>(Resource.Id.textViewContactNameContactLayout);
                textView.Text = name;

                ImageButton btnCallContact = view.FindViewById <ImageButton>(Resource.Id.imageButtonCallContactLayout);
                if (btnCallContact != null)
                {
                    string id = cursor.GetString(cursor.GetColumnIndexOrThrow(Contacts.People.InterfaceConsts.Id));
                    btnCallContact.Click += CallContactMobile;
                    btnCallContact.Tag    = id;
                }

                ImageButton btnEditContact = view.FindViewById <ImageButton>(Resource.Id.imageButtonActivityContactLayout);
                if (btnEditContact != null)
                {
                    string phone = cursor.GetString(cursor.GetColumnIndexOrThrow(Contacts.People.InterfaceConsts.Number));
                    btnEditContact.Click += EditContactMobile;
                    btnEditContact.Tag    = phone;
                }
            }
        }
Ejemplo n.º 16
0
        private Media ReadFromMediaStore(Context context, Uri uri)
        {
            ICursor cursor = context.ContentResolver.Query(uri, null, null, null, "date_added DESC");
            Media   media  = null;

            if (cursor.MoveToNext())
            {
                int dataColumn      = cursor.GetColumnIndexOrThrow(MediaStore.Images.Media.InterfaceConsts.Data);
                int mimeTypeColumn  = cursor.GetColumnIndexOrThrow(MediaStore.Images.Media.InterfaceConsts.MimeType);
                int modifiedColumn  = cursor.GetColumnIndexOrThrow(MediaStore.Images.Media.InterfaceConsts.DateModified);
                int dateAddedColumn = cursor.GetColumnIndexOrThrow(MediaStore.Images.Media.InterfaceConsts.DateAdded);

                string filePath = cursor.GetString(dataColumn);
                string mimeType = cursor.GetString(mimeTypeColumn);

                var added    = cursor.GetLong(dateAddedColumn);
                var modified = cursor.GetLong(dateAddedColumn);

                media = new Media()
                {
                    File     = new File(filePath),
                    Type     = mimeType,
                    Modified = FromUnixTime(modified),
                    Added    = FromUnixTime(added),
                };
            }
            cursor.Close();
            return(media);
        }
Ejemplo n.º 17
0
        //for person table
        public bool selectAllUsers(string Email, string pwd)
        {
            bool isExist = false;

            string[] columns = new string[] { ColumnName, ColumnAge, ColumnEmail, ColumnPassword };

            ICursor cursor = dbWritablObject.Query(TableName, columns, null, null, null, null, null);

            while (cursor.MoveToNext())
            {
                var name = cursor.GetString(cursor.GetColumnIndexOrThrow(ColumnName));
                System.Console.WriteLine("Value of name : " + name);

                var age = cursor.GetInt(cursor.GetColumnIndexOrThrow(ColumnAge));
                System.Console.WriteLine("Value of age : " + age);

                var email = cursor.GetString(cursor.GetColumnIndexOrThrow(ColumnEmail));
                System.Console.WriteLine("Value of email : " + email);

                var password = cursor.GetString(cursor.GetColumnIndexOrThrow(ColumnPassword));
                System.Console.WriteLine("Value of password : " + password);

                if (email.ToLower().Equals(Email.ToLower()) && password.ToLower().Equals(pwd.ToLower()))
                {
                    isExist = true;
                }
            }

            return(isExist);
        }
Ejemplo n.º 18
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;
            }
        }
Ejemplo n.º 19
0
 private void login()
 {
     if (login_admin.Checked)
     {
         cursor = myDB.SelectMyAdmindata();
         cursor.MoveToFirst();
         var un   = cursor.GetString(cursor.GetColumnIndexOrThrow("adm_name"));
         var pswd = cursor.GetString(cursor.GetColumnIndexOrThrow("adm_password"));
         if (login_username.Text == un && login_passowrd.Text == pswd)
         {
             System.Console.WriteLine("Successfully logged in!!");
             Intent newscreen = new Intent(this, typeof(Activity));
             StartActivity(newscreen);
         }
         else
         {
             alert.SetTitle("Error!");
             alert.SetMessage("Wrong Username or Password...");
             alert.SetPositiveButton("Ok", alertOKButton);
             Android.App.AlertDialog myDialog = alert.Create();
             myDialog.Show();
         }
     }
     else
     {
         cursor = myDB.SelectSalesPersonData(login_username.Text);
         cursor.MoveToFirst();
         if (cursor == null)
         {
             alert.SetTitle("Error!");
             alert.SetMessage("This email id is not registered..");
             alert.SetPositiveButton("Ok", alertOKButton);
             Android.App.AlertDialog myDialog = alert.Create();
             myDialog.Show();
         }
         else
         {
             var un    = cursor.GetString(cursor.GetColumnIndexOrThrow("sp_email"));
             var pswd  = cursor.GetString(cursor.GetColumnIndexOrThrow("sp_password"));
             var fname = cursor.GetString(cursor.GetColumnIndexOrThrow("first_name"));
             var lname = cursor.GetString(cursor.GetColumnIndexOrThrow("last_name"));
             if (login_username.Text == un && login_passowrd.Text == pswd)
             {
                 System.Console.WriteLine("Successfully logged in!!");
                 Intent newscreen = new Intent(this, typeof(sales_person_dashboard));
                 newscreen.PutExtra("email", login_username.Text);
                 newscreen.PutExtra("salesPersonName", fname + " " + lname);
                 StartActivity(newscreen);
             }
             else
             {
                 alert.SetTitle("Error!");
                 alert.SetMessage("Wrong Username or Password...");
                 alert.SetPositiveButton("Ok", alertOKButton);
                 Android.App.AlertDialog myDialog = alert.Create();
                 myDialog.Show();
             }
         }
     }
 }
Ejemplo n.º 20
0
        //show reviews
        public List <string> GetReviews()
        {
            List <string> resultr = new List <string>();
            string        Query   = "select " + UserName + "," + Restname + "," + Review1 + " from " + RTableName + ";";

            System.Console.WriteLine("My SQL  select STM \n  \n" + Query);

            try
            {
                ICursor cursor = myDBObj.RawQuery(Query, new string[] { });

                while (cursor.MoveToNext())
                {
                    var uname = cursor.GetString(cursor.GetColumnIndexOrThrow(UserName));
                    var r     = cursor.GetString(cursor.GetColumnIndexOrThrow(Restname));
                    var rr    = cursor.GetString(cursor.GetColumnIndexOrThrow(Review1));
                    resultr.Add(uname);
                    resultr.Add(r);
                    resultr.Add(rr);
                }
            }
            catch (Exception e)
            {
                e.GetBaseException();
            }
            return(resultr);
        }
        //show data on screen
        public void SelectMydata()
        {
            String selectStm = "Select * from " + tableName;

            ICursor myresut = connectionObj.RawQuery(selectStm, null);


            //String selectStmwithId = "Select * from "+ tableName " where id="+id +"and name="+nameFiled;
            //myresut.Count >0


            while (myresut.MoveToNext())
            {
                var myId = myresut.GetInt(myresut.GetColumnIndexOrThrow(id));
                System.Console.WriteLine("ID from Database: " + myId);


                var nameValue = myresut.GetString(myresut.GetColumnIndexOrThrow(nameFiled));
                System.Console.WriteLine("Name from Database: " + nameValue);

                var emailValue = myresut.GetString(myresut.GetColumnIndexOrThrow(email));
                System.Console.WriteLine("Email from Database: " + emailValue);

                var ageValue = myresut.GetString(myresut.GetColumnIndexOrThrow(age));
                System.Console.WriteLine("Age from Database: " + ageValue);

                var passValue = myresut.GetString(myresut.GetColumnIndexOrThrow(pass));
                System.Console.WriteLine("Password from Database: " + passValue);
            }
        }
Ejemplo n.º 22
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            // Set our view from the "main" layout resource
            RequestWindowFeature(Android.Views.WindowFeatures.ActionBar);
            //enable navigation mode to support tab layout
            this.ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.favlist);
            //get data from database fro the list

            dbcn = new DBHelperclass(this);

            ICursor myresut1 = dbcn.selectmovienames();

            var nameValue1 = "";

            //get cursor values
            if (myresut1.Count > 0)
            {
                while (myresut1.MoveToNext())
                {
                    nameValue1 = myresut1.GetString(myresut1.GetColumnIndexOrThrow("names"));
                    System.Console.WriteLine("Name from Database: " + nameValue1);

                    movieArray.Add(nameValue1);
                }
            }
            //databse code ends here
            ICursor myresut2 = dbcn.selectwatchlaternames();

            var nameValue2 = "";

            //get cursor values
            if (myresut2.Count > 0)
            {
                while (myresut2.MoveToNext())
                {
                    nameValue2 = myresut2.GetString(myresut1.GetColumnIndexOrThrow("names"));
                    System.Console.WriteLine("Name from Database: " + nameValue2);

                    movieArray2.Add(nameValue2);
                }
            }
            //databse code ends here

            _fragmentsArray = new Fragment[]
            {
                new Fragment1(this, movieArray),
                new Fragment2(this, movieArray2),
            };


            AddTabToActionBar("Favorites");   //First Tab
            AddTabToActionBar("Watch Later"); //First Tab
        }
Ejemplo n.º 23
0
 private void showCategory()
 {
     myDB = new DBHelper(this);
     ic   = myDB.getCategory(cid);
     ic.MoveToFirst();
     editcat.Text = cid.ToString();
     editcat.Text = ic.GetString(ic.GetColumnIndexOrThrow("cat_id"));
     edit_id.Text = ic.GetString(ic.GetColumnIndexOrThrow("cat_name"));
     //gallery.SetImageResource(Convert.ToInt32(ic.GetString(ic.GetColumnIndexOrThrow("cat_img"))));
 }
Ejemplo n.º 24
0
        public void selectMyValues(string username, string password)
        {
            String sqlQuery = "Select * from " + TableName + " where " + ColumnName + "=" + "'" + username + "'" + " AND " + ColumnPassword + "=" + "'" + password + "';";

            System.Console.WriteLine("Select SQL " + sqlQuery);
            ICursor result = myDBObj.RawQuery(sqlQuery, null);

            if (result.Count > 0)
            {
                while (result.MoveToNext())
                {
                    var NamefromDB = result.GetString(result.GetColumnIndexOrThrow(ColumnName));
                    System.Console.WriteLine(" Value  Of Name  FROM DB  --> " + NamefromDB);

                    var EmailfromDB = result.GetString(result.GetColumnIndexOrThrow(ColumnEmail));
                    System.Console.WriteLine(" Value  Of Email  FROM DB --> " + EmailfromDB);

                    var PasswordfromDB = result.GetInt(result.GetColumnIndexOrThrow(ColumnPassword));
                    System.Console.WriteLine(" Value Of ID FROM DB --> " + PasswordfromDB);

                    Intent intent = new Intent(myContext, typeof(welcomescreen));
                    intent.PutExtra("name", NamefromDB);
                    intent.PutExtra("email", EmailfromDB);
                    myContext.StartActivity(intent);
                }
            }
            else
            {
                Android.App.AlertDialog.Builder alert2 = new Android.App.AlertDialog.Builder(myContext);
                alert2.SetTitle("Error");
                alert2.SetMessage("No user found try Signup!");
                alert2.SetPositiveButton("OK", (senderAlert, args) =>
                {
                });
                alert2.Create();
                alert2.Show();
            }

            /*while (result.MoveToNext())
             * {
             *
             *  var NamefromDB = result.GetString(result.GetColumnIndexOrThrow(ColumnName));
             *  System.Console.WriteLine(" Value  Of Name  FROM DB  --> " + NamefromDB);
             *
             *  var EmailfromDB = result.GetString(result.GetColumnIndexOrThrow(ColumnEmail));
             *  System.Console.WriteLine(" Value  Of Email  FROM DB --> " + EmailfromDB);
             *
             *  var PasswordfromDB = result.GetInt(result.GetColumnIndexOrThrow(ColumnPassword));
             *  System.Console.WriteLine(" Value Of ID FROM DB --> " + PasswordfromDB);
             *
             * }*/
        }
Ejemplo n.º 25
0
        private void PopulateFields()
        {
            if (this.rowId == null)
            {
                return;
            }

            ICursor note = this.dbHelper.FetchNote(this.rowId.LongValue());

            this.StartManagingCursor(note);
            this.titleText.SetText(note.GetString(note.GetColumnIndexOrThrow(NotesDbAdapter.KeyTitle)), TextView.BufferType.Normal);
            this.bodyText.SetText(note.GetString(note.GetColumnIndexOrThrow(NotesDbAdapter.KeyBody)), TextView.BufferType.Normal);
        }
Ejemplo n.º 26
0
        private void PopulateFields()
        {
            if (this.rowId == null)
            {
                return;
            }

            ICursor note = this.dbHelper.FetchCust(this.rowId.LongValue());

            this.StartManagingCursor(note);
            this.nameText.SetText(note.GetString(note.GetColumnIndexOrThrow(NamaadDbAdapter_note.KeyName)), TextView.BufferType.Normal);
            this.detailText.SetText(note.GetString(note.GetColumnIndexOrThrow(NamaadDbAdapter_note.KeyDetail)), TextView.BufferType.Normal);
        }
Ejemplo n.º 27
0
        // My Select data from table function
        public void selectMydata()
        {
            string  selectStm = string.Format("SELECT * FROM {0}", tableName);
            ICursor myResult  = connectionObj.RawQuery(selectStm, null);

            while (myResult.MoveToNext())
            {
                var myEmail = myResult.GetString(myResult.GetColumnIndexOrThrow(userEmail));
                System.Console.WriteLine("Email from DB: " + myEmail);

                var myName = myResult.GetString(myResult.GetColumnIndexOrThrow(userName));
                System.Console.WriteLine("Name from DB: " + myName);
            }
        }
Ejemplo n.º 28
0
        public ICursor Update(string userName, string passWord)
        {
            String  sqlQuery = "Select * from " + TableName + " where " + ColumnName + " = " + "'" + userName + "'" + " and " + ColumnPassword + " = " + "'" + passWord + "'" + ";";
            ICursor result   = myDBObj.RawQuery(sqlQuery, null);

            result.MoveToNext();


            var userDB  = result.GetString(result.GetColumnIndexOrThrow(ColumnName));
            var emailDB = result.GetString(result.GetColumnIndexOrThrow(ColumnEmail));
            var passDB  = result.GetString(result.GetColumnIndexOrThrow(ColumnPassword));
            var ageDB   = result.GetString(result.GetColumnIndexOrThrow(ColumnAge));

            return(result);
        }
Ejemplo n.º 29
0
        //get user details
        public string[] getUserDetails(string email_id)
        {
            string[] userDetails = new string[4];
            // userDetails[0] = "Girish";
            string  selectQuery = "SELECT * FROM Users WHERE email_id = '" + email_id + "'";
            ICursor myresult    = connectionObj.RawQuery(selectQuery, null);

            while (myresult.MoveToNext())
            {
                userDetails[0] = myresult.GetString(myresult.GetColumnIndexOrThrow("user_name"));
                userDetails[1] = myresult.GetString(myresult.GetColumnIndexOrThrow("email_id"));
                userDetails[2] = myresult.GetString(myresult.GetColumnIndexOrThrow("password"));
            }
            return(userDetails);
        }
Ejemplo n.º 30
0
        public static String getDataColumn(Context context, Android.Net.Uri uri, String selection, String[] selectionArgs)
        {
            ICursor cursor = null;
            String column = "_data";
            String[] projection =
            {
            column
            };

            try
            {
                cursor = context.ContentResolver.Query(uri, projection, selection, selectionArgs, null);
                if (cursor != null && cursor.MoveToFirst())
                {
                    int index = cursor.GetColumnIndexOrThrow(column);
                    return cursor.GetString(index);
                }
            }
            catch
            {

            }
            finally
            {
                if (cursor != null)
                    cursor.Close();
            }
            return null;
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Create an intent to start the WikiNoteEditor using the current title
 /// and body information (if any).
 /// </summary>
 public void EditNote(string mNoteName, ICursor cursor)
 {
     // This intent could use the android.intent.action.EDIT for a wiki note
     // to invoke, but instead I wanted to demonstrate the mechanism for invoking
     // an intent on a known class within the same application directly. Note
     // also that the title and body of the note to edit are passed in using the extras bundle.
     Intent i = new Intent(_context, typeof(WikiNoteEditor));
     i.PutExtra(WikiNote.Notes.TITLE, mNoteName);
     String body;
     if (cursor != null)
     {
         body = cursor.GetString(cursor.GetColumnIndexOrThrow(WikiNote.Notes.BODY));
     }
     else
     {
         body = string.Empty;
     }
     i.PutExtra(WikiNote.Notes.BODY, body);
     _context.StartActivityForResult(i, ACTIVITY_EDIT);
 }
 public void PopulateFrom(ICursor c)
 {
     var nameColumn = c.GetColumnIndexOrThrow(VehicleTable.Columns.VEHICLE);
     _textView.Text = c.GetString(nameColumn);
 }
Ejemplo n.º 33
0
 private int getNoteId(ICursor item)
 {
     return item.GetInt(item.GetColumnIndexOrThrow(Note.ID));
 }
Ejemplo n.º 34
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            this._noteView = FindViewById<TextView>(Resource.Id.noteview);
            AndroidUri localUri = Intent.Data;

            if ((localUri == null) && (bundle != null))
            {
                localUri = AndroidUri.Parse(bundle.GetString(KEY_URL));
            }

            if ((localUri == null) || (localUri.PathSegments.Count < 2))
            {
                localUri = AndroidUri.WithAppendedPath(WikiNote.Notes.ALL_NOTES_URI, Resources.GetString(Resource.String.start_page));
            }

            ICursor localCursor = ManagedQuery(localUri, WikiNote.WIKI_NOTES_PROJECTION, null, null, null);

            bool newNote = false;
            if ((localCursor == null) || (localCursor.Count == 0))
            {
                try
                {
                    // no matching wikinote, so create it
                    localUri = ContentResolver.Insert(localUri, null);
                    if (localUri == null)
                    {
                        Log.Error("WikiNotes", "Failed to insert new wikinote into " + Intent.Data);
                        Finish();
                        return;
                    }
                    // make sure that the new note was created successfully, and
                    // select it
                    localCursor = ManagedQuery(localUri, WikiNote.WIKI_NOTES_PROJECTION, null, null, null);
                    if ((localCursor == null) || (localCursor.Count == 0))
                    {
                        Log.Error("WikiNotes", "Failed to open new wikinote: " + Intent.Data);
                        Finish();
                        return;
                    }
                    newNote = true;
                }
                catch (Exception ex)
                {
                    Log.Error(WikiNote.LOG_TAG, ex.Message);
                }
            }

            _uri = localUri;
            _cursor = localCursor;
            localCursor.MoveToFirst();
            _helper = new WikiActivityHelper(this);

            // get the note name
            String noteName = _cursor.GetString(_cursor
                .GetColumnIndexOrThrow(WikiNote.Notes.TITLE));
            _noteName = noteName;

            // set the title to the name of the page
            Title = Resources.GetString(Resource.String.wiki_title, noteName);

            // If a new note was created, jump straight into editing it
            if (newNote)
            {
                _helper.EditNote(noteName, null);
            }

            // Set the menu shortcut keys to be default keys for the activity as well
            SetDefaultKeyMode(DefaultKey.Shortcut);
        }
Ejemplo n.º 35
0
 private string getNoteTitle(ICursor item)
 {
     return item.GetString(item.GetColumnIndexOrThrow(Note.TITLE));
 }
Ejemplo n.º 36
0
        // syncing based on updated local notes only
        protected void prepareSyncableNotes(ICursor localGuids)
        {
            remoteGuids = new List<string>();
            pushableNotes = new List<Note>();
            pullableNotes = new List<Note>();
            comparableNotes = new List<Note[]>();
            deleteableNotes = new List<Note>();
            conflictingNotes = new List<Note[]>();

            localGuids.MoveToFirst();
            do {
                Note note = NoteManager.getNoteByGuid(activity, localGuids.GetString(localGuids.GetColumnIndexOrThrow(Note.GUID)));

                if(!note.getTags().Contains("system:template")) // don't push templates TODO: find out what's wrong with this, if anything
                    pushableNotes.Add(note);
            } while (localGuids.MoveToNext());

            if(cancelled) {
                doCancel();
                return;
            }

            doSyncNotes();
        }