Ejemplo n.º 1
0
        public void onCreateDatabase()
        {
            var            pathToDatabase = Path.Combine(path, "JewelleryMortgageLocalDB.db");
            SQLiteDatabase sqlDB          = SQLiteDatabase.OpenOrCreateDatabase(pathToDatabase, null);
            string         query;

            query = "CREATE TABLE IF NOT EXISTS `SettingMobileApp` (`SrNo`	INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,	`CalculationDaysDifference`	INTEGER NOT NULL DEFAULT 0);";
            sqlDB.ExecSQL(query);


            var db = new SQLiteConnection(pathToDatabase);
            SettingMobileApp data = db.Query <SettingMobileApp>("Select * from SettingMobileApp where SrNo = '1'").FirstOrDefault();

            if (data != null)
            {
                _ObjSettingMobileAppModel.CalculationDaysDifference = data.CalculationDaysDifference;
            }
            else
            {
                _ObjSettingMobileAppModel.CalculationDaysDifference = 0;

                db.Insert(_ObjSettingMobileAppModel);
                db.Commit();
            }
        }
Ejemplo n.º 2
0
 public void LoadData()
 {
     try
     {
         var pathToDatabase               = Path.Combine(path, "JewelleryMortgageLocalDB.db");
         var dbSettingMobileApp           = new SQLiteConnection(pathToDatabase);
         SettingMobileApp DaysAddOrRemove = dbSettingMobileApp.Query <SettingMobileApp>("Select * from SettingMobileApp where SrNo = '1'").FirstOrDefault();
         if (DaysAddOrRemove != null)
         {
             _ObjSettingMobileAppModel.CalculationDaysDifference = DaysAddOrRemove.CalculationDaysDifference;
         }
         else
         {
             _ObjSettingMobileAppModel.CalculationDaysDifference = 0;
         }
     }
     catch (Exception e)
     {
         String E = e.ToString();
     }
 }