コード例 #1
0
        public ActionResult CheckUserIn(int intUserID)
        {
            GetDAL get = new GetDAL();

            get.OpenConnection();

            Users u = get.GetUserByID(intUserID);

            get.CloseConnection();
            get.OpenConnection();
            List <AttendancePlanned> apList = get.GetAttendancePlannedByRehearsalPart(ChosenRehearsalPart); // join query here

            get.CloseConnection();

            InsertDAL insert = new InsertDAL();

            insert.OpenConnection();

            foreach (AttendancePlanned ap in apList)
            {
                if (u.Equals(ap.User))
                {
                    insert.InsertAttendanceActual(new AttendanceActual(DateTime.Now, true, ap));
                    UsersNotCurrentlyAtRehearsal.Remove(u);
                }
            }

            get.CloseConnection();

            insert.CloseConnection();

            return(RedirectToAction("Index"));
        }