コード例 #1
0
ファイル: OrgDrop.cs プロジェクト: GSBCfamily/bvcms
        private void DoWork(OrgDrop 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 pids)
            {
                db.Dispose();
                db = DbUtil.Create(model.host);
                var om = db.OrganizationMembers.Single(mm => mm.PeopleId == pid && mm.OrganizationId == Id);
                if (DropDate.HasValue)
                    om.Drop(db, DropDate.Value);
                else
                    om.Drop(db);
                db.SubmitChanges();
                if (RemoveFromEnrollmentHistory)
                    db.ExecuteCommand("DELETE dbo.EnrollmentTransaction WHERE PeopleId = {0} AND OrganizationId = {1}", pid, Id);
                lop = FetchLongRunningOp(db, model.Id, Op);
                Debug.Assert(lop != null, "r != null");
                lop.Processed++;
                db.SubmitChanges();
                db.LogActivity($"Org{Group} Drop{(RemoveFromEnrollmentHistory ? " w/history" : "")}", Id, pid, UserId);
            }
            // finished
            lop = FetchLongRunningOp(db, model.Id, Op);
            lop.Completed = DateTime.Now;
            db.SubmitChanges();
        }
コード例 #2
0
 public ActionResult Process(OrgDrop model)
 {
     model.UpdateLongRunningOp(DbUtil.Db, OrgDrop.Op);
     if (!model.Started.HasValue)
         model.Process(DbUtil.Db);
     return View(model);
 }
コード例 #3
0
 public ActionResult Index(int id)
 {
     if (id != DbUtil.Db.CurrentOrgId0)
         throw new Exception($"Current org has changed from {id} to {DbUtil.Db.CurrentOrgId0}, aborting");
     var model = new OrgDrop(id);
     model.RemoveExistingLop(DbUtil.Db, id, OrgDrop.Op);
     return View(model);
 }
コード例 #4
0
        private static void DoWork(OrgDrop model)
        {
            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);

            LongRunningOperation lop = null;

            foreach (var pid in model.Pids)
            {
                //DbUtil.Db.Dispose();
                //db = DbUtil.Create(model.Host);
                var om = db.OrganizationMembers.Single(mm => mm.PeopleId == pid && mm.OrganizationId == model.filter.Id);
                if (model.DropDate.HasValue)
                {
                    om.Drop(db, model.DropDate.Value);
                }
                else
                {
                    om.Drop(db);
                }

                db.SubmitChanges();
                if (model.RemoveFromEnrollmentHistory)
                {
                    db.ExecuteCommand("DELETE dbo.EnrollmentTransaction WHERE PeopleId = {0} AND OrganizationId = {1}", pid, model.filter.Id);
                }

                lop = FetchLongRunningOperation(db, Op, model.QueryId);
                Debug.Assert(lop != null, "r != null");
                lop.Processed++;
                db.SubmitChanges();
                db.LogActivity($"Org{model.DisplayGroup} Drop{(model.RemoveFromEnrollmentHistory ? " w/history" : "")}", model.filter.Id, pid, uid: model.UserId);
            }
            // finished
            lop           = FetchLongRunningOperation(db, Op, model.QueryId);
            lop.Completed = DateTime.Now;
            db.SubmitChanges();
        }
コード例 #5
0
ファイル: OrgDrop.cs プロジェクト: marius310/bvcms
        private void DoWork(OrgDrop 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 pids)
            {
                db.Dispose();
                db = DbUtil.Create(model.host);
                var om = db.OrganizationMembers.Single(mm => mm.PeopleId == pid && mm.OrganizationId == Id);
                if (DropDate.HasValue)
                {
                    om.Drop(db, DropDate.Value);
                }
                else
                {
                    om.Drop(db);
                }
                db.SubmitChanges();
                if (RemoveFromEnrollmentHistory)
                {
                    db.ExecuteCommand("DELETE dbo.EnrollmentTransaction WHERE PeopleId = {0} AND OrganizationId = {1}", pid, Id);
                }
                lop = FetchLongRunningOp(db, model.Id, Op);
                Debug.Assert(lop != null, "r != null");
                lop.Processed++;
                db.SubmitChanges();
                db.LogActivity($"Org{Group} Drop{(RemoveFromEnrollmentHistory ? " w/history" : "")}", Id, pid, UserId);
            }
            // finished
            lop           = FetchLongRunningOp(db, model.Id, Op);
            lop.Completed = DateTime.Now;
            db.SubmitChanges();
        }
コード例 #6
0
 public ActionResult DropSingleMember(int orgId, int peopleId)
 {
     var model = new OrgDrop();
     model.DropSingleMember(orgId, peopleId);
     return Content("ok");
 }