예제 #1
0
		public ECOdatabase ()
		{
			database = DependencyService.Get<ISqlite> ().GetConnection ();
//			database.DeleteAll<CartItem> ();
			//Create a CartItem table if there is no such table
			if (database.TableMappings.All(t => t.MappedType.Name != typeof(CartItem).Name)) {
				//Create cartitem table
				database.CreateTable<CartItem> ();
				database.Commit ();
			}

			if (database.TableMappings.All(t => t.MappedType.Name != typeof(BuyList).Name)) {
				//Create cartitem table
				database.CreateTable<BuyList> ();
				database.Commit ();
			}

			if (database.TableMappings.All(t => t.MappedType.Name != typeof(WoolworthsItem).Name)) {
				//Create cartitem table
				database.CreateTable<WoolworthsItem> ();
				database.Commit ();
			}

//			database.DeleteAll<BuyList>();

			if (GetWoolWorthsItemAll ().Count == 0) {
				WoolworthsItem item1 = new WoolworthsItem ("50375264", "Kleenex Tissues", 2.50);
				InsertItemToWoolWorthsItem (item1);
			}

		}
예제 #2
0
		private void Initialize(){
			LoggedIn = false;
			LoginToolBarIsShow = false;


			//reset
			var database = new ECOdatabase ();
			database.DeleteAllInBuyList ();
			database.DeleteAllInCart ();
			database.DeleteAllInWoolworthsItem ();

			string prefix = Device.OnPlatform("", "", "Images/");

//			database.DeleteAllInWoolworthsItem ();
			if (database.GetWoolWorthsItemAll ().Count == 0) {
				WoolworthsItem item1 = new WoolworthsItem ("50375264", "Kleenex Tissues", 2.50, prefix + "tissue.png");
				WoolworthsItem item2 = new WoolworthsItem ("4001686301562", "Haribo Goldbears", 1.35, prefix + "Haribo-Gold-Bears.png");
				WoolworthsItem item3 = new WoolworthsItem ("4947678649536", "Body Sheet", 2.80, prefix + "bodysheet.png");
				WoolworthsItem item4 = new WoolworthsItem ("9310055101432", "Crunchy Nut", 7.60, prefix + "crunchy_nut.jpg");
				WoolworthsItem item5 = new WoolworthsItem ("9310055537286", "Kellogg's Original", 8.20, prefix + "Kelloggs-Original.png");
				WoolworthsItem item6 = new WoolworthsItem ("9300675011037", "Coke Cola Diet", 3.20, prefix + "cocacola-diet.png");
				database.InsertItemToWoolWorthsItem (item1);
				database.InsertItemToWoolWorthsItem (item2);
				database.InsertItemToWoolWorthsItem (item3);
				database.InsertItemToWoolWorthsItem (item4);
				database.InsertItemToWoolWorthsItem (item5);
				database.InsertItemToWoolWorthsItem (item6);
			}
		}
예제 #3
0
		public int InsertItemToWoolWorthsItem(WoolworthsItem item){
			return database.Insert (item);

		}