public void GetViewFields()
        {
            SqliteConnector connector = new SqliteConnector(this.config);
            var             tables    = connector.GetFields("vAlbums").Result;

            Assert.IsTrue(tables.Any(x => x.Name == "Title"));
        }
Exemplo n.º 2
0
        private Icon generateIcon()
        {
            if (!File.Exists(currentFile))
            {
                return(null);
            }

            var apkFile = new ApkFile {
                LongFileName = currentFile
            };

            apkFile = SqliteConnector.ReadApkFile(apkFile);
            var iconAsByteArray = SqliteConnector.ReadIcon(apkFile);

            if (iconAsByteArray != null)
            {
                //Create stream from byte array
                var memoryStream = new MemoryStream(iconAsByteArray);

                //Create bitmap from stream
                var bitmap     = new Bitmap(memoryStream);
                var iconHandle = bitmap.GetHicon();

                //Dispose memorystream for GC Cleanup
                memoryStream.Close();
                memoryStream.Dispose();

                //Return Icon
                return(Icon.FromHandle(iconHandle));
            }

            return(null);
        }
        public void GetViews()
        {
            SqliteConnector connector = new SqliteConnector(this.config);
            var             tables    = connector.GetViews().Result;

            Assert.IsTrue(tables.Any(x => x == "vAlbums"));
        }
Exemplo n.º 4
0
        private void AppendOtherInfo(string packageName, string latestVersion, string googlePlayName, string price, string category, DateTime lastGooglePlayFetch)
        {
            //Update database
            var apkFileToUpdate = new ApkFile
            {
                PackageName = packageName,
                LatestVersion = latestVersion,
                GooglePlayName = googlePlayName,
                Price = price,
                Category = category,
                LastGooglePlayFetch = lastGooglePlayFetch,
                GooglePlayFetchFail = false
            };
            SqliteConnector.UpdateApkFile(apkFileToUpdate);

            foreach (ListViewItem lvi in lvMain.Items)
            {
                var apkFile = (ApkFile) lvi.Tag;
                if (apkFile.PackageName == packageName)
                {
                    lvi.SubItems[(int)ApkColumn.LatestVersion].Text = latestVersion;
                    apkFile.LatestVersion = latestVersion;
                    lvi.SubItems[(int)ApkColumn.GooglePlayName].Text = googlePlayName;
                    apkFile.GooglePlayName = googlePlayName;
                    lvi.SubItems[(int)ApkColumn.Price].Text = price;
                    apkFile.Price = price;
                    lvi.SubItems[(int)ApkColumn.Category].Text = category;
                    apkFile.Category = category;
                    lvi.SubItems[(int)ApkColumn.RefreshDate].Text = lastGooglePlayFetch.ToRelativeTimeString();
                    apkFile.LastGooglePlayFetch = lastGooglePlayFetch;

                    SetColorsForListViewItem(lvi);
                }
            }
        }
Exemplo n.º 5
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            if (ModifiedEntries.Count > 0)
            {
                SqliteConnector db = SqliteConnector.SqliteDB;
                using (SQLiteConnection con = db.Connect())
                {
                    foreach (CountEntry en in ModifiedEntries)
                    {
                        en.Sync = CountEntry.SyncStatus.NEW;
                        db.Update(con, en);
                    }
                }
            }

            double acc = 0;

            foreach (CountEntry en in CountEntries)
            {
                acc += en.Value;
            }

            SelectedArticle.CountedQuantity = acc;
            SelectedArticle.LabelCount      = CountEntries.Count;


            DialogResult = DialogResult.OK;
            Close();
        }
