public Task GetTask (int id)
		{
			using(var database = new SQLiteConnection(_helper.WritableDatabase.Path))
		    {
				return database.Get<Task>(id);
			}
		}
예제 #2
0
파일: Baza.cs 프로젝트: reqv/Smacznego
        public void zmienObrazek(int id, byte[] obrazek)
        {
            TabelaPrzepisy prze = conn.Get <TabelaPrzepisy> (id);

            prze.Obrazek = obrazek;
            conn.Update(prze);
            przeladujPrzepisy();
        }
예제 #3
0
        // code to retrieve speicif record using ORM
        public string GetTaskById( int id)
        {
            string dbPath = Path.Combine(Environment.GetFolderPath
                (Environment.SpecialFolder.Personal), "ormdemo.db3");
            var db = new SQLiteConnection(dbPath);

            var item = db.Get<ToDoTasks>(id);
            return item.Task;
        }
예제 #4
0
        //NEEDS WORK
        //This function returns an event table based on id
        public EventInfo GetEventById(int id)
        {
            string dbPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "AutomatechORM.db3");
            var db = new SQLiteConnection (dbPath);
            var table = db.Table<EventInfo> ();

            var item = db.Get<EventInfo> (id);

            return item;
        }
예제 #5
0
        public ResponseStatus UpdateProgress(int movieId, StatusType newStatus)
        {
            using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(App.DB_PATH))
            {
                var movie = conn.Get <ApiMovie>(movieId);
                movie.Status = newStatus;

                int nb = conn.Update(movie);

                return(nb > 0 ? ResponseStatus.OK : ResponseStatus.NOT_OK);
            }
        }
예제 #6
0
 public static Beacons GetBeacon(int id)
 {
     try
     {
         var db = new SQLiteConnection(dbPath);
         return db.Get<Beacons>(id);
     }
     catch
     {
         return null;
     }
 }
        public void makeavail()
        {
            Model.Userdata userd = new Model.Userdata();

            var path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "App.db");

            var db = new SQLiteConnection( new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path);

            var result = db.Get<Model.Userdata>(1);

            test.Text = "Hello" + result.getName();

        }
예제 #8
0
		public static string Get () 
		{
			var output = "";
			output += "\nGet query example: ";
			string dbPath = Path.Combine (
				Environment.GetFolderPath (Environment.SpecialFolder.Personal), "ormdemo.db3");
			
			var db = new SQLiteConnection (dbPath);
			
			var returned = db.Get<Stock>(2);
			
			return output;
		}
 public bool LogIn(AccountDB account)
 {
     using (var dbConnection = new SQLiteConnection(_dbUnitAndroidPrinterApp))
     {
         try
         {
             dbConnection.Get<AccountDB>(x => x.Login == account.Login && x.Password == account.Password);
             return true;
         }
         catch(Exception)
         {
             return false;
         }
     }
 }
예제 #10
0
        public override void LoadSettingAsync()
        {
            using (var conn = new SQLite.SQLiteConnection(DBSettingPath))
            {
                conn.CreateTable <AppSettings>();
                if (conn.Table <AppSettings>().Count() == 0)
                {
                    return;
                }

                var res = conn.Get <AppSettings>(1);
                foreach (PropertyInfo property in typeof(AppSettings).GetProperties())
                {
                    if (property.CanWrite)
                    {
                        property.SetValue(this, property.GetValue(res, null), null);
                    }
                }
            }
        }
