public static void DoWork(RepairTransactionsOrgs model)
        {
            var db = DbUtil.Create(model.host);

            db.CommandTimeout = 2200;
            var cul = db.Setting("Culture", "en-US");

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

            foreach (var orginfo in model.orginfos)
            {
                db.RepairTransactionsOrgs(orginfo.Id);
                lop = FetchLongRunningOp(db, model.Id, Op);
                Debug.Assert(lop != null, "r != null");
                lop.Processed++;
                lop.CustomMessage = $"Working on {orginfo.Name} ({orginfo.Id})";
                db.SubmitChanges();
            }
            // finished
            lop           = FetchLongRunningOp(db, model.Id, Op);
            lop.Completed = DateTime.Now;
            db.SubmitChanges();
        }
 public ActionResult Index(int id, OrgSearchModel osm)
 {
     var model = new RepairTransactionsOrgs(id);
     var orgIds = osm.FetchOrgs().Select(oo => oo.OrganizationId).ToArray();
     model.Orgs = string.Join(",", orgIds);
     model.Count = orgIds.Length;
     model.RemoveExistingLop(DbUtil.Db, id, RepairTransactionsOrgs.Op);
     return View(model);
 }
        public ActionResult Process(RepairTransactionsOrgs model)
        {
            model.UpdateLongRunningOp(DbUtil.Db, RepairTransactionsOrgs.Op);

            if (!model.Started.HasValue)
            { 
                DbUtil.LogActivity("Repair Transactions for Orgs");
                model.Process(DbUtil.Db);
            }
			return View(model);
		}
        public static void DoWork(RepairTransactionsOrgs 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 oid in model.Orgs.Split(',').Select(mm => mm.ToInt()))
		    {
	            db.RepairTransactionsOrgs(oid);
                lop = FetchLongRunningOp(db, model.Id, Op);
                Debug.Assert(lop != null, "r != null");
                lop.Processed++;
                db.SubmitChanges();
		    }
            // finished
            lop = FetchLongRunningOp(db, model.Id, Op);
            lop.Completed = DateTime.Now;
            db.SubmitChanges();
		}
 public static void DoWork(RepairTransactionsOrgs model)
 {
     var db = DbUtil.Create(model.host);
     db.CommandTimeout = 2200;
     var cul = db.Setting("Culture", "en-US");
     Thread.CurrentThread.CurrentUICulture = new CultureInfo(cul);
     Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(cul);
     LongRunningOp lop = null;
     foreach (var orginfo in model.orginfos)
     {
         db.RepairTransactionsOrgs(orginfo.Id);
         lop = FetchLongRunningOp(db, model.Id, Op);
         Debug.Assert(lop != null, "r != null");
         lop.Processed++;
         lop.CustomMessage = $"Working on {orginfo.Name} ({orginfo.Id})";
         db.SubmitChanges();
     }
     // finished
     lop = FetchLongRunningOp(db, model.Id, Op);
     lop.Completed = DateTime.Now;
     db.SubmitChanges();
 }
Exemple #6
0
        public static void DoWork(RepairTransactionsOrgs 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 oid in model.Orgs.Split(',').Select(mm => mm.ToInt()))
            {
                db.RepairTransactionsOrgs(oid);
                lop = FetchLongRunningOp(db, model.Id, Op);
                Debug.Assert(lop != null, "r != null");
                lop.Processed++;
                db.SubmitChanges();
            }
            // finished
            lop           = FetchLongRunningOp(db, model.Id, Op);
            lop.Completed = DateTime.Now;
            db.SubmitChanges();
        }