Exemplo n.º 6
0
        public async Task <int> InsertTransactionAsync(TransactionEntity transactionEntity, bool isUserPerformed = false)
        {
            string query = "INSERT INTO `Transaction`" +
                           "(`TransactionPartyId`,`Amount`,`IsIncome`,`TransactionDateTime`,`ScheduledTransactionId`,`Remarks`,`CreatedDateTime`,`IsUserPerformed`) " +
                           "VALUES (@TransactionPartyId,@Amount,@IsIncome,@TransactionDateTime,@ScheduledTransactionId,@Remarks,@CreatedDateTime,@IsUserPerformed);";

            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@TransactionPartyId", transactionEntity.TransactionPartyId),
                new KeyValuePair <string, object>("@Amount", transactionEntity.Amount),
                new KeyValuePair <string, object>("@IsIncome", transactionEntity.IsIncome ? 1 : 0),
                new KeyValuePair <string, object>("@TransactionDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionEntity.TransactionDateTime)),
                new KeyValuePair <string, object>("@ScheduledTransactionId", transactionEntity.ScheduledTransactionId),
                new KeyValuePair <string, object>("@Remarks", transactionEntity.Remarks),
                new KeyValuePair <string, object>("@CreatedDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(transactionEntity.CreatedDateTime)),
                new KeyValuePair <string, object>("@IsUserPerformed", isUserPerformed ? 1 : 0)
            };

            int id = await SqliteConnector.ExecuteInsertQueryAsync(query, parameters, true);

            query = "UPDATE `Transaction` SET `ReferenceNumber`=@ReferenceNumber WHERE `Id`=@Id";

            parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@ReferenceNumber", id.ToString("TC00000000")),
                new KeyValuePair <string, object>("@Id", id)
            };

            await SqliteConnector.ExecuteNonQueryAsync(query, parameters, true);

            return(id);
        }
Exemplo n.º 7
0
        public async Task <int> InsertTaskAsync(OneTimeTasks task, bool isUserPerformed = false)
        {
            string query = "INSERT INTO `OneTimeTasks`" +
                           "(`Type`,`Comments`,`Duration`,`CreatedUser`,`CreatedDateTime`,`IsDelete`,`Effectivedate`) " +
                           "VALUES (@Type,@Comments,@Duration,@CreatedUser,@CreatedDateTime,@IsDelete,@Effectivedate);";

            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@Type", task.Type),
                new KeyValuePair <string, object>("@Comments", task.Comments),
                new KeyValuePair <string, object>("@Duration", task.Duration),
                new KeyValuePair <string, object>("@CreatedUser", task.CreatedUser),
                new KeyValuePair <string, object>("@Effectivedate", TimeConverterMethods.ConvertDateTimeToTimeStamp(task.Effectivedate)),
                new KeyValuePair <string, object>("@CreatedDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(task.CreatedDateTime)),
                new KeyValuePair <string, object>("@IsDelete", 0)
            };

            int id = await SqliteConnector.ExecuteInsertQueryAsync(query, parameters, true);

            query = "UPDATE `OneTimeTasks` SET `ReferenceNumber`=@ReferenceNumber WHERE `Id`=@Id";

            parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@ReferenceNumber", id.ToString("OTASK000000")),
                new KeyValuePair <string, object>("@Id", id)
            };

            await SqliteConnector.ExecuteNonQueryAsync(query, parameters, true);

            return(id);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Constructor used for using an existend SqliteConnection
 /// creates an empty List of Log
 /// fills properties
 /// creates the LocalLogger instance
 /// </summary>
 /// <param name="fip">FnLogInitPackage</param>
 /// <param name="con">for integration in a existing sqlite db</param>
 internal FnLog(FnLogInitPackage fip, SqliteConnector con)
 {
     _logs             = new List <Log>();
     _fnLogInitPackage = fip;
     fip.FileName      = "";
     _localLog         = new LocalLogger(con);
 }
        public static PostureInformation loadPosture(String name)
        {
            Vector3[] joints = new Vector3[20];
            int index = 0;
            SqliteConnector conn = new SqliteConnector();
            string postid = conn.postureGetId(name);
            if (postid == "")
            {
                conn.CloseConnection();
                return null;
            }
            Tuple<string,string,string> tPost = conn.postureGetData(name);
            if (tPost == null)
            {
                conn.CloseConnection();
                return null;
            }
            List<Tuple<string, string, string, string>> tJoint= conn.postureGetJoints(postid);
            if (tJoint.Count!=20)
            {
                conn.CloseConnection();
                return null;
            }

            foreach (Tuple<string, string, string, string> joint in tJoint)
            {
                joints[System.Convert.ToInt16(joint.Item1)] = new Vector3(float.Parse(joint.Item2), float.Parse(joint.Item3), float.Parse(joint.Item4));
                index++;
            }

            PostureInformation postureI = new PostureInformation(tPost.Item1, tPost.Item2, System.Convert.ToInt16(tPost.Item3), joints);
            conn.CloseConnection();
            return postureI;
        }