예제 #11
0
        public void SaveNoteOldDate(int Id, string title, string note)
        {
            try
            {
                using (var conn = new SQLite.SQLiteConnection(System.IO.Path.Combine(folder, databaseName)))
                {
                    Note     myNote = conn.Get <Note>(p => p.Id.Equals(Id));
                    DateTime myTime = myNote.Time;

                    Note myNote1 = new Note {
                        Id = Id, Title = title, Description = note, Time = myTime
                    };

                    var query = conn.Update(myNote1);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
            }
        }
 //REAL
 static public string GetAccount()
 {
     //var testAccount = new AccountProfile { Email = "Emeri", Password = "******", PreferenceID = 2 };
     using (var db = new SQLite.SQLiteConnection(accountDBPath))
     {
         var stock = db.Get <AccountProfile>(1);
         return(Convert.ToString(stock.Email));
     }
     //string Ee = "empty";
     //try
     //{
     //var query = conn.Table<Account>().Where(v => v.Email.StartsWith("E"));
     //query.ToListAsync().ContinueWith(t3 =>
     //{
     //    foreach (var testAccount in t3.Result) Ee = testAccount.Email; //Console.WriteLine("Stock: " + testAccount.Email);
     //});
     //return Ee;
     //}
     //catch (Exception e) { var k = e.Message; }
     //return Ee;
 }
        //-----------sets the tag in the user.cs for further utilization in the application---------//
        protected void settingTags()
        {
            using (var connection = new SQLiteConnection (dbPath)) {

                var rowCount = connection.Table<User> ().Count ();

                var presentUser = connection.Get<User> (1);

                if (rowCount <= 2) {
                    //presentUser.Persons = persons;
                    connection.Update (presentUser);
                    //var Users = connection.Query<User>("UPDATE User SET Persons = ? WHERE ID = 1", persons);
                    Log.Info (Tag, "User Data Updated");
                }
            }
        }
예제 #14
0
        /// <summary>
        /// Loads an AnimationInfo object from the database
        /// </summary>
        /// <returns>An AnimationInfo object</returns>
        /// <param name="idStepNumber">A Pair containing the animation's MessageID and StepNumber. Set to null to return the currently editing animation.</param>
        public AnimationInfo LoadAnimation(Pair<string, int> idStepNumber)
        {
            lock (this.dbLock)
            {

                using (SQLiteConnection sqlCon = new SQLiteConnection(this.AnimationDBPath))
                {

                    sqlCon.Execute(WZConstants.DBClauseSyncOff);

                    AnimationInfo animationInfo = null;

                    if (null == idStepNumber)
                    {

                        animationInfo =
                            sqlCon.Query<AnimationInfo>("SELECT * FROM AnimationInfo WHERE IsEditing=?", true)
                                .FirstOrDefault();

                    } else
                    {

                        animationInfo =
                            sqlCon.Query<AnimationInfo>("SELECT * FROM AnimationInfo WHERE MessageGuid=? AND StepNumber=?",
                                                        idStepNumber.ItemA, idStepNumber.ItemB)
                                .FirstOrDefault();

                    }//end if else

                    if (null == animationInfo)
                    {
                        return null;
                    } else
                    {

                        List<FrameInfo> frameItems =
                            sqlCon.Query<FrameInfo>("SELECT * FROM FrameInfo WHERE AnimationDBID=?", animationInfo.DBID);

                        foreach (FrameInfo eachFrameInfo in frameItems)
                        {

                            List<LayerInfo> layerItems =
                                sqlCon.Query<LayerInfo>("SELECT * FROM LayerInfo WHERE FrameDBID=?", eachFrameInfo.DBID);

                            foreach (LayerInfo eachLayerItem in layerItems)
                            {

                                List<DrawingInfo> drItems =
                                    sqlCon.Query<DrawingInfo>("SELECT * FROM DrawingInfo WHERE LayerDBID=?", eachLayerItem.DBID);

                                foreach (DrawingInfo eachDrInfo in drItems)
                                {

                                    if (eachDrInfo.BrushItemDBID > 0)
                                    {

                                        eachDrInfo.Brush =
                                            sqlCon.Get<BrushItem>(eachDrInfo.BrushItemDBID);

                                    }//end if

                                    if (eachDrInfo.DrawingType == DrawingLayerType.Drawing)
                                    {

                                        List<PathPointDB> pathPoints =
                                            sqlCon.Query<PathPointDB>("SELECT * FROM PathPointDB WHERE DrawingInfoDBID=? " +
                                            "ORDER BY SortOrder", eachDrInfo.DBID);

                                        eachDrInfo.SetPathPointsFromDB(pathPoints);

                                    }//end if

                                    eachLayerItem.DrawingItems [eachDrInfo.DrawingID] = eachDrInfo;

                                }//end foreach

                                List<TransitionInfo> transitions =
                                    sqlCon.Query<TransitionInfo>("SELECT * FROM TransitionInfo WHERE LayerDBID=?", eachLayerItem.DBID);

                                foreach (TransitionInfo eachTrInfo in transitions)
                                {

                                    List<TransitionEffectSettings> efSettings =
                                        sqlCon.Query<TransitionEffectSettings>("SELECT * FROM TransitionEffectSettings WHERE TransitionInfoDBID=?", eachTrInfo.DBID);

                                    foreach (TransitionEffectSettings eachEfSetting in efSettings)
                                    {

                                        eachTrInfo.Settings [eachEfSetting.EffectType] = eachEfSetting;

                                    }//end foreach

                                    eachLayerItem.Transitions [eachTrInfo.ID] = eachTrInfo;

                                }//end foreach

                                eachFrameInfo.Layers [eachLayerItem.ID] = eachLayerItem;

                            }//end foreach

                            animationInfo.FrameItems [eachFrameInfo.ID] = eachFrameInfo;

                            List<AnimationAudioInfo> frameAudioItems =
                                sqlCon.Query<AnimationAudioInfo>("SELECT * FROM AnimationAudioInfo WHERE FrameDBID=?", eachFrameInfo.DBID);

                            foreach (AnimationAudioInfo eachAudioInfo in frameAudioItems)
                            {
                                animationInfo.AudioItems [eachAudioInfo.ID] = eachAudioInfo;
                            }//end foreach

                        }//end foreach

                        return animationInfo;

                    }//end if else
                }//end using sqlCon

            }//end lock
        }
예제 #15
0
        // Update a Beacon
        public static int UpdateBeacon(int bID, string Name, string Longitude, string Latitude, double Distance)
        {
            try
            {
                var db = new SQLiteConnection(dbPath);

                //Get Beacon to update
                var Beacon = db.Get<Beacons>(bID);

                //Assign new values to the Beacon
                Beacon.bName = Name;
                Beacon.bLatitude = Latitude;
                Beacon.bLongitude = Longitude;
                Beacon.bDistance = Distance;

                //Update Beacon
                var result = db.Update(Beacon);
                return result;
            }
            catch (Exception exc)
            {
                return -1;
            }
        }
예제 #16
0
        /************************************************|
        * 				DEFINING METHODS				 |
         	* 												 |
        * 												 |
        *************************************************/
        //--------------retrieving user data and storing in variables---------------//
        private void RetrieveDatafromDB()
        {
            using (var connection = new SQLiteConnection(dbPath)) {

                var User = connection.Get<User> (1);

                existingJourney = User.ExistingJourney;

            }
        }
예제 #17
0
		//USER CHECK LOGIN
		public bool user_Check(string user_AndsoftUserTEXT,string user_PasswordTEXT)
		{		
			string dbPath = System.IO.Path.Combine(Environment.GetFolderPath
				(Environment.SpecialFolder.Personal), "ormDMS.db3");
			var db = new SQLiteConnection(dbPath);
			bool output = false;

			var query = db.Table<TableUser>().Where (v => v.user_AndsoftUser.Equals(user_AndsoftUserTEXT)).Where (v => v.user_Password.Equals(user_PasswordTEXT));

			foreach (var item in query) {
				output = true;
				var row = db.Get<TableUser> (item.Id);
				row.user_IsLogin = true;
				db.Update(row);
				Console.WriteLine ("UPDATE GOOD" + row.user_IsLogin);
			}

			return output;

		}
예제 #18
0
 //NEEDS INTERGRATION
 //This function removes an event based on id
 public string RemoveEvent(int id)
 {
     string dbPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "AutomatechORM.db3");
     var db = new SQLiteConnection (dbPath);
     var item = db.Get<EventInfo> (id);
     item.access = 0;
     return "Record Deleted...";
 }
