void insertLevel(object obj) { lock (singletonLock) { try { Hashtable hash = (Hashtable)obj; string encryptLevel = Encryption.Encrypt("" + hash [DatabaseManager.LEVEL]); string encryptScore = Encryption.Encrypt("" + hash [DatabaseManager.SCORE]); string encryptRate = Encryption.Encrypt("" + hash [DatabaseManager.RATE]); string encryptReplay = Encryption.Encrypt("" + hash [DatabaseManager.REPLAY]); var p = new LevelTable { Level = encryptLevel, Score = encryptScore, Rate = encryptRate, Replay = encryptReplay }; int isSuccess = connection.Update(p); if (isSuccess == 0) { connection.Insert(p); } } catch (Exception ex) { Debug.LogWarning(ex.Message); } } }
public void AddTeam(string name) { _connection.Insert(new Team { Name = name }); _messenger.Publish(new TeamsChangedMessage(this)); }
public void InsertPacote(int collection_id_num, int pacote_num) { var pacote = new Pacote { collection_id = collection_id_num, number = pacote_num, in_collection = false }; _connection.Insert(pacote); }
//Call everytime the App starts public async Task SyncTableUpdates() { var result = await MobileService.GetTable <table_update>().Take(_takeNRows).ToListAsync(); _liteConnection.DeleteAll <table_update>(); foreach (var item in result) { //Convert to UTC item.updated_at = item.updated_at.ToUniversalTime(); _liteConnection.Insert(item); } }
public async Task AddAttribute(AddAttribute model) { await RunTaskInTransaction(async() => { var attribute = new Data_Access_Layer.Attribute { Name = model.Name }; _sqliteConnection.Insert(attribute); return(string.Empty); }); }
public void AddMediaItem(IMediaItem item, bool updateDatabase = true) { ISQLiteConnection conn = null; try { int?id = Injection.Kernel.Get <IItemRepository>().GenerateItemId(ItemType.PlaylistItem); // to do - better way of knowing whether or not a query has been successfully completed. conn = Injection.Kernel.Get <IDatabase>().GetSqliteConnection(); var playlistItem = new PlaylistItem(); playlistItem.PlaylistItemId = id; playlistItem.PlaylistId = PlaylistId; playlistItem.ItemType = item.ItemType; playlistItem.ItemId = item.ItemId; playlistItem.ItemPosition = PlaylistCount == null ? 0 : PlaylistCount; int affected = conn.Insert(playlistItem); if (affected > 0) { PlaylistCount++; PlaylistDuration += (int)item.Duration; } if (updateDatabase) { UpdateDatabase(); } } catch (Exception e) { logger.Error(e); } finally { Injection.Kernel.Get <IDatabase>().CloseSqliteConnection(conn); } }
private void FillWithKittens(IKittenGenesisService genesis) { for (var i = 0; i < 100; i++) { _connection.Insert(genesis.CreateNewKitten()); } }
private void saveOutput(Bitmap croppedImage) { if (saveUri != null) { try { using (var outputStream = ContentResolver.OpenOutputStream(saveUri)) { if (outputStream != null) { croppedImage.Compress(outputFormat, 75, outputStream); } } } catch (Exception ex) { Log.Error(this.GetType().Name, ex.Message); } Bundle extras = new Bundle(); SetResult(Result.Ok, new Intent(saveUri.ToString()) .PutExtras(extras)); } else { Log.Error(this.GetType().Name, "not defined image url"); } //sqlite save ISQLiteConnection conn = null; ISQLiteConnectionFactory factory = new MvxDroidSQLiteConnectionFactory(); var sqlitedir = new Java.IO.File(global::Android.OS.Environment.GetExternalStoragePublicDirectory(global::Android.OS.Environment.DirectoryPictures), "Boruto"); string filename = sqlitedir.Path + "/mysqliteimage.db"; //Toast.MakeText(Application.Context, filename, ToastLength.Long).Show(); Java.IO.File f = new Java.IO.File(filename); conn = factory.Create(filename); conn.CreateTable <Myimage>(); conn.Insert(new Myimage() { Date = "30-12-2016", Imagepath = saveUri.ToString() }); var mycount = 0; foreach (var e in conn.Table <Myimage>().Where(e => e.Date == "30-12-2016")) { mycount++; } //Toast.MakeText(this, mycount.ToString(), ToastLength.Short).Show(); conn.Close(); //sqlite save end croppedImage.Recycle(); Finish(); }
//Call everytime the App starts public async Task SyncTableUpdates() { try { var result = await MobileService.GetTable <table_update>().Where(t => t.id > 0).LoadAllAsync(); Debug.WriteLine("********* &&&&& " + result.Count); // var result = await MobileService.GetTable<table_update>().Take(_takeNRows).ToListAsync(); _liteConnection.DeleteAll <table_update>(); foreach (var item in result) { //Convert to UTC item.updated_at = item.updated_at.ToUniversalTime(); _liteConnection.Insert(item); } } catch (Exception e) { throw(e); } }
public void AddPacoteEntry(int num_pacote, ISQLiteConnection c) { var pacote = new Pacote() { collection_id = Id, number = num_pacote, in_collection = false }; c.Insert(pacote); }
private void CreateLevelDB() { _connection.DropTable <PLevel> (); _connection.CreateTable <PLevel> (); IEnumerable <PChapter> chapters = GetAllChapters(); foreach (PChapter chapter in chapters) { for (int i = 1; i <= 10; i++) { _connection.Insert( new PLevel { Id = GetRandomString(), Name = levelNames[i], ChapterId = chapter.Id, Locked = true }); } } }
public void ShouldCreateFileDatabase() { // Items Needing Cleanup ISQLiteConnection conn = null; string expectedFilePath = null; try { // Arrange #if __IOS__ ISQLiteConnectionFactory factory = new MvxTouchSQLiteConnectionFactory(); #elif __ANDROID__ ISQLiteConnectionFactory factory = new MvxDroidSQLiteConnectionFactory(); #else ISQLiteConnectionFactory factory = new MvxWpfSqLiteConnectionFactory(); #endif string filename = Guid.NewGuid().ToString() + ".db"; #if __IOS__ || __ANDROID__ expectedFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), filename); #else expectedFilePath = Path.Combine(Directory.GetCurrentDirectory(), filename); #endif // Act conn = factory.Create(filename); conn.CreateTable <Person>(); conn.Insert(new Person() { FirstName = "Bob", LastName = "Smith" }); Person expected = conn.Table <Person>().FirstOrDefault(); // Asset Assert.That(File.Exists(expectedFilePath), Is.True); Assert.That(expected.FirstName, Is.EqualTo("Bob")); Assert.That(expected.LastName, Is.EqualTo("Smith")); } finally // Cleanup in Finally { if (conn != null) { conn.Close(); } if (!string.IsNullOrWhiteSpace(expectedFilePath) && File.Exists(expectedFilePath)) { File.Delete(expectedFilePath); } } }
public void ShouldCreateInMemoryDatabase() { // Items Needing Cleanup ISQLiteConnection conn = null; try { // Arrange #if __IOS__ ISQLiteConnectionFactory factory = new MvxTouchSQLiteConnectionFactory(); #elif __ANDROID__ ISQLiteConnectionFactory factory = new MvxDroidSQLiteConnectionFactory(); #else ISQLiteConnectionFactory factory = new MvxWpfSqLiteConnectionFactory(); #endif // Act conn = factory.CreateInMemory(); conn.CreateTable <Person>(); conn.Insert(new Person() { FirstName = "Bob", LastName = "Smith" }); Person expected = conn.Table <Person>().FirstOrDefault(); // Asset Assert.That(expected.FirstName, Is.EqualTo("Bob")); Assert.That(expected.LastName, Is.EqualTo("Smith")); } finally // Cleanup in Finally { if (conn != null) { conn.Close(); } } }
public void Insert(Scores kitten) { connection.Insert(kitten); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); /* * //Facebook login api * var auth = new OAuth2Authenticator( * clientId: "1270606036289960", * scope: "", * authorizeUrl: new Uri("https://m.facebook.com/dialog/oauth/"), * // redirectUrl: new Uri("http://www.facebook.com/connect/login_success.html")); * redirectUrl: new Uri("http://myjobupwork.com/fblogin/")); * * * //StartActivity (auth.GetUI(Application.Context)); * * auth.Completed += (sender, eventArgs) => * { * // We presented the UI, so it's up to us to dimiss it on iOS. * * * if (eventArgs.IsAuthenticated) * { * // Use eventArgs.Account to do wonderful things * * string access_token; * eventArgs.Account.Properties.TryGetValue("access_token", out access_token); * //Toast.MakeText(this, "Authenticate Token:" + access_token, ToastLength.Short).Show(); * var myurl = "https://graph.facebook.com/me?access_token=" + access_token; * Uri uri = new Uri(myurl); * HttpWebRequest request = new HttpWebRequest(uri); * request.Method = "GET"; * * * HttpWebResponse response = request.GetResponse() as HttpWebResponse; * using (StreamReader sr = new StreamReader(response.GetResponseStream())) * { * string responseString = sr.ReadToEnd(); * Newtonsoft.Json.Linq.JObject myjObject = Newtonsoft.Json.Linq.JObject.Parse(responseString); * var myid = (string)myjObject["id"]; * Toast.MakeText(this, "Your Facebook UserId:" + myid, ToastLength.Short).Show(); * * } * response.Close(); * } * }; */ /* * //Google Login * var auth = new OAuth2Authenticator(clientId: "544771199531-lfe6dn212h2ch38f5i4uaah5j7c2qs00.apps.googleusercontent.com", * scope: "https://www.googleapis.com/auth/userinfo.email", * authorizeUrl: new Uri("https://accounts.google.com/o/oauth2/auth"), * redirectUrl: new Uri("http://myjobupwork.com/ggplus/"), * getUsernameAsync: null); * * * auth.Completed += async (sender, e) => * { * if (!e.IsAuthenticated) * { * Toast.MakeText(this, "Fail to authenticate!", ToastLength.Short).Show(); * return; * } * string access_token; * e.Account.Properties.TryGetValue("access_token", out access_token); * * var myurl = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=" + access_token; * Uri uri = new Uri(myurl); * HttpWebRequest request = new HttpWebRequest(uri); * request.Method = "GET"; * * * HttpWebResponse response = request.GetResponse() as HttpWebResponse; * using (StreamReader sr = new StreamReader(response.GetResponseStream())) * { * string responseString = sr.ReadToEnd(); * Newtonsoft.Json.Linq.JObject myjObject = Newtonsoft.Json.Linq.JObject.Parse(responseString); * var myid = (string)myjObject["id"]; * ISQLiteConnection conn = null; * * ISQLiteConnectionFactory factory = new MvxDroidSQLiteConnectionFactory(); * * var sqlitedir = new Java.IO.File(global::Android.OS.Environment.GetExternalStoragePublicDirectory(global::Android.OS.Environment.DirectoryPictures), "Boruto"); * string filenameaction = sqlitedir.Path + "/mysqlitesas.db"; * * conn = factory.Create(filenameaction); * conn.CreateTable<Azurecon>(); * conn.DeleteAll<Azurecon>(); * conn.Insert(new Azurecon() { Sastring = "", UserType = "Google", UserId = myid }); * Toast.MakeText(this, "Your Google UserId:" + myid, ToastLength.Short).Show(); * conn.Close(); * } * response.Close(); * }; * * var intent = auth.GetUI(this); * StartActivity(intent); * * // Set our view from the "main" layout resource */ //login layout xml SetContentView(Resource.Layout.Main); Button buttonfacelogin = FindViewById <Button>(Resource.Id.buttonfacebooklogin); Button buttongooglelogin = FindViewById <Button>(Resource.Id.buttongooglelogin); buttonfacelogin.Click += delegate { //Facebook login api var auth = new OAuth2Authenticator( clientId: "1270606036289960", scope: "email", authorizeUrl: new Uri("https://m.facebook.com/dialog/oauth/"), // redirectUrl: new Uri("http://www.facebook.com/connect/login_success.html")); redirectUrl: new Uri("http://myjobupwork.com/fblogin/")); //StartActivity (auth.GetUI(Application.Context)); auth.Completed += (sender, eventArgs) => { // We presented the UI, so it's up to us to dimiss it on iOS. if (!eventArgs.IsAuthenticated) { Toast.MakeText(this, "Fail to authenticate!", ToastLength.Short).Show(); return; } if (eventArgs.IsAuthenticated) { // Use eventArgs.Account to do wonderful things string access_token; eventArgs.Account.Properties.TryGetValue("access_token", out access_token); //Toast.MakeText(this, "Authenticate Token:" + access_token, ToastLength.Short).Show(); var myurl = "https://graph.facebook.com/me?fields=id,email&access_token=" + access_token; Uri uri = new Uri(myurl); HttpWebRequest request = new HttpWebRequest(uri); request.Method = "GET"; HttpWebResponse response = request.GetResponse() as HttpWebResponse; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { string responseString = sr.ReadToEnd(); Newtonsoft.Json.Linq.JObject myjObject = Newtonsoft.Json.Linq.JObject.Parse(responseString); var myid = (string)myjObject["id"]; var myemail = (string)myjObject["email"]; var myurlui = "https://graph.facebook.com/me/permissions" + "?fields=id,email" + "&access_token=" + access_token; ISQLiteConnection conn = null; ISQLiteConnectionFactory factory = new MvxDroidSQLiteConnectionFactory(); var sqlitedir = new Java.IO.File(global::Android.OS.Environment.GetExternalStoragePublicDirectory(global::Android.OS.Environment.DirectoryPictures), "Boruto"); string filenameaction = sqlitedir.Path + "/mysqlitesas.db"; string myuseridfb = "fb" + myid; if (myemail.Length < 3) { myemail = myuseridfb; } conn = factory.Create(filenameaction); conn.CreateTable <Azurecon>(); //conn.CreateCommand("Delete from Azurecon").ExecuteNonQuery(); int countrow = 0; foreach (var eu in conn.Table <Azurecon>().Where(eu => eu.UserType == "Facebook")) { countrow++; } if (countrow > 0) { conn.CreateCommand("Update Azurecon set Sastring = '' where UserType='Google'").ExecuteNonQuery(); conn.CreateCommand("Update Azurecon set UserId = '" + myemail + "' where UserType='Facebook'").ExecuteNonQuery(); } else { conn.Insert(new Azurecon() { Sastring = "", UserType = "Facebook", UserId = myemail }); } //conn.Insert(new Azurecon() { Sastring = "", UserType = "Facebook", UserId = myemail }); Toast.MakeText(this, "Your Facebook UserId:" + myemail, ToastLength.Short).Show(); //Create new container for Google userid var myemailtrim = myemail.Replace("@", ""); myemailtrim = myemailtrim.Replace(".", ""); string myauzreafaceusercon = "http://93.118.34.239:8888/createcon/" + myemailtrim; var browser = new WebView(Application.Context); browser.LoadUrl(myauzreafaceusercon); conn.Close(); } response.Close(); SetContentView(Resource.Layout.Main1); Button button = FindViewById <Button>(Resource.Id.button); Button showlistbutton = FindViewById <Button>(Resource.Id.mylist); //Button uploadtoazure = FindViewById<Button>(Resource.Id.); button.Click += (s, e) => doTakePhotoAction(); showlistbutton.Click += delegate { StartActivity(typeof(MyListviewActivity)); }; Button showauzreimagebutton = FindViewById <Button>(Resource.Id.azureimagelist); showauzreimagebutton.Click += delegate { StartActivity(typeof(AzureActivity)); }; } }; ISQLiteConnection connch = null; ISQLiteConnectionFactory factorych = new MvxDroidSQLiteConnectionFactory(); var sqlitedirch = new Java.IO.File(global::Android.OS.Environment.GetExternalStoragePublicDirectory(global::Android.OS.Environment.DirectoryPictures), "Boruto"); string filenameactionch = sqlitedirch.Path + "/mysqlitesas.db"; connch = factorych.Create(filenameactionch); connch.CreateTable <Azurecon>(); //conn.CreateCommand("Delete from Azurecon").ExecuteNonQuery(); int countrowch = 0; foreach (var euch in connch.Table <Azurecon>().Where(euch => euch.UserType == "Facebook")) { countrowch++; } if (countrowch > 0) { connch.CreateCommand("Update Azurecon set Sastring = '' where UserType='Google'").ExecuteNonQuery(); connch.CreateCommand("Update Azurecon set Sastring = 'using' where UserType='Facebook'").ExecuteNonQuery(); SetContentView(Resource.Layout.Main1); Button button = FindViewById <Button>(Resource.Id.button); Button showlistbutton = FindViewById <Button>(Resource.Id.mylist); //Button uploadtoazure = FindViewById<Button>(Resource.Id.); button.Click += (s, e) => doTakePhotoAction(); showlistbutton.Click += delegate { StartActivity(typeof(MyListviewActivity)); }; Button showauzreimagebutton = FindViewById <Button>(Resource.Id.azureimagelist); showauzreimagebutton.Click += delegate { StartActivity(typeof(AzureActivity)); }; } else { var intent = auth.GetUI(this); StartActivity(intent); } }; buttongooglelogin.Click += delegate { //Google Login var auth = new OAuth2Authenticator(clientId: "544771199531-lfe6dn212h2ch38f5i4uaah5j7c2qs00.apps.googleusercontent.com", scope: "https://www.googleapis.com/auth/userinfo.email", authorizeUrl: new Uri("https://accounts.google.com/o/oauth2/auth"), redirectUrl: new Uri("http://myjobupwork.com/ggplus/"), getUsernameAsync: null); auth.Completed += async(sender, e) => { if (!e.IsAuthenticated) { Toast.MakeText(this, "Fail to authenticate!", ToastLength.Short).Show(); return; //SetContentView(Resource.Layout.Main); } else { string access_token; e.Account.Properties.TryGetValue("access_token", out access_token); var myurl = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=" + access_token; Uri uri = new Uri(myurl); HttpWebRequest request = new HttpWebRequest(uri); request.Method = "GET"; HttpWebResponse response = request.GetResponse() as HttpWebResponse; using (StreamReader sr = new StreamReader(response.GetResponseStream())) { string responseString = sr.ReadToEnd(); Newtonsoft.Json.Linq.JObject myjObject = Newtonsoft.Json.Linq.JObject.Parse(responseString); var myid = (string)myjObject["id"]; var myemail = (string)myjObject["email"]; ISQLiteConnection conn = null; ISQLiteConnectionFactory factory = new MvxDroidSQLiteConnectionFactory(); var sqlitedir = new Java.IO.File(global::Android.OS.Environment.GetExternalStoragePublicDirectory(global::Android.OS.Environment.DirectoryPictures), "Boruto"); string filenameaction = sqlitedir.Path + "/mysqlitesas.db"; conn = factory.Create(filenameaction); conn.CreateTable <Azurecon>(); int countrow = 0; foreach (var eu in conn.Table <Azurecon>().Where(eu => eu.UserType == "Google")) { countrow++; } if (countrow > 0) { conn.CreateCommand("Update Azurecon set Sastring = '' where UserType='Facebook'").ExecuteNonQuery(); conn.CreateCommand("Update Azurecon set Sastring = 'using',UserId = '" + myemail + "' where UserType='Google'").ExecuteNonQuery(); } else { conn.Insert(new Azurecon() { Sastring = "", UserType = "Google", UserId = myemail }); } //get googleuser email Toast.MakeText(this, "Your Google UserId:" + myemail, ToastLength.Short).Show(); //Create new container for Google userid var myemailtrim = myemail.Replace("@", ""); myemailtrim = myemailtrim.Replace(".", ""); string myauzregoogleusercon = "http://93.118.34.239:8888/createcon/" + myemailtrim; var browser = new WebView(Application.Context); browser.LoadUrl(myauzregoogleusercon); conn.Close(); } response.Close(); SetContentView(Resource.Layout.Main1); Button button = FindViewById <Button>(Resource.Id.button); Button showlistbutton = FindViewById <Button>(Resource.Id.mylist); //Button uploadtoazure = FindViewById<Button>(Resource.Id.); button.Click += (s, ea) => doTakePhotoAction(); showlistbutton.Click += delegate { StartActivity(typeof(MyListviewActivity)); }; Button showauzreimagebutton = FindViewById <Button>(Resource.Id.azureimagelist); showauzreimagebutton.Click += delegate { StartActivity(typeof(AzureActivity)); }; } }; ISQLiteConnection connch = null; ISQLiteConnectionFactory factorych = new MvxDroidSQLiteConnectionFactory(); var sqlitedirch = new Java.IO.File(global::Android.OS.Environment.GetExternalStoragePublicDirectory(global::Android.OS.Environment.DirectoryPictures), "Boruto"); string filenameactionch = sqlitedirch.Path + "/mysqlitesas.db"; connch = factorych.Create(filenameactionch); connch.CreateTable <Azurecon>(); //conn.CreateCommand("Delete from Azurecon").ExecuteNonQuery(); int countrowch = 0; foreach (var euch in connch.Table <Azurecon>().Where(euch => euch.UserType == "Google")) { countrowch++; } if (countrowch > 0) { connch.CreateCommand("Update Azurecon set Sastring = '' where UserType='Facebook'").ExecuteNonQuery(); connch.CreateCommand("Update Azurecon set Sastring = 'using' where UserType='Google'").ExecuteNonQuery(); SetContentView(Resource.Layout.Main1); Button button = FindViewById <Button>(Resource.Id.button); Button showlistbutton = FindViewById <Button>(Resource.Id.mylist); //Button uploadtoazure = FindViewById<Button>(Resource.Id.); button.Click += (s, e) => doTakePhotoAction(); showlistbutton.Click += delegate { StartActivity(typeof(MyListviewActivity)); }; Button showauzreimagebutton = FindViewById <Button>(Resource.Id.azureimagelist); showauzreimagebutton.Click += delegate { StartActivity(typeof(AzureActivity)); }; } else { var intent = auth.GetUI(this); StartActivity(intent); } }; // Get our button from the layout resource, // and attach an event to it /* * SetContentView(Resource.Layout.Main1); * Button buttonmain = FindViewById<Button>(Resource.Id.button); * Button showlistbuttonmain = FindViewById<Button>(Resource.Id.mylist); * //Button uploadtoazure = FindViewById<Button>(Resource.Id.); * buttonmain.Click += (s, e) => doTakePhotoAction(); * showlistbuttonmain.Click += delegate * { * StartActivity(typeof(MyListviewActivity)); * }; * Button showauzreimagebuttonmain = FindViewById<Button>(Resource.Id.azureimagelist); * showauzreimagebuttonmain.Click += delegate * { * StartActivity(typeof(AzureActivity)); * }; * */ }
public int Create(BowTie bowTie) { _connection.Insert(bowTie); return(bowTie.ID); }
public void InsertItem(object item) { _connection.Insert(item); }
public override View GetView(int position, View convertView, ViewGroup parent) { //Get our object for this position var item = items[position]; //Try to reuse convertView if it's not null, otherwise inflate it from our item layout // This gives us some performance gains by not always inflating a new view // This will sound familiar to MonoTouch developers with UITableViewCell.DequeueReusableCell() var view = (convertView ?? context.LayoutInflater.Inflate( Resource.Layout.MyListRows, parent, false)) as LinearLayout; //Find references to each subview in the list item's view var imageItem = view.FindViewById(Resource.Id.imageItem) as ImageView; var textTop = view.FindViewById(Resource.Id.textTop) as TextView; var textBottom = view.FindViewById(Resource.Id.textBottom) as TextView; var mycheckbox = view.FindViewById(Resource.Id.CheckboxItem) as CheckBox; mycheckbox.Text = item.Name; mycheckbox.Click += (o, e) => { if (mycheckbox.Checked) { var mycbitemid = mycheckbox.Text; Toast.MakeText(Application.Context, mycbitemid, ToastLength.Short).Show(); ISQLiteConnection connactionc = null; ISQLiteConnectionFactory factoryc = new MvxDroidSQLiteConnectionFactory(); var sqlitedir = new Java.IO.File(global::Android.OS.Environment.GetExternalStoragePublicDirectory(global::Android.OS.Environment.DirectoryPictures), "Boruto"); string filename = sqlitedir.Path + "/mysqliteaction.db"; //Toast.MakeText(Application.Context, filename, ToastLength.Long).Show(); connactionc = factoryc.Create(filename); connactionc.CreateTable <MyCheckbox>(); connactionc.Insert(new MyCheckbox() { Name = mycbitemid }); connactionc.Close(); //var mycbitemid = mycheckbox.Text; //myCollection.Add(mycbitemid); //Toast.MakeText(Application.Context, myCollection.Count.ToString(), ToastLength.Short).Show(); } }; //Assign this item's values to the various subviews //Bitmap bitmap; //bitmap = BitmapFactory.DecodeFile(item.Image); // First we get the the dimensions of the file on disk //var myuri = getImageUri(item.Description); //Uri contentUri = Uri.FromFile(myimgfile); Koush.UrlImageViewHelper.SetUrlDrawable(imageItem, item.Image); //Koush.UrlImageViewHelper.SetUrlDrawable(imageItem, "https://s.gravatar.com/avatar/7d1f32b86a6076963e7beab73dddf7ca?s=300"); //imageItem.SetImageBitmap(resizedBitmap); //imageItem.SetImageBitmap(resizedBitmap); textTop.SetText(item.Name, TextView.BufferType.Normal); //textBottom.SetText(item.Description, TextView.BufferType.Normal); textBottom.SetText(item.Description, TextView.BufferType.Normal); //Finally return the view return(view); }
/// <summary> /// EntityをDBに保存 /// </summary> /// <param name="entity">Entity.</param> public int Insert(T entity) { return(_connection.Insert(entity)); }
public void Insert(T item) { _connection.Insert(item); }
public void Add(CollectedItem collectedItem) { _connection.Insert(collectedItem); }
public void DefineAction(Action action) { _sqlConnection.Insert(action); }
public void Add(Item item) { _connection.Insert(item); }
public void InsertPromotion(Promotion promo) { _connection.Insert(promo); }
public void DefineProject(Project project) { _sqlConnection.Insert(project); }
public void Insert(Kitten kitten) { _connection.Insert(kitten); }
public void InsertMediaItem(IMediaItem item, int index) { // make sure the input is within bounds and is not null if (ReferenceEquals(item, null) || index > PlaylistCount || index < 0 || ReferenceEquals(PlaylistId, null)) { return; } ISQLiteConnection conn = null; try { int?id = Injection.Kernel.Get <IItemRepository>().GenerateItemId(ItemType.PlaylistItem); if (!ReferenceEquals(id, null)) { // to do - better way of knowing whether or not a query has been successfully completed. conn = Injection.Kernel.Get <IDatabase>().GetSqliteConnection(); conn.BeginTransaction(); for (int position = (int)PlaylistCount - 1; position >= index; position--) { logger.IfInfo("Updating position " + position + " to " + (position + 1)); conn.ExecuteLogged("UPDATE PlaylistItem SET ItemPosition = ItemPosition + 1 WHERE PlaylistId = ? AND ItemPosition = ?", PlaylistId, position); } // conditional rollback here // Insert the new item var playlistItem = new PlaylistItem(); playlistItem.PlaylistItemId = id; playlistItem.PlaylistId = PlaylistId; playlistItem.ItemType = item.ItemType; playlistItem.ItemId = item.ItemId; playlistItem.ItemPosition = index; int affected = conn.Insert(playlistItem); // conditional rollback here if (affected > 0) { PlaylistCount++; PlaylistDuration += (int)item.Duration; LastUpdateTime = DateTime.UtcNow.ToUnixTime(); Md5Hash = CalculateHash(); conn.ExecuteLogged("UPDATE Playlist SET PlaylistName = ?, PlaylistCount = ?, PlaylistDuration = ?, Md5Hash = ?, LastUpdateTime = ? " + "WHERE PlaylistId = ?", PlaylistName == null ? "" : PlaylistName, PlaylistCount, PlaylistDuration, Md5Hash, LastUpdateTime, PlaylistId); conn.Commit(); } else { conn.Rollback(); } } } catch (Exception e) { if (!ReferenceEquals(conn, null)) { conn.Rollback(); } logger.Error(e); } finally { Injection.Kernel.Get <IDatabase>().CloseSqliteConnection(conn); } }
public void Add(T item) { _connection.Insert(item); #warning this definitely isn't efficient! RaiseCollectionChanged(); }
public virtual async Task Add(T entity) { _sqliteConnection.Insert(entity); }
public void AddStuffToInbox(ItemOfStuff itemOfStuff) { _sqlConnection.Insert(itemOfStuff); }