Exemplo n.º 10
0
        public ActionResult Index()
        {
            List <CodeModel> program = new List <CodeModel>();

            program = SqliteConnector.LoadProgram();

            return(View(program));
        }
Exemplo n.º 11
0
        public ActionResult Details(int id)
        {
            MusicModel song = new MusicModel();

            song = SqliteConnector.LoadSongDetails(id).SingleOrDefault(x => x.Id == id);

            return(View(song));
        }
Exemplo n.º 12
0
        public ActionResult Index()
        {
            List <MusicModel> songs = new List <MusicModel>();

            songs = SqliteConnector.LoadSongs();

            return(View(songs));
        }
        public ZKTecoServiceControl(SqliteConnector connector, EventHub hub)
        {
            _db  = connector;
            _hub = hub;

            _signal = new ManualResetEvent(false);
            Logger  = HostLogger.Get <ZKTecoServiceControl>();
        }
Exemplo n.º 14
0
 private void LoadScanFolders()
 {
     lstScanFolders.Items.Clear();
     foreach (var s in SqliteConnector.GetScanFolders())
     {
         lstScanFolders.Items.Add(s);
     }
 }
Exemplo n.º 15
0
        private void btnRemoveFolder_Click(object sender, EventArgs e)
        {
            lstScanFolders.Items.RemoveAt(lstScanFolders.SelectedIndex);
            var scanFolders = (from object item in lstScanFolders.Items select item.ToString()).ToList();

            SqliteConnector.SetScanFolders(scanFolders);
            SettingsChanged = true;
        }
Exemplo n.º 16
0
 public static void InitializeConnection(bool database)
 {
     if (database)
     {
         // set up sqlite connector
         SqliteConnector sql = new SqliteConnector();
         Connections.Add(sql);
     }
 }
Exemplo n.º 17
0
        public async Task <UserEntity> GetUserDetailsAsync()
        {
            string query = "SELECT `Id`,`FirstName`,`LastName`,`RegisteredDateTime`,`StartingAmount`,`CurrentBalance`,`LastCheckDateTime` FROM `User` WHERE `SID` = @SID";
            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@SID", System.Security.Principal.WindowsIdentity.GetCurrent().User.Value.ToString()),
            };

            return(await SqliteConnector.ExecuteQuerySingleOrDefaultAsync(query, ReaderToEntity, parameters));
        }
Exemplo n.º 18
0
        protected void DataBind()
        {
            SqliteConnector db = SqliteConnector.SqliteDB;

            using (SQLiteConnection con = db.Connect())
            {
                CountEntries = db.GetCountEntries(con, SelectedArticle.Itmref);
                dataGridViewCounts.DataSource = CountEntries;
            }
        }
Exemplo n.º 19
0
        public EventHub(SqliteConnector db)
        {
            Database = db;

            Subscribers = new ConcurrentDictionary <EventType, List <IEventHandler> >();
            Logger      = HostLogger.Get <EventHub>();

            Timer          = new System.Timers.Timer(10000);
            Timer.Elapsed += OnHandleEventMessages;
        }
Exemplo n.º 20
0
        public async Task <TransactionPartyEntity> GetTransactionPartyByIdAsync(int id)
        {
            string query = "SELECT * FROM `TransactionParty` WHERE `Id` = @Id";
            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@Id", id)
            };

            return(await SqliteConnector.ExecuteQuerySingleOrDefaultAsync(query, ReaderToEntity, parameters));
        }
Exemplo n.º 21
0
        public async Task <ScheduledTasks> GetScheduledTasksByIdAsync(int id)
        {
            string query = "SELECT * FROM `ScheduledTasks` WHERE `Id` = @Id";
            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@Id", id)
            };

            return(await SqliteConnector.ExecuteQuerySingleOrDefaultAsync(query, ReaderToEntitySheduledTask, parameters));
        }