예제 #19
0
		public int GetidNext (int id)
		{
			string dbPath = System.IO.Path.Combine(Environment.GetFolderPath
				(Environment.SpecialFolder.Personal), "ormDMS.db3");
			var db = new SQLiteConnection(dbPath);
			int idnext;
			//get int ordremission
			var item = db.Get<TablePositions>(id);
			idnext = (item.Ordremission)+ 1;
			var query = db.Table<TablePositions>().Where (v => v.Ordremission.Equals(idnext));
			//getordremission -1

			foreach (var row in query) {
				idnext = row.Id;
			}

			if (idnext < 0) {
				idnext = 0;
			}
			return 	idnext;



		}
예제 #20
0
		public string updateposimgpath (int i, string path)
		{
			string dbPath = System.IO.Path.Combine(Environment.GetFolderPath
				(Environment.SpecialFolder.Personal), "ormDMS.db3");
			var db = new SQLiteConnection(dbPath);
			string output = "";
			var row = db.Get<TablePositions>(i);
			row.imgpath = path;
			db.Update(row);
			output = "UPDATE POSITIONS " + row.Id;
			return output;
		}
예제 #21
0
 private void HandleClickGetInfo(object sender, EventArgs e)
 {
     HideKeyboard();
     try
     {
         using (var dbConnection = new SQLiteConnection(mDBUnitAndroidPrinterApp))
         {
             m_deviceInfoDB = dbConnection.Get<PrinterEntryDB>(
                 x => x.DeviceSerialNum.ToLower() == mSerialKey.Text.ToLower());
         }
     }
     catch (Exception)
     {
         m_deviceInfoDB = new PrinterEntryDB()
         {
             AddressStr = string.Empty,
             ContractorStr = string.Empty,
             ContractStr = string.Empty,
             DescrStr = string.Empty,
             DeviceId = -1,
             DeviceSerialNum = string.Empty,
             DeviceStr = string.Empty
         };
     }
     ViewFillForm(m_deviceInfoDB);
 }
