public ActionResult Process(DeleteMeeting model)
 {
     model.UpdateLongRunningOp(DbUtil.Db, DeleteMeeting.Op);
     if (!model.Started.HasValue)
     {
         DbUtil.LogActivity($"Add to org from tag for {Session["ActiveOrganization"]}");
         model.Process(DbUtil.Db);
     }
     return View(model);
 }
Esempio n. 2
0
        private static void DoWork(DeleteMeeting model)
        {
            Thread.CurrentThread.Priority = ThreadPriority.BelowNormal;
            var db  = DbUtil.Create(model.host);
            var cul = db.Setting("Culture", "en-US");

            Thread.CurrentThread.CurrentUICulture = new CultureInfo(cul);
            Thread.CurrentThread.CurrentCulture   = CultureInfo.CreateSpecificCulture(cul);

            LongRunningOp lop = null;

            foreach (var pid in model.pids)
            {
                db.Dispose();
                db = DbUtil.Create(model.host);
                Attend.RecordAttendance(db, pid, model.Id, false);
                lop = FetchLongRunningOp(db, model.Id, Op);
                Debug.Assert(lop != null, "r != null");
                lop.Processed++;
                db.SubmitChanges();
            }
            db.ExecuteCommand(@"
DELETE dbo.SubRequest 
FROM dbo.SubRequest sr
JOIN dbo.Attend a ON a.AttendId = sr.AttendId
WHERE a.MeetingId = {0}
", model.Id);
            db.ExecuteCommand("DELETE dbo.VolRequest WHERE MeetingId = {0}", model.Id);
            db.ExecuteCommand("DELETE dbo.attend WHERE MeetingId = {0}", model.Id);
            db.ExecuteCommand("DELETE dbo.MeetingExtra WHERE MeetingId = {0}", model.Id);
            db.ExecuteCommand("DELETE dbo.meetings WHERE MeetingId = {0}", model.Id);

            db.SubmitChanges();

            // finished
            lop           = FetchLongRunningOp(db, model.Id, Op);
            lop.Completed = DateTime.Now;
            db.SubmitChanges();
        }
Esempio n. 3
0
        private static void DoWork(DeleteMeeting model)
        {
            Thread.CurrentThread.Priority = ThreadPriority.BelowNormal;
            var db = DbUtil.Create(model.host);
            var cul = db.Setting("Culture", "en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(cul);
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(cul);

            LongRunningOp lop = null;
            foreach (var pid in model.pids)
            {
                db.Dispose();
                db = DbUtil.Create(model.host);
                Attend.RecordAttendance(db, pid, model.Id, false);
                lop = FetchLongRunningOp(db, model.Id, Op);
                Debug.Assert(lop != null, "r != null");
                lop.Processed++;
                db.SubmitChanges();
            }
            db.ExecuteCommand(@"
DELETE dbo.SubRequest 
FROM dbo.SubRequest sr
JOIN dbo.Attend a ON a.AttendId = sr.AttendId
WHERE a.MeetingId = {0}
", model.Id);
            db.ExecuteCommand("DELETE dbo.VolRequest WHERE MeetingId = {0}", model.Id);
            db.ExecuteCommand("DELETE dbo.attend WHERE MeetingId = {0}", model.Id);
            db.ExecuteCommand("DELETE dbo.MeetingExtra WHERE MeetingId = {0}", model.Id);
            db.ExecuteCommand("DELETE dbo.meetings WHERE MeetingId = {0}", model.Id);

            db.SubmitChanges();

            // finished
            lop = FetchLongRunningOp(db, model.Id, Op);
            lop.Completed = DateTime.Now;
            db.SubmitChanges();
        }
 public ActionResult Index(int id)
 {
     var model = new DeleteMeeting(id);
     model.RemoveExistingLop(DbUtil.Db, id, DeleteMeeting.Op);
     return View(model);
 }