Exemplo n.º 22
0
 private void LoadCommands()
 {
     lvwCommands.Items.Clear();
     foreach (var cd in SqliteConnector.GetCommands())
     {
         var ci = new ListViewItem(cd.Title);
         ci.Tag = cd;
         ci.SubItems.Add(cd.Command);
         lvwCommands.Items.Add(ci);
     }
 }
Exemplo n.º 23
0
 private void CheckNewGroupSub()
 {
     if (Convert.ToBoolean(SqliteConnector.GetSettingValue(SettingEnum.SubdirGroup)))
     {
         _newGroupSub = true;
     }
     else
     {
         _newGroupSub = false;
     }
 }
Exemplo n.º 24
0
	    private void CheckGroupResults()
        {
            if (Convert.ToBoolean(SqliteConnector.GetSettingValue(SettingEnum.GroupResults)))
            {
                _groupResults = true;
            }
            else
            {
                _groupResults = false;
            }
        }
Exemplo n.º 25
0
        public async Task <int> UpdateUserLastCheckDateTimeAsync(DateTime dateTime)
        {
            string query = @"UPDATE `User` SET `LastCheckDateTime`=@LastCheckDateTime;";

            IList <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@LastCheckDateTime", TimeConverterMethods.ConvertDateTimeToTimeStamp(dateTime))
            };

            return(await SqliteConnector.ExecuteNonQueryAsync(query, parameters : parameters, true));
        }
Exemplo n.º 26
0
        public async Task <int> UpdateUserCurrentBalanceAsync(double balance)
        {
            string query = @"UPDATE `User` SET `CurrentBalance`=@CurrentBalance;";

            IList <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@CurrentBalance", balance)
            };

            return(await SqliteConnector.ExecuteNonQueryAsync(query, parameters : parameters, true));
        }
Exemplo n.º 27
0
        private void UpdateDetailPanel()
	    {
			var apkFile = (ApkFile)lvMain.SelectedItems[0].Tag;

		    lblFilenameValue.Text = apkFile.ShortFileName;
		    lblPackageNameValue.Text = apkFile.PackageName;
		    lblInternalNameValue.Text = apkFile.InternalName;
		    lblGooglePlayNameValue.Text = apkFile.GooglePlayName;
		    lblCategoryValue.Text = apkFile.Category;
		    lblLocalVersionValue.Text = apkFile.LocalVersion;
		    lblLatestVersionValue.Text = apkFile.LatestVersion;
		    lblPriceValue.Text = apkFile.Price;
			lblVersionCodeValue.Text = apkFile.VersionCode;
			lblMinSdkVersionValue.Text = clsUtils.TranslateSdkVersion(apkFile.MinimumSdkVersion);
			lblTargetSdkVersionValue.Text = clsUtils.TranslateSdkVersion(apkFile.TargetSdkVersion);
			if (apkFile.ScreenSizes.Count > 0)
			{
				lblScreenSizesValue.Text = string.Empty;
				foreach (var screenSize in apkFile.ScreenSizes)
				{
					lblScreenSizesValue.Text += string.Format("{0}, ", screenSize);
				}
				lblScreenSizesValue.Text = lblScreenSizesValue.Text.Remove(lblScreenSizesValue.Text.Length - 2, 2);
			}
			if (apkFile.ScreenDensities.Count > 0)
			{
				lblScreenDensitiesValue.Text = string.Empty;
				foreach (var screenDensity in apkFile.ScreenDensities)
				{
					lblScreenDensitiesValue.Text += string.Format("{0}, ", screenDensity);
				}
				lblScreenDensitiesValue.Text = lblScreenDensitiesValue.Text.Remove(lblScreenDensitiesValue.Text.Length - 2, 2);
			}
			if (apkFile.Permissions.Count > 0)
			{
				txtPermissionsValue.Text = string.Empty;
				foreach (var permission in apkFile.Permissions)
				{
					txtPermissionsValue.Text += string.Format("{0}\r\n", permission);
				}
				txtPermissionsValue.Text = txtPermissionsValue.Text.Remove(txtPermissionsValue.Text.Length - 2, 2);
			}
			if (apkFile.Features.Count > 0)
			{
				txtFeaturesValue.Text = string.Empty;
				foreach (var feature in apkFile.Features)
				{
					txtFeaturesValue.Text += string.Format("{0}\r\n", feature);
				}
				txtFeaturesValue.Text = txtFeaturesValue.Text.Remove(txtFeaturesValue.Text.Length - 2, 2);
			}

            Task.Factory.StartNew(() => SqliteConnector.ReadIcon(apkFile)).ContinueWith(t => SetApkIcon(t.Result));
	    }
 public static PostureInformation[] getPostureList()
 {
     List<PostureInformation> allPostures = new List<PostureInformation>();
     SqliteConnector conn = new SqliteConnector();
     List<string> names = conn.postureGetNames();
     foreach (string n in names)
     {
             allPostures.Add(loadPosture(n));
     }
     conn.CloseConnection();
     return allPostures.ToArray();
 }