예제 #22
0
		public static void Main (string[] args)
		{
			Console.WriteLine ("Hello SQLite-net Data!");

			/*
			//Get the path to the folder where the database is stored.
			// Notes: The Path class performs operations on strings that contain file path info
			//        Path.Combine appends the second path to the first path
			//        Environment.GetSpecialFolderPath gets the path to special pre-defined folders
			//              on Windows, the SpecialFolder enum defines: ProgramFiles, System, AppData, etc.
			//              on Android ...
			string dbPath = Path.Combine (
				Environment.GetFolderPath (Environment.SpecialFolder.Personal), "stocks.db3");
			*/

			/*
			// Check for an existing db file and only create a new one if it doesn't exist
			bool exists = File.Exists (dbPath);
			if (!exists) {
				// Need to create the database and seed it with some data.
				SQLiteConnection.CreateFile (dbPath);
			*/

			// We're using a file in Assets instead of the one defined above
			//string dbPath = Directory.GetCurrentDirectory ();
			string dbPath = @"../../../DataAccess-Android/Assets/stocks.db3";
			var db = new SQLiteConnection (dbPath);

			// Create a Stocks table
			//if (db.CreateTable (Mono.CSharp.TypeOf(Stock)) != 0) 
				db.DropTable<Stock>();
			if (db.CreateTable<Stock>() == 0)
			{
				// A table already exixts, delete any data it contains
				db.DeleteAll<Stock> ();
			}

			// Create a new stock and insert it into the database
			var newStock = new Stock ();
			newStock.Symbol = "APPL";
			newStock.Name = "Apple";
			newStock.ClosingPrice = 93.22m;
			int numRows = db.Insert (newStock);
			Console.WriteLine ("Number of rows inserted = {0}", numRows);

			// Insert some more stocks
				db.Insert(new Stock() {Symbol = "MSFT", Name = "Microsoft", ClosingPrice = 55.25m});
				db.Insert (new Stock() {Symbol = "GOOG", Name = "Google", ClosingPrice = 15.25m});
				db.Insert (new Stock() {Symbol = "SSNLF", Name = "Samsung", ClosingPrice = 25.25m});
				db.Insert (new Stock() {Symbol = "AMZN", Name = "Amazon", ClosingPrice = 35.25m});
				db.Insert (new Stock() {Symbol = "MMI", Name = "Motorola Mobility", ClosingPrice = 45.25m});
				db.Insert (new Stock() {Symbol = "FB", Name = "Facebook", ClosingPrice = 65.25m});

			// Read the stock from the database
			// Use the Get method with a query expression
			Stock singleItem = db.Get<Stock> (x => x.Name == "Google");
			Console.WriteLine ("Stock Symbol for Google: {0}", singleItem.Symbol);

			singleItem = db.Get<Stock> (x => x.ClosingPrice >= 30.0m);
				Console.WriteLine ("First stock priced at or over 30: {0}, price: {1}",
									singleItem.Symbol, singleItem.ClosingPrice);
			

				// Use the Get method with a primary key
			singleItem = db.Get<Stock> ("FB");
			Console.WriteLine ("Stock Name for Symbol FB: {0}", singleItem.Symbol);

			// Query using  SQL
			var stocksStartingWithA = db.Query<Stock> ("SELECT * FROM Stocks WHERE Symbol LIKE ?", "A%"); 
			foreach(Stock stock in stocksStartingWithA)
				Console.WriteLine ("Stock starting with A: {0}", stock.Symbol);

			// Query using Linq
			var stocksStartingWithM = from s in db.Table<Stock> () where s.Symbol.StartsWith ("M") select s;
			foreach(Stock stock in stocksStartingWithM)
				Console.WriteLine ("Stock starting with M: {0}", stock.Symbol);


		}
