Esempio n. 1
0
        private void SaveDealerLogin()
        {
            var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var libraryPath   = Path.Combine(documentsPath, DBConstant.SEPARATOR, DBConstant.LIBRARY);// Library Folder
            var DbPath        = Path.Combine(libraryPath, DBConstant.DB_NAME);
            var conn          = new SQLite.SQLiteConnection(DbPath);

            conn.CreateTable <DealerValue>();

            var record = new DealerValue {
                DealerLogin = true, StoreId = AppDelegate.appDelegate.storeId
            };

            using (var db = new SQLite.SQLiteConnection(DbPath))
            {
                var existingRecord = (db.Table <DealerValue>().Where(c => c.DealerLogin == record.DealerLogin)).SingleOrDefault();
                if (existingRecord != null)
                {
                    existingRecord.DealerLogin = record.DealerLogin;
                    existingRecord.StoreId     = record.StoreId;
                    db.Update(existingRecord);
                }
                else
                {
                    db.Insert(record);
                }
            }
        }
Esempio n. 2
0
 public void SetDealersTextBox()
 {
     DealerNumber_TextBox.Text = DealerValue.ToString();
 }