Exemplo n.º 29
0
        private void btnAddFolder_Click(object sender, EventArgs e)
        {
            var oFbd = new FolderBrowserDialog();

            if (oFbd.ShowDialog() == DialogResult.OK)
            {
                lstScanFolders.Items.Add(oFbd.SelectedPath);
                var scanFolders = (from object item in lstScanFolders.Items select item.ToString()).ToList();
                SqliteConnector.SetScanFolders(scanFolders);
                SettingsChanged = true;
            }
        }
Exemplo n.º 30
0
 private void LoadExtendedInfo()
 {
     if (Convert.ToBoolean(SqliteConnector.GetSettingValue(SettingEnum.AutoFetchGooglePlay)))
     {
         var packageNames = SqliteConnector.GetNewPackageNamesFromHashes(_hashes);
         RefreshPackages(packageNames);
     }
     else
     {
         FinishSearch();
     }
 }
Exemplo n.º 31
0
        public async void UpdateNextTransactionDate(int id, DateTime dtAddDates)
        {
            string query = "UPDATE `ScheduledTasks` SET `Effectivedate`=@Effectivedate WHERE `Id`=@Id";

            IEnumerable <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >()
            {
                new KeyValuePair <string, object>("@Id", id),
                new KeyValuePair <string, object>("@Effectivedate", TimeConverterMethods.ConvertDateTimeToTimeStamp(dtAddDates))
            };

            await SqliteConnector.ExecuteNonQueryAsync(query, parameters, true);
        }
Exemplo n.º 32
0
        /// <summary>
        /// public constructor
        /// Creates or opens the *.db
        /// May create missing tables
        /// Uses the Cpu1 id for encryption
        /// </summary>
        internal ManastoneDatabase()
        {
            // _con = new SqliteConnector("Manastone.db"); //DEBUG
            _con = new SqliteConnector("Manastone.db", Ident.GetCPUId());
            Log  = new FnLog.FnLog(new FnLog.FnLog.FnLogInitPackage("https://app.fearvel.de:9020/",
                                                                    "MANASTONE", Version.Parse(ManastoneClient.ClientVersion), FnLog.FnLog.TelemetryType.LogLocalSendAll, "", ""),
                                   _con);
            CreateTables();
            LoadLicenseInformation();

            Log.AddToLogList(FnLog.FnLog.LogType.DrmDatabaseLog, "Manastone DB INIT Complete", "");
        }
 public static Boolean storePosture(PostureInformation p)
 {
     SqliteConnector conn = new SqliteConnector();
     if (conn.postureGetId(p.name) != "")
     {
         conn.CloseConnection();
         return false;
     }
     conn.insert("INSERT INTO POSTURE (NAME,DESCRIPTION,DIFFICULTY) VALUES ('" + p.name + "','" + p.description + "'," + System.Convert.ToString(p.difficulty) + ")");
     string postid = conn.postureGetId(p.name);
     int index = 0;
     foreach (Vector3 v in p.joints)
     {
         conn.insert("INSERT INTO JOINT (ID_POSTURE,JOINT_ORDER,X,Y,Z) VALUES (" + postid + "," + index + "," + v.X.ToString().Replace(",", ".") + "," + v.Y.ToString().Replace(",", ".") + "," + v.Z.ToString().Replace(",", ".") + ")");
         index++;
     }
     conn.CloseConnection();
     return true;
 }