예제 #23
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);
            SetContentView (Resource.Layout.JourneyPreview);

            inflater = (LayoutInflater)this.GetSystemService (Context.LayoutInflaterService);

            for (int i = 0; i < isUnfold.Length; i++) {
                isUnfold [i] = false;
            }

            TstartingDate = (TextView)FindViewById (Resource.Id.StartingDate);
            TendDate = (TextView)FindViewById (Resource.Id.EndDate);
            newSearchButton = (Button)FindViewById (Resource.Id.NewSearchButton);
            backToMenuBtn = (Button)FindViewById (Resource.Id.BackToMenu);
            backToNewJourneyBtn = (Button)FindViewById (Resource.Id.BackToNewJourney);
            finishPreviewBtn = (Button)FindViewById (Resource.Id.FinishPreviewButton);
            scrollViewMain = (LinearLayout)FindViewById (Resource.Id.ScrollViewMain);
            RetrieveDatafromDB ();

            TstartingDate.Text = "Start: " + startingDate;
            TendDate.Text = "Ende: " + endDate;

            /************************************************|
            * 				INVOKING METHODS				 |
             	* 												 |
            * 												 |
            *************************************************/
            // drawing the necessary amount of destinations
            // draw also sets the event listeners for every button
            if (!hasStarted) {
                draw ();
                hasStarted = true;
            }

            newSearchButton.Click += delegate {
                StartActivity(typeof(JourneyPreview));
                Finish();
            };

            backToMenuBtn.Click += delegate {
                StartActivity(typeof(GowlMain));
                Finish();
            };

            backToNewJourneyBtn.Click += delegate {
                StartActivity(typeof(NewJourneySpecificPreference));
                Finish();
            };

            finishPreviewBtn.Click += delegate {
                using (var connection = new SQLiteConnection(dbPath)) {

                    var currUser = connection.Get<User> (1);

                    currUser.ExistingJourney = true;

                    connection.Update(currUser);
                }
                StartActivity(typeof(GowlMain));
                Finish();
            };
        }
        //-----------sets the tag in the user.cs for further utilization in the application---------//
        protected void settingTags()
        {
            using (var connection = new SQLiteConnection (dbPath)) {

                var rowCount = connection.Table<User> ().Count ();

                var presentUser = connection.Get<User> (1);

                Log.Info (Tag, "rowCount: " + rowCount.ToString ());

                if (rowCount > 2) {
                    Log.Info (Tag, "Database cleared");
                    for (int i = rowCount; i > 0-1; i--) {
                        var del = connection.Delete<User> (i);
                        //var deleted = connection.Query<User> ("DELETE FROM User WHERE ID = ?", i);
                        Log.Info (Tag, "for loop i: " + i.ToString ());
                        Log.Info (Tag, "Rows deleted: " + del.ToString ());
                    }
                }

                rowCount = connection.Table<User> ().Count ();

                if (rowCount <= 2) {
                    presentUser.VacationTarget = vacationTarget;
                    connection.Update (presentUser);
                    //var Users = connection.Query<User>("UPDATE User SET Persons = ? WHERE ID = 1", persons);
                    Log.Info (Tag, "User Data Updated");
                }

            }
        }
