protected override Java.Lang.Object DoInBackground(params Java.Lang.Object[] @params) { List <Models.Synchronization> list = LDbConnection.GetSynchronization(); for (int i = 0; i < list.Count; i++) { if (list.ElementAt(i).Expo_Id != -1 && list.ElementAt(i).User_Id != -1) { DbConnection.FetchUserJoinExpoAsync(LDbConnection.GetUser(), LDbConnection.GetUserExpo(list.ElementAt(i).Expo_Id)); } else if (list.ElementAt(i).Expo_Id != -1 && list.ElementAt(i).Company_Id != -1) { //DbConnection.FetchCompanyJoinExpoAsync(LDbConnection.GetCompany(), LDbConnection.GetUserExpo(list.ElementAt(i).Expo_Id)); } else if (list.ElementAt(i).History_Id != -1) { DbConnection.FetchUserHistoryAsync(LDbConnection.GetHistoryUser(list.ElementAt(i).History_Id)); } else if (list.ElementAt(i).User_Id != -1) { //DbConnection.FetchUserSync(LDbConnection.GetUser()); } else if (list.ElementAt(i).Company_Id != -1) { // DbConnection.FetchCompanySync(LDbConnection.GetCompany()); } } return("Zsycnchronizowano"); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.History); ListView l = (ListView)FindViewById(Resource.Id.HistoryList); lista = LDbConnection.GetHistoryUser(); HistoryAdapter adapter = new HistoryAdapter(lista, this); l.SetAdapter(adapter); l.ItemClick += List_ItemClick; }
private async Task ParseAndReturnAsync() { // Extract the array of name/value results for the field name "weatherObservation". Models.Company c = await DbConnection.FetchCompanyAsync(this.Intent.GetStringExtra("Email")); // ID=Long.ParseLong(jsonR["ID"]), TextView CompanyName = FindViewById <TextView>(Resource.Id.company_name); CompanyName.Text = c.CompanyName; TextView CompanyFullName = FindViewById <TextView>(Resource.Id.company_fullname); CompanyFullName.Text = c.CompanyFullName; TextView CompanyAbout = FindViewById <TextView>(Resource.Id.company_about); CompanyAbout.Text = c.CompanyAbout; TextView ProductsAbout = FindViewById <TextView>(Resource.Id.company_product); ProductsAbout.Text = c.ProductsAbout; TextView ContactEmail = FindViewById <TextView>(Resource.Id.company_email); ContactEmail.Text = c.ContactEmail; ContactEmail.Click += (s, e) => { var uri = Android.Net.Uri.Parse("mailto:" + c.ContactEmail); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); }; TextView Phone = FindViewById <TextView>(Resource.Id.company_phone); Phone.Text = c.Phone.ToString(); TextView Adress = FindViewById <TextView>(Resource.Id.company_adres); Adress.Text = c.Adress; TextView WWW = FindViewById <TextView>(Resource.Id.company_www); WWW.Text = c.www; WWW.Click += (s, e) => { var uri = Android.Net.Uri.Parse(c.www); var intent = new Intent(Intent.ActionView, uri); StartActivity(intent); }; WebView Youtube = FindViewById <WebView>(Resource.Id.company_youtube); WebSettings set = Youtube.Settings; set.JavaScriptEnabled = true; Youtube.SetWebChromeClient(new WebChromeClient()); Youtube.LoadUrl("https://www.youtube.com/embed/" + c.Youtube); ImageButton fb = FindViewById <ImageButton>(Resource.Id.company_facebook); fb.Click += (s, e) => { String uri = "fb://facewebmodal/f?href=" + c.Facebook; Intent intent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(uri)); StartActivity(intent); }; if (c.Facebook == null) { fb.Visibility = ViewStates.Invisible; fb.SetMaxHeight(0); } ImageButton insta = FindViewById <ImageButton>(Resource.Id.company_instagram); insta.Click += (s, e) => { String[] tab = c.Instagram.ToString().Split('/'); String uri = "instagram://user?username="******"http://expotest.somee.com/Images/Company/" + c.CompanyLogo)); ImageView StandPhoto = FindViewById <ImageView>(Resource.Id.company_standphoto); StandPhoto.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.StandPhoto)); ImageView Photo1 = FindViewById <ImageView>(Resource.Id.company_photo1); Photo1.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo1)); ImageView Photo2 = FindViewById <ImageView>(Resource.Id.company_photo2); Photo2.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo2)); ImageView Photo3 = FindViewById <ImageView>(Resource.Id.company_photo3); Photo3.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo3)); ImageView Photo4 = FindViewById <ImageView>(Resource.Id.company_photo4); Photo4.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo4)); ImageView Photo5 = FindViewById <ImageView>(Resource.Id.company_photo5); Photo5.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/Company/" + c.Photo5)); LayoutInflater layoutInflaterAndroid = LayoutInflater.From(this); View popup = layoutInflaterAndroid.Inflate(Resource.Layout.HistoryWindowU, null); Android.Support.V7.App.AlertDialog.Builder alertDialogbuilder = new Android.Support.V7.App.AlertDialog.Builder(this); alertDialogbuilder.SetView(popup); var userContent = popup.FindViewById <EditText>(Resource.Id.History_description); alertDialogbuilder.SetCancelable(false) .SetPositiveButton("Dodaj", async delegate { HistoryU h = new HistoryU(); //h.ID = LDbConnection.GetHistoryUser(this).Count; if (LDbConnection.getUserType() == "Uczestnik") { h.Description = userContent.Text; h.User = LDbConnection.GetUser().ID; h.Expo = Java.Lang.Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchUserHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } else if (LDbConnection.getUserType() == "Wystawca") { h.Description = userContent.Text; h.User = LDbConnection.GetCompany().Id; h.Expo = Java.Lang.Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchCompanyHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } Toast.MakeText(this, "Wysłano", ToastLength.Long).Show(); } ).SetNegativeButton("Zamknij", async delegate { HistoryU h = new HistoryU(); //h.ID = LDbConnection.GetHistoryUser(this).Count; if (LDbConnection.getUserType() == "Uczestnik") { h.Description = "Skanowanie Nr: " + LDbConnection.GetHistoryUser().Count; h.User = LDbConnection.GetUser().ID; h.Expo = Java.Lang.Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchUserHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } else if (LDbConnection.getUserType() == "Wystawca") { h.Description = "Skanowanie Nr: " + LDbConnection.GetHistoryUser().Count; h.User = LDbConnection.GetCompany().Id; h.Expo = Java.Lang.Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchCompanyHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } alertDialogbuilder.Dispose(); }); Android.Support.V7.App.AlertDialog alertDialogAndroid = alertDialogbuilder.Create(); if (this.Intent.GetBooleanExtra("Show", true)) { alertDialogAndroid.Show(); } }
protected async void LoadDAtaAsync() { User u = await DbConnection.FetchUserAsync(this.Intent.GetStringExtra("Email")); TextView ForName = FindViewById <TextView>(Resource.Id.user_forname); ForName.Text = u.ForName; TextView SurName = FindViewById <TextView>(Resource.Id.user_surname); SurName.Text = u.SurName; TextView Email = FindViewById <TextView>(Resource.Id.user_email); Email.Text = u.Email; TextView Phone = FindViewById <TextView>(Resource.Id.user_phone); Phone.Text = u.Phone.ToString(); TextView Nationality = FindViewById <TextView>(Resource.Id.user_Nationality); Nationality.Text = u.Nationality; ImageView photo = FindViewById <ImageView>(Resource.Id.user_photo); photo.SetImageBitmap(DbConnection.GetImageBitmapFromUrl(this, "http://expotest.somee.com/Images/User/" + u.Photo)); LayoutInflater layoutInflaterAndroid = LayoutInflater.From(this); View popup = layoutInflaterAndroid.Inflate(Resource.Layout.HistoryWindowU, null); Android.Support.V7.App.AlertDialog.Builder alertDialogbuilder = new Android.Support.V7.App.AlertDialog.Builder(this); alertDialogbuilder.SetView(popup); var userContent = popup.FindViewById <EditText>(Resource.Id.History_description); alertDialogbuilder.SetCancelable(false) .SetPositiveButton("Dodaj", async delegate { HistoryU h = new HistoryU(); //h.ID = LDbConnection.GetHistoryUser(this).Count; if (LDbConnection.getUserType() == "Uczestnik") { h.Description = userContent.Text; h.User = LDbConnection.GetUser().ID; h.Expo = Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchUserHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } else if (LDbConnection.getUserType() == "Wystawca") { h.Description = userContent.Text; h.User = LDbConnection.GetCompany().Id; h.Expo = Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchCompanyHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } Toast.MakeText(this, "Wysłano", ToastLength.Long).Show(); } ).SetNegativeButton("Zamknij", async delegate { HistoryU h = new HistoryU(); //h.ID = LDbConnection.GetHistoryUser(this).Count; if (LDbConnection.getUserType() == "Uczestnik") { h.Description = "Skanowanie Nr: " + LDbConnection.GetHistoryUser().Count; h.User = LDbConnection.GetUser().ID; h.Expo = Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchUserHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } else if (LDbConnection.getUserType() == "Wystawca") { h.Description = "Skanowanie Nr: " + LDbConnection.GetHistoryUser().Count; h.User = LDbConnection.GetCompany().Id; h.Expo = Long.ParseLong(this.Intent.GetIntExtra("expo_id", 1).ToString()); h.Wyszukiwanie = this.Intent.GetStringExtra("Search"); LDbConnection.InsertHistoryU(h); if (await DbConnection.FetchCompanyHistoryAsync(h) == true) { Android.Widget.Toast.MakeText(this, "Zapisano w bazie", Android.Widget.ToastLength.Short).Show(); } else { Android.Widget.Toast.MakeText(this, "SendError", Android.Widget.ToastLength.Short).Show(); } } alertDialogbuilder.Dispose(); }); Android.Support.V7.App.AlertDialog alertDialogAndroid = alertDialogbuilder.Create(); if (this.Intent.GetBooleanExtra("Show", true)) { alertDialogAndroid.Show(); } }
public void HomeNavigationView_NavigationItemSelected(object sender, Android.Support.Design.Widget.NavigationView.NavigationItemSelectedEventArgs e) { var menuItem = e.MenuItem; menuItem.SetChecked(!menuItem.IsChecked); Android.Content.Intent intent; switch (menuItem.ItemId) { case Resource.Id.nav_my_expos: intent = new Android.Content.Intent(this, typeof(MyExposActivity)); StartActivity(intent); break; case Resource.Id.nav_help: intent = new Android.Content.Intent(this, typeof(VideoActivity)); StartActivity(intent); break; case Resource.Id.nav_expos: intent = new Android.Content.Intent(this, typeof(ExposActivity)); StartActivity(intent); break; case Resource.Id.nav_prof: intent = new Android.Content.Intent(this, typeof(MyProfileActivity)); StartActivity(intent); break; case Resource.Id.nav_history: intent = new Android.Content.Intent(this, typeof(HistoryActivity)); StartActivity(intent); break; case Resource.Id.nav_logout: using (var conn = new SQLite.SQLiteConnection(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal).ToString(), "database.sqlite"))) { conn.DeleteAll <Login>(); if (conn.ExecuteScalar <int>("SELECT count(*) FROM sqlite_master WHERE type = 'table' AND name = 'User'") != 0) { if (LDbConnection.GetCompany() != null) { Company c = conn.Table <Company>().First(); conn.DropTable <Company>(); conn.DropTable <Login>(); conn.DropTable <Expo>(); conn.DropTable <HistoryU>(); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.Photo1)); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.Photo2)); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.Photo3)); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.Photo4)); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.Photo5)); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.StandPhoto)); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + c.CompanyLogo)); } if (LDbConnection.GetUser() != null) { User u = conn.Table <User>().First(); conn.DropTable <User>(); conn.DropTable <Login>(); conn.DropTable <Expo>(); conn.DropTable <HistoryU>(); File.Delete(System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal) + u.Photo)); } if (LDbConnection.GetUserExpo() != null) { conn.DropTable <Expo>(); } if (LDbConnection.GetHistoryUser() != null) { if (LDbConnection.GetHistoryUser().Count != 0) { conn.DropTable <HistoryU>(); } } } conn.Commit(); conn.Close(); } intent = new Android.Content.Intent(this, typeof(MainActivity)); StartActivity(intent); Finish(); break; } }