Пример #1
0
        public ActionResult CreateMeetings(DateTime dt, bool noautoabsents, OrgSearchModel model)
        {
            var orgIds = model.FetchOrgs().Select(oo => oo.OrganizationId).ToList();

            foreach (var oid in orgIds)
            {
                var db = DbUtil.Create(Util.Host);
                Meeting.FetchOrCreateMeeting(CurrentDatabase, oid, dt, noautoabsents);
                CurrentDatabase.Dispose();
            }
            DbUtil.LogActivity("Creating new meetings from OrgSearch");
            return(Content("done"));
        }
Пример #2
0
        public ActionResult Index(HttpPostedFileBase file, bool noupdate)
        {
            string host          = Util.Host;
            var    runningtotals = new UploadPeopleRun {
                Started = DateTime.Now, Count = 0, Processed = 0
            };

            CurrentDatabase.UploadPeopleRuns.InsertOnSubmit(runningtotals);
            CurrentDatabase.SubmitChanges();
            var pid = Util.UserPeopleId;

            var package = new ExcelPackage(file.InputStream);

            HostingEnvironment.QueueBackgroundWorkItem(ct =>
            {
                try
                {
                    var db = DbUtil.Create(host);

                    var m = new UploadPeopleModel(host, pid ?? 0, noupdate, testing: true);
                    m.DoUpload(package);
                    CurrentDatabase.Dispose();
                    db = DbUtil.Create(host);

                    runningtotals = new UploadPeopleRun {
                        Started = DateTime.Now, Count = 0, Processed = 0
                    };
                    db.UploadPeopleRuns.InsertOnSubmit(runningtotals);
                    db.SubmitChanges();

                    m = new UploadPeopleModel(host, pid ?? 0, noupdate);
                    m.DoUpload(package);
                }
                catch (Exception ex)
                {
                    //CurrentDatabase.Dispose();
                    var db = DbUtil.Create(host);

                    var q = from r in db.UploadPeopleRuns
                            where r.Id == db.UploadPeopleRuns.Max(rr => rr.Id)
                            select r;
                    Elmah.ErrorLog.GetDefault(null).Log(new Elmah.Error(ex));
                    var rt   = q.Single();
                    rt.Error = ex.Message.Truncate(200);
                    db.SubmitChanges();
                }
            });
            return(Redirect("/UploadPeople/Progress"));
        }
Пример #3
0
        private bool disposedValue = false; // To detect redundant calls

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    CurrentDatabase.Dispose();
                    CurrentImageDatabase.Dispose();
                }

                // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
                // TODO: set large fields to null.

                disposedValue = true;
            }
        }