예제 #25
0
		public string updatePosition (int idposition,string statut, string txtAnomalie, string txtRemarque, string codeAnomalie, string imgpath)
		{
			string dbPath = System.IO.Path.Combine(Environment.GetFolderPath
				(Environment.SpecialFolder.Personal), "ormDMS.db3");
			var db = new SQLiteConnection(dbPath);
			string output = "";
			var row = db.Get<TablePositions>(idposition);
			row.StatutLivraison = statut;
			db.Update(row);
			output = "UPDATE POSITIONS " + row.Id;
			return output;
		}
예제 #26
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            RetrieveDatafromDB ();

            //existingJourney = true;

            if (existingJourney == false) {
                SetContentView (Resource.Layout.Main);
                newJourneyBtn = (Button)FindViewById (Resource.Id.NewJourneyButton);
                userDataBtn = (Button)FindViewById (Resource.Id.UserDataButton);
                backUserDataBtn = (Button)FindViewById (Resource.Id.backButtonUserData);
                resetBtn = (Button)FindViewById (Resource.Id.NewMainPreferences);
                flipper = (ViewFlipper)FindViewById (Resource.Id.viewFlipper1);
                Menu ();
            }

            if (existingJourney == true) {
                SetContentView (Resource.Layout.ExistingJourney);
                Log.Info (Tag, "existing Journey false");
                voiceResultText = (TextView)FindViewById (Resource.Id.VoiceResultText);
                speechListener = (Button)FindViewById (Resource.Id.voiceButton);
                speechListener.Click += RecordVoice;
                newComJourneyBtn = (Button)FindViewById (Resource.Id.ExistingNewJourney);
                existingMainMenu = (Button)FindViewById (Resource.Id.ExistingMainMenu);
                existingMainMenu.Click += delegate {
                    using (var connection = new SQLiteConnection(dbPath)) {
                        var User = connection.Get<User> (1);
                        User.ExistingJourney = false;
                        connection.Update(User);
                        StartActivity (typeof(GowlMain));
                        Finish();
                    }
                };
                newComJourneyBtn.Click += delegate {
                    StartActivity(typeof(NewJourneySpecificPreference));
                    Finish();
                };
            }
        }
예제 #27
0
        async Task RunUpdateTest()
        {
            await Task.Factory.StartNew(() =>
            {
                using (var db = new SQLiteConnection(DatabasePath))
                {
                    db.RunInTransaction(async () =>
                    {
                        // run the update operation
                        var person = db.Get<Person>(f => f.FullName.EndsWith("8"));
                        person.OtherField = "ABCD";
                        db.Update(person);

                        // check it was persisted
                        var updatedPerson = db.Get<Person>(f => f.FullName.EndsWith("8"));
                        var message = updatedPerson.OtherField == "ABCD"
                                      ? "Completed!"
                                      : "Did not update person!";

                        await dispatcher.RunIdleAsync(a => { UpdateResult = message; });
                    });
                }
            });
        }
예제 #28
0
		public string updatePositionSuppliv (string numCommande)
		{
			string dbPath = System.IO.Path.Combine(Environment.GetFolderPath
				(Environment.SpecialFolder.Personal), "ormDMS.db3");
			var db = new SQLiteConnection(dbPath);
			string output = "";
			var query = db.Table<TablePositions>().Where (v => v.numCommande.Equals(numCommande));
			foreach (var item in query) {
				output = "YALO";
				var row = db.Get<TablePositions> (item.Id);
				row.imgpath = "SUPPLIV";
				db.Update(row);
				Console.WriteLine ("UPDATE SUPPLIV" + row.numCommande);
			}
			return output;
		}
