示例#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();
        }
示例#2
0
        public override void PerformExport(DataLayer dbObject)
        {
            if(CSVTargetFile=="") return;
            //perform a export to Comma-Separated-Value file.
            //first, open the file. This should be rather obvious.
            FileStream dowritefile = new FileStream(CSVTargetFile,FileMode.Create);
            using (StreamWriter CSV = new StreamWriter(dowritefile))
            {
                /*
                     * The reporting module needs to provide reporting by date first then job number (we call job number: RO#),
             such as RO#0256251 Completed by Tech(s) Mike 00:26, John 00:12 AND by date first then user such as
             Mike completed: RO#0256251 00:26, RO#0256252 00:14 Total time: 00:40 (laid out in a column format of course,
              or an excel export if that is easier.) It also would be nice to have a text input box for searches by job number also.
                     * */

                //currently: Date first, then job number.
                //Date we will assume to be the "starting" date.
                //soooo first, retrieve all the orders, sorted by their starting date.

                List<String> allorders = dbObject.GetAllOrderIDs();

                //iterate through all these orders.
                CSV.WriteLine("RO#,Overall Time(HH:MM),Total User Time(HH:MM),Users,Active Users");
                foreach (String looporder in allorders)
                {
                    String buildline = "RO#" + looporder + ",";
                    TimeSpan TotalROTime = dbObject.GetOrderTime(looporder);
                    TimeSpan sumROTime = dbObject.GetTotalClockedTimeForOrder(looporder, false);
                    buildline += FormatTS(TotalROTime) + ",";

                    buildline += FormatTS(sumROTime) +",";

                    //now, summarize the total time spent by all the users on this order.

                    var gotuserdata = dbObject.GetUserDataFromOrder(looporder);

                    foreach (var looporderdata in gotuserdata)
                    {

                        buildline += looporderdata.Username + "(" + FormatTS(looporderdata.TotalTime) + ");";

                    }
                    buildline += ",";
                    gotuserdata = dbObject.GetUserDataFromOrder(looporder,true);
                    foreach (var looporderdata in gotuserdata)
                    {

                        buildline += looporderdata.Username + "(" + FormatTS(looporderdata.TotalTime) + ");";

                    }

                    CSV.WriteLine(buildline);

                }

                CSV.Close();

            }
        }
示例#3
0
        public CUserDataWatcher(DataLayer dbObject)
        {
            _RefreshTimems = dbObject.Configuration.MonitorRefreshDelay;
            //first, set our "initial" state.
            //optionally, we could not, then we would fire off a "useradded" event for every single user, though.

            database = dbObject;
            _LastUserList = new List<DataLayer.UserRecord>();
            _LastOrderState = new Dictionary<int, List<string>>();
            _LastActiveState = new Dictionary<int, bool>();

            Debug.Print("CUserdataWatcher: ms delay:" + _RefreshTimems);
            CheckChanges = new Timer(CheckChanged, null, 0, _RefreshTimems);
        }
示例#4
0
 public static OrderObject getOrder(DataLayer layerobject, String OrderID)
 {
     return new OrderObject(layerobject, OrderID);
 }
示例#5
0
 internal OrderObject(DataLayer dataobject, String OrderID)
 {
     dlayer=dataobject;
     _OrderID=OrderID;
 }
 public DropDownItemListViewCopyData(ListView plvw, ToolStripMenuItem pitem, DataLayer.ListViewStringConstants pCopyID,String pGroupName,
     Action<String, DropDownItemListViewCopyData> pactFunction)
 {
     lvw=plvw;
     item=pitem;
     CopyType = pCopyID;
     GroupColumnName = pGroupName;
     actFunction = pactFunction;
 }
示例#7
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();
        }
示例#8
0
        protected void InvokeWatchEvent(ChangeInfoConstants changetype, DataLayer.UserRecord oldRecord, DataLayer.UserRecord newRecord,Object extradata)
        {
            var copied = WatchEvent;
            if (copied != null)
            {
                copied(this, changetype, oldRecord, newRecord,extradata);

            }
        }
示例#9
0
            public static UserRecord CreateRecord(int pRecordID,DataLayer usedatabase)
            {
                //String recid = pRecordID;
                DbConnection usecon = usedatabase.GetConnection();
                DbCommand usecmd = usecon.CreateCommand();
                //select * from the record ID...
                usecmd.CommandText = String.Format("SELECT * FROM USERS WHERE `RecordID`=\"{0}\"", pRecordID);
                using (DbDataReader execreader = usecmd.ExecuteReader())
                {
                    if(execreader.HasRows)
                        if (execreader.Read())
                        {

                            //RecordID, Active, UserName, PINCode...
                            String uname = execreader.GetString(execreader.GetOrdinal("UserName"));
                            String PIN = execreader.GetString(execreader.GetOrdinal("PINCode"));
                            bool Activestate = (execreader.GetInt16(execreader.GetOrdinal("ACTIVE")) > 0);
                            return new UserRecord(pRecordID, PIN, uname, Activestate);

                        }

                }

                return null;
            }
示例#10
0
 public static User GetUser(DataLayer dbObject,String UserPIN)
 {
     return new User(dbObject,UserPIN);
 }
示例#11
0
 internal User(DataLayer dbObject, String UserPIN)
 {
     dbobj = dbObject;
     _UserPIN=UserPIN;
 }
示例#12
0
 public Schedules(DataLayer uselayer)
     : this()
 {
     _layer = uselayer;
 }