public CustomLayoutAdaptor(Activity context, ICursor cursor) : base(context, cursor) { this.context = context; this.cursor = cursor; this.DB = new ProductDBHelper(context); Filter = new ProductFilter(this, DB); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.CustomView, container, false); searchView = view.FindViewById <SearchView>(Resource.Id.searchView1); db = new ProductDBHelper(context); db.Open(); db1 = new DBHelper(context); db1.Open(); //db.InsertMovieInfo("Alladin", "Disney", "PG", Resource.Drawable.Alladin); // db.InsertMovieInfo("Boxtroll", "Disney", "PG", Resource.Drawable.Boxtroll); // db.InsertMovieInfo("goodDianosour", "Disney", "PG", Resource.Drawable.gooddianosour); // db.InsertMovieInfo("Zutopia", "Disney", "PG", Resource.Drawable.zutopia); listView = view.FindViewById <ListView>(Resource.Id.list); cursor = db.WritableDatabase.RawQuery("SELECT * FROM productInfo", null); context.StartManagingCursor(cursor); adapter = new CustomLayoutAdaptor(context, cursor); listView.Adapter = adapter; searchView.QueryTextChange += (sender, e) => adapter.Filter.InvokeFilter(e.NewText); searchView.QueryTextSubmit += (sender, e) => { Toast.MakeText(icActivity, "Searched for : " + e.Query, ToastLength.Short).Show(); e.Handled = true; }; listView.ItemClick += OnListItemClick; db.Close(); return(view); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Addproduct); var prodName = FindViewById <EditText>(Resource.Id.firstedit); var prodcost = FindViewById <EditText>(Resource.Id.thirdedit); var prodqunt = FindViewById <EditText>(Resource.Id.fourthedit); string title1 = Intent.GetStringExtra("title1"); TextView name = FindViewById <TextView>(Resource.Id.textview6); name.Text = title1.ToString(); db = new ProductDBHelper(this); db.Open(); Button addcat = FindViewById <Button>(Resource.Id.Addcat); Button back = FindViewById <Button>(Resource.Id.back); Button save = FindViewById <Button>(Resource.Id.Add); addcat.Click += delegate { StartActivity(typeof(categeory)); }; save.Click += delegate { if (prodName.Text == "") { string title = "Enter Product Name"; Android.Widget.Toast.MakeText(this, title, Android.Widget.ToastLength.Short).Show(); } else if (prodcost.Text == "") { string title = "Enter Product cost"; Android.Widget.Toast.MakeText(this, title, Android.Widget.ToastLength.Short).Show(); } else if (prodqunt.Text == "") { string title = "Enter Product quantity"; Android.Widget.Toast.MakeText(this, title, Android.Widget.ToastLength.Short).Show(); } else { db.InsertProductInfo(prodName.Text, title1, prodcost.Text, prodqunt.Text); // db.Close(); var text = "success"; Android.Widget.Toast.MakeText(this, text, Android.Widget.ToastLength.Short).Show(); } }; back.Click += delegate { StartActivity(typeof(MainActivity)); }; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.cart_list, container, false); db = new ProductDBHelper(context); db.Open(); listView = view.FindViewById <ListView>(Resource.Id.product_list); cursor = db.WritableDatabase.RawQuery("SELECT * FROM CartInfo", null); context.StartManagingCursor(cursor); listView.Adapter = new Customcartview(context, cursor); listView.ItemClick += OnListItemClick; db.Close(); return(view); }
public Customcartview(Activity context, ICursor c) : base(context, c) { db = new ProductDBHelper(context); db.Open(); this.context = context; }
public ProductFilter(CustomLayoutAdaptor adapter, ProductDBHelper DB) { this.adapter = adapter; this.DB = DB; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ProductDetails); string title1 = Intent.GetStringExtra("title1"); string cost1 = Intent.GetStringExtra("cost1"); string quantity1 = Intent.GetStringExtra("quantity1"); string fquantity = "0"; int id1 = int.Parse(Intent.GetStringExtra("id1")); // string image= Intent.GetStringExtra("image"); addtocart = FindViewById <Button>(Resource.Id.add_to_cart); Back = FindViewById <Button>(Resource.Id.back); EditText quant = FindViewById <EditText>(Resource.Id.editText2); TextView name = FindViewById <TextView>(Resource.Id.textview2); name.Text = title1.ToString(); TextView cost = FindViewById <TextView>(Resource.Id.textview4); cost.Text = cost1.ToString(); TextView available = FindViewById <TextView>(Resource.Id.textview6); available.Text = quantity1.ToString(); //FindViewById<ImageView>(Resource.Id.image).SetImageResource(int.Parse(GetString(4))); // Create your application here db = new ProductDBHelper(this); db.Open(); db1 = new DBHelper(this); db1.Open(); addtocart.Click += delegate { if (quant.Text == "") { string text = "Please Enter Quantity Details"; Android.Widget.Toast.MakeText(this, text, Android.Widget.ToastLength.Short).Show(); } else { db.Insertlistview(title1, cost1, quant.Text); var listOfUsers = db1.getUsers(); while (listOfUsers.MoveToNext()) { var lName = listOfUsers.GetString(listOfUsers.GetColumnIndexOrThrow(DBHelper.lNameField)); var fName = listOfUsers.GetString(listOfUsers.GetColumnIndexOrThrow(DBHelper.fNameField)); var email = listOfUsers.GetString(listOfUsers.GetColumnIndexOrThrow(DBHelper.emailField)); var welcomeActivity = new Intent(this, typeof(IcActivity)); welcomeActivity.PutExtra("myUser", fName); welcomeActivity.PutExtra("myfname", fName); welcomeActivity.PutExtra("mylname", lName); welcomeActivity.PutExtra("mymail", email); StartActivity(welcomeActivity); } var text = "Added to Cart"; Android.Widget.Toast.MakeText(this, text, Android.Widget.ToastLength.Short).Show(); //ContentValues values = new ContentValues(); //values.Put(ProductDBHelper.quantityField, quantity1 + 1); //db.WritableDatabase.Update("cartInfo", values, "_id=" + id1 + "", null); // db.ReadableDatabase.RawQuery("Delete table tablename where order_id=" + order_id + ";", null); //var intent = new Intent(this, typeof(IcActivity)); //StartActivity(intent); } }; Back.Click += delegate { var listOfUsers = db1.getUsers(); while (listOfUsers.MoveToNext()) { var lName = listOfUsers.GetString(listOfUsers.GetColumnIndexOrThrow(DBHelper.lNameField)); var fName = listOfUsers.GetString(listOfUsers.GetColumnIndexOrThrow(DBHelper.fNameField)); var email = listOfUsers.GetString(listOfUsers.GetColumnIndexOrThrow(DBHelper.emailField)); var welcomeActivity = new Intent(this, typeof(IcActivity)); welcomeActivity.PutExtra("myUser", fName); welcomeActivity.PutExtra("myfname", fName); welcomeActivity.PutExtra("mylname", lName); welcomeActivity.PutExtra("mymail", email); StartActivity(welcomeActivity); } }; }