예제 #29
0
 //NEEDS INTEGRATION
 //This function updates an existing event with new info
 public string updateEvent(int id,string name, string location, string date, string time)
 {
     string dbPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "AutomatechORM.db3");
     var db = new SQLiteConnection(dbPath);
     var item = db.Get<EventInfo>(id) ;
     item.title = name;
     item.location = location;
     item.date = date;
     item.time = time;
     db.Update (item);
     return "Record Updated...";
 }
예제 #30
0
		void  ComWebService ()
		{
			//récupération des données dans la BDD
			string dbPath = System.IO.Path.Combine (Environment.GetFolderPath
				(Environment.SpecialFolder.Personal), "ormDMS.db3");
			var db = new SQLiteConnection (dbPath);
			var table = db.Query<TableStatutPositions> ("Select * FROM TableStatutPositions");

			foreach (var item in table) {
				try {
					string _url = "http://dms.jeantettransport.com/api/livraisongroupage";
					var webClient = new WebClient ();
					webClient.Headers [HttpRequestHeader.ContentType] = "application/json";
					//TODO
					webClient.UploadString (_url, item.datajson);
					//Sup pde la row dans statut pos
					var row = db.Get<TableStatutPositions>(item.Id);
					db.Delete(row);
				} catch (Exception e) {
					Console.WriteLine (e);
					Insights.Report(e);
					File.AppendAllText(log_file,"["+DateTime.Now.ToString("t")+"]"+"[ERROR] ComWebService : "+e+" à "+DateTime.Now.ToString("t")+"\n");
				}
			}
			Console.WriteLine ("\nTask ComWebService done");
			//File.AppendAllText(Data.log_file, "Task ComWebService done"+DateTime.Now.ToString("t")+"\n");
		}
예제 #31
0
		public string logout()
		{		
			string dbPath = System.IO.Path.Combine(Environment.GetFolderPath
				(Environment.SpecialFolder.Personal), "ormDMS.db3");
			var db = new SQLiteConnection(dbPath);
			string output = string.Empty;
			var query = db.Table<TableUser>().Where (v => v.user_IsLogin.Equals(true));
			foreach (var item in query) {
				var row = db.Get<TableUser>(item.Id);
				row.user_IsLogin = false;
				db.Update(row);
				output = "UPDATE USER LOGOUT " + row.user_AndsoftUser;
			}
			return output;

		}
예제 #32
0
        /************************************************|
        * 				DEFINING METHODS				 |
         	* 												 |
        * 												 |
        *************************************************/
        //--------------retrieving user data and storing in variables---------------//
        private void RetrieveDatafromDB()
        {
            using (var connection = new SQLiteConnection(dbPath)) {

                var User = connection.Get<User> (1);

                persons = User.Persons;
                standards = User.Standards;
                isActive = User.IsActive;
                interestCity = User.InterestCity;
                interestCulture = User.InterestCulture;
                interestNature = User.InterestNature;
                interestSportActivities = User.InterestSportActivities;
                interestEvents = User.InterestEvents;
                vacationTarget = User.VacationTarget;
                startingDate = User.StartingDate;
                endDate = User.EndDate;
                Log.Info (Tag, "Query - Result: " + persons.ToString ());

            }
        }
예제 #33
0
		//suppresion d'un GRP
		public string supp_grp(string numGroupage)
		{
			string dbPath = System.IO.Path.Combine(Environment.GetFolderPath
				(Environment.SpecialFolder.Personal), "ormDMS.db3");
			var db = new SQLiteConnection(dbPath);
			string output = "";

			var query = db.Table<TablePositions>().Where (v => v.groupage.Equals(numGroupage));
			foreach (var item in query) {
				output = item.groupage;
				var row = db.Get<TablePositions>(item.Id);
				db.Delete(row);
				Console.WriteLine ("\nDELETE GOOD" + numGroupage);
			}
			return output;
		}
