Ejemplo n.º 1
0
 public int SaveSupplier(SupplierList item)
 {
     lock (locker)
     {
         if (item.ID != 0)
         {
             database.Update(item);
             return(item.ID);
         }
         else
         {
             return(database.Insert(item));
         }
     }
 }
Ejemplo n.º 2
0
        public ItemListPage()
        {
            InitializeComponent();



            //this.ToolbarItems.Add(new ToolbarItem { Text = "Add+" });

            App.Database.GetListofItemsListTest();
            itemlistview.ItemsSource = Data.ListofItemList;

            #region toolbar
            ToolbarItem tbi = null;
            if (Device.OS == TargetPlatform.iOS)
            {
                tbi = new ToolbarItem("Add", null, () =>
                {
                    var todoItem            = new SupplierList();
                    var todoPage            = new CreateListName();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }
            if (Device.OS == TargetPlatform.Android)
            {             // BUG: Android doesn't support the icon being null
                tbi = new ToolbarItem("Add", "plus", () =>
                {
                    var todoItem            = new SupplierList();
                    var todoPage            = new CreateListName();
                    todoPage.BindingContext = todoItem;
                    Navigation.PushAsync(todoPage);
                }, 0, 0);
            }

            ToolbarItems.Add(tbi);
            #endregion
            itemlistview.ItemSelected += (sender, e) =>
            {
                itemlistview.SelectedItem = null;
            };
        }
Ejemplo n.º 3
0
        //public IEnumerable<MyList> GetItems()
        //{
        //	lock (locker)
        //	{
        //		return (from i in database.Table<ItemsList>() select i).ToList();
        //	}
        //}

        //public IEnumerable<MyList> GetItemsNotDone(string opition)
        //{
        //	lock (locker)
        //	{
        //		return database.Query<MyList>("SELECT * FROM [MyList] WHERE [Done] = 0");
        //	}
        //}

        //public MyList GetItem(int id)
        //{
        //	lock (locker)
        //	{
        //		return database.Table<MyList>().FirstOrDefault(x => x.ID == id);
        //	}
        //}

        public int firstSaveSupplier(SupplierList item)
        {
            return(database.Insert(item));
        }