Пример #1
0
        private SQLiteDataReader returnTimeIns()
        {
            clsLocalDB objLocalDB = new clsLocalDB(resStaticData.localDB);

            string SQL = "SELECT ID, PersonID, TimeIn";

            SQL = SQL + " FROM remoteTime";
            SQL = SQL + " WHERE TimeIn_Added='false'";

            SQLiteDataReader objReader = objLocalDB.returnDataReader(SQL);

            return(objReader);
        }
Пример #2
0
        private SQLiteDataReader returnTimeOuts()
        {
            clsLocalDB objLocalDB = new clsLocalDB(resStaticData.localDB);
            string     SQL        = "SELECT ID, MySQL_ID, TimeOut";

            SQL = SQL + " FROM remoteTime";
            SQL = SQL + " WHERE TimeOut is not null";
            SQL = SQL + " AND TimeOut_Added= 'false'";
            SQL = SQL + " AND MySQL_ID is not null";

            SQLiteDataReader objReader = objLocalDB.returnDataReader(SQL);

            return(objReader);
        }
Пример #3
0
        private void updateRemoteDB(List <Times> objQueries, string strType)
        {
            clsRemoteDB objRemoteDB = new clsRemoteDB();
            clsLocalDB  objLocalDB  = new clsLocalDB(resStaticData.localDB);

            int    totalIns = 0, totalOuts = 0;
            clsLog objLog = new clsLog();

            foreach (Times i in objQueries)
            {
                string Query    = i.Query;
                int    SQLiteID = i.SQLite_ID;

                int Rows;

                if (strType == "TimeIn")
                {
                    int MySQL_ID = objRemoteDB.Update_MySQL(Query, "TimeIn");
                    if (MySQL_ID != -1)
                    {
                        objLocalDB.addMySQLID(MySQL_ID, SQLiteID);
                        totalIns++;
                    }
                    else
                    {
                        objLog.writeToLog("There was an error adding sqlite_ID = " + SQLiteID.ToString() + " to remoteDB.");
                        totalIns--;
                    }
                }
                else if (strType == "TimeOut")
                {
                    Rows = objRemoteDB.Update_MySQL(Query, "TimeOut");
                    if (Rows > 0)
                    {
                        objLocalDB.updateTimeOut_Added(SQLiteID);
                        totalOuts++;
                    }
                    else
                    {
                        totalOuts--;
                    }
                }
            }

            objLog.writeToLog(returnLogMsg(totalOuts + totalIns, strType));
        }