コード例 #1
0
        void saveStaffEntranceTime()
        {
            staffActivity          = new cStaffActivities();
            staffActivity.sqlQuery = "insert into STAFFACTIVITY (staffID, entranceTime, exitTime)"
                                     + " values ((select staffID from STAFFS where STAFFS.staffUserName = @userName), @entrance, @exit)";

            staffActivity.userName     = CBoxUserNames.SelectedItem.ToString();
            staffActivity.entranceTime = DateTime.Now;
            staffActivity.exitTime     = DateTime.Now;

            staffActivity.insertStaffActivity();
        }
コード例 #2
0
        void saveStaffExitTime()
        {
            cStaffActivities staffActivity = new cStaffActivities();

            staffActivity.sqlQuery = "update STAFFACTIVITY set exitTime = @exit "
                                     + "where STAFFACTIVITY.staffID = (select top 1 STAFFACTIVITY.staffID from STAFFACTIVITY inner join "
                                     + "STAFFS on STAFFS.staffID = STAFFACTIVITY.staffID where staffUserName = @userName) and "
                                     + "entranceTime = (select top 1 entranceTime from STAFFACTIVITY inner join STAFFS on "
                                     + "STAFFS.staffID = STAFFACTIVITY.staffID where staffUserName = @userName order by entranceTime desc)";
            staffActivity.exitTime = DateTime.Now;
            staffActivity.userName = userName;
            staffActivity.updateStaffActivity();
        }