Beispiel #1
0
        public ScheduledJob(DataLayer pDB, String JobID, String pUserPIN, String pOrderID, DateTime pStartTime, TimeSpan pDuration)
        {
            dbObj = pDB;
            _ScheduledJobID = JobID;
            _UserPIN = pUserPIN;
            _OrderID = pOrderID;
            _StartTime = pStartTime;
            _Duration = pDuration;

            _Dirty = false;

            String usequery = String.Format(dbObj.qAdapter["SPECIFICSCHEDULE"], JobID);
            DbConnection gotcon;
            DbCommand gotcommand = dbObj.GetCommand(out gotcon);
            gotcommand.CommandText = usequery;
            DbDataReader dreader = gotcommand.ExecuteReader();
            if (!dreader.HasRows)
            {
                //record not present, so create it now.
                dreader.Close();
                //Qlookup.Add("INSERTSCHEDULE", "INSERT INTO ScheduleData (`ScheduleJobID`,`UserPIN`,`OrderID`,`StartTime`,`Duration`) VALUES (\"{0}\",\"{1}\",\"{2}\",\"{3}\")");
                gotcommand.CommandText = String.Format(dbObj.qAdapter["INSERTSCHEDULE"], JobID, _UserPIN, OrderID, _StartTime.getSQLfmt(), _Duration.Ticks);
                gotcommand.ExecuteNonQuery();

            }
            dreader.Close();
        }
Beispiel #2
0
        public ScheduledJob(DataLayer pDB,String JobID)
        {
            _ScheduledJobID = JobID;
            dbObj = pDB;
            String usequery = String.Format(dbObj.qAdapter["SPECIFICSCHEDULE"],JobID);
            DbConnection gotcon;
            DbCommand gotcommand = dbObj.GetCommand(out gotcon);
            gotcommand.CommandText = usequery;
            DbDataReader dreader = gotcommand.ExecuteReader();
            if (!dreader.HasRows)
            {
                //record not present, so create it now.
                dreader.Close();
                //Qlookup.Add("INSERTSCHEDULE", "INSERT INTO ScheduleData (`ScheduleJobID`,`UserPIN`,`OrderID`,`StartTime`,`Duration`) VALUES (\"{0}\",\"{1}\",\"{2}\",\"{3}\")");
                gotcommand.CommandText = String.Format(dbObj.qAdapter["INSERTSCHEDULE"],JobID, "NULL", "NULL", "NULL", "0");
                gotcommand.ExecuteNonQuery();

            }
            dreader.Close();
            Update();
        }