Example #1
0
        internal static int RestoreDeletedTask(int id)
        {
            int i = -999;

            var db = new SQLiteConnection(dbPath);

            DeletedTask existingItem = db.Get <DeletedTask>(id);

            if (existingItem != null)
            {
                i = db.Delete <DeletedTask>(id);

                Task restoreTask = new Task();

                // restoreTask.Id = existingItem.Id;
                restoreTask.Title       = existingItem.Title;
                restoreTask.Description = existingItem.Description;
                restoreTask.Color       = existingItem.Color;
                restoreTask.Date_Time   = existingItem.Date_Time;

                i = Datas.InsertNewData(restoreTask, DateTime.Now);
            }

            return(i);
        }
Example #2
0
        internal static int DeleteRow(int v)
        {
            int i = -999;

            var db = new SQLiteConnection(dbPath);

            Task existingItem = db.Get <Task>(v);

            if (existingItem != null)
            {
                i = db.Delete <Task>(v);

                // HERE DELETING FROM CREATE TABLE AND INSERTING TO TRASH TABLE
                DeletedTask dt = new DeletedTask();

                dt.Id          = existingItem.Id;
                dt.Title       = existingItem.Title;
                dt.Description = existingItem.Description;
                dt.Color       = existingItem.Color;
                dt.Date_Time   = existingItem.Date_Time;

                Insert_DeletedData(dt);
            }
            db.Close();
            return(i);
        }
Example #3
0
        internal static int DeleteRow_DeletedTaskPermanent(int id)
        {
            int i = -999;

            var db = new SQLiteConnection(dbPath);

            DeletedTask existingItem = db.Get <DeletedTask>(id);

            if (existingItem != null)
            {
                i = db.Delete <DeletedTask>(id);
            }

            Console.WriteLine("..................   DETE TRASH RESULT" + i);

            db.Close();
            return(i);
        }
Example #4
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////

        internal static int Insert_DeletedData(DeletedTask deletedTask)
        {
            var db = new SQLiteConnection(dbPath);
            int i  = db.Insert(deletedTask);

            if (i == 0)
            {
                new UIKit.UIAlertView("Trash alert FAILED", "Trash Data insertion failed " + i, null, "OK", null).Show();
            }
            else
            {
                new UIKit.UIAlertView("Trash alert SUCCESS", "Trash Data insertion success " + i, null, "OK", null).Show();
            }

            db.Close();

            return(i);
        }
Example #5
0
        public static bool GetallDeletedTasks()
        {
            bool b = false;

            var db = new SQLiteConnection(dbPath);

            var task_delData = db.Table <DeletedTask>();

            if (task_delData != null)
            {
                Console.WriteLine("DELETED DATA FOUND");

                _deletedDataTasks.Clear();

                foreach (var s in task_delData)
                {
                    DeletedTask t = new DeletedTask();
                    t.Id          = s.Id;
                    t.Title       = s.Title;
                    t.Description = s.Description;
                    t.Color       = s.Color;
                    t.Date_Time   = s.Date_Time;

                    _deletedDataTasks.Add(t);

                    t = null;
                }

                b = true;
            }
            else
            {
                Console.WriteLine("NO DELETED DATA FOUND IN DATABASE");
                b = false;
            }

            db.Close();

            return(b);
        }