예제 #34
0
        private void HandleClickSaveInfo(object sender, EventArgs e)
        {
            HideKeyboard();
            TypeWorkDB typeWork;
            string specialistSid;
            using (var dbConnection = new SQLiteConnection(mDBUnitAndroidPrinterApp))
            {
                string selectTypeWork = mSpinner.SelectedItem.ToString();
                typeWork = dbConnection.Get<TypeWorkDB>(x => x.Name == selectTypeWork);

                specialistSid = dbConnection.Get<AccountDB>(x => x.Login == mLogin).Sid;
            }
            DispatchDB dispatch = new DispatchDB()
            {
                DeviceSerialNum = mSerialKey.Text,
                Address = mAddress.Text,
                ClientName = mClientName.Text,
                CounterColor = mColorCounter.Text,
                CounterMono = mMonoCounter.Text,
                DateCreate = DateTime.Now,
                Descr = mComment.Text,
                DeviceModel = mDeviceModel.Text,
                CityName = string.Empty,
                IdDevice = m_deviceInfoDB.DeviceId,
                IdWorkType = typeWork.Id,
                SpecialistSid = specialistSid
            };

            try
            {
                m_unitAPIShellSaver.PushData(dispatch);
            }
            catch (WebException webEx)
            {
                try
                {
                    m_unitAPIShellSaver.SaveLocalData(dispatch);
                }
                catch (SQLiteException dbEx)
                {
                    string resError = Resources.GetString(Resource.String.ErrorSaveInfo);
                    string errorDescr = string.Format(
                        resError + System.Environment.NewLine +
                        "Web error: {0}" + System.Environment.NewLine + "DB error: {1}",
                        webEx.Message, dbEx.Message);
                    Toast.MakeText(this, errorDescr, ToastLength.Long).Show();
                }
            }

            GoCompleteSaveEntryActivity();
        }
예제 #35
0
		//SELECT PAR ID
		public TablePositions GetPositionsData(int id)
		{
			string dbPath = System.IO.Path.Combine(Environment.GetFolderPath
				(Environment.SpecialFolder.Personal), "ormDMS.db3");
			var db = new SQLiteConnection(dbPath);

			TablePositions data = new TablePositions ();
			var item = db.Get<TablePositions>(id);
			data.codeLivraison = item.codeLivraison;
			data. numCommande = item.numCommande;
			data. nomClient = item.nomClient;
			data. refClient = item.refClient;
			data. nomPayeur = item.nomPayeur;
			data. adresseLivraison = item.adresseLivraison;
			data. CpLivraison = item.CpLivraison;
			data. villeLivraison = item.villeLivraison;
			data. dateHeure = item.dateHeure;
			data. dateExpe = item.dateExpe;
			data. nbrColis = item.nbrColis;
			data. nbrPallette = item.nbrPallette;
			data. adresseExpediteur = item.adresseExpediteur;
			data. CpExpediteur = item.CpExpediteur;
			data. villeExpediteur = item.villeExpediteur;
			data. nomExpediteur = item.nomExpediteur;
			data. StatutLivraison = item.StatutLivraison;
			data .instrucLivraison = item.instrucLivraison;
			data. groupage = item.groupage;
			data. ADRLiv = item.ADRLiv;
			data .ADRGrp = item.ADRGrp;
			data .planDeTransport = item.planDeTransport;
			data. typeMission = item.typeMission;
			data.typeSegment = item.typeSegment;
			data.CR = item.CR;
			data .nomClientLivraison = item.nomClientLivraison;
			data .villeClientLivraison = item.villeClientLivraison;
			data .Datemission = item.Datemission;
			data. Ordremission = item.Ordremission;
			data .Userandsoft = item.Userandsoft;
			data .remarque = item.remarque;
			data .codeAnomalie = item.codeAnomalie;
			data .libeAnomalie = item.libeAnomalie;
			data.imgpath = item.imgpath;

			if (Convert.ToDouble((item.poids).Replace ('.', ',')) < 1) {
				data.poids = ((Convert.ToDouble((item.poids).Replace ('.', ','))) * 1000) + " kg";
			} else {
				data.poids = item.poids + "tonnes";
			}
			return data;
		}