Esempio n. 1
0
        private void RefreshData()
        {
            if (dataContext != null)
            {
                dataContext.Dispose();
                dataContext = null;
            }
            dataContext = sessionContext.CreateDataContext();

            listView.BeginUpdate();
            listView.Items.Clear();

            var start = monthCalendar.SelectionRange.Start;
            var end = monthCalendar.SelectionRange.End.AddDays(1);

            var entries =
                from entry in dataContext.WorkEntries
                where entry.Start >= start && entry.Start < end
                orderby entry.Start
                select entry;

            foreach (var entry in entries)
            {
                var item = new ListViewItem();
                SetListViewItem(item, entry);
                listView.Items.Add(item);
            }

            listView.EndUpdate();
            UpdateActions();
        }
Esempio n. 2
0
 public virtual void Close()
 {
     if (dataContext != null)
     {
         dataContext.SubmitChanges();
         dataContext.Dispose();
         dataContext = null;
     }
 }
Esempio n. 3
0
        public override void LoadData()
        {
            Cursor.Current = Cursors.WaitCursor;

            DisposeDataContext();
            dataContext = SessionContext.CreateDataContext();

            listView.BeginUpdate();
            listView.Items.Clear();
            foreach (var activity in dataContext.Activities.OrderBy(a => a.ProjectEntity.Name).ThenBy(a => a.Name))
            {
                AddListViewItem(activity);
            }
            listView.EndUpdate();

            UpdateActions();
        }
Esempio n. 4
0
        public override void LoadData()
        {
            Cursor.Current = Cursors.WaitCursor;

            DisposeDataContext();
            dataContext = SessionContext.CreateDataContext();

            listView.BeginUpdate();
            listView.Items.Clear();
            foreach (var project in dataContext.Projects.OrderBy(p => p.Name))
            {
                AddListViewItem(project);
            }
            listView.EndUpdate();

            UpdateActions();
        }
Esempio n. 5
0
 private void DisposeDataContext()
 {
     if (dataContext != null)
     {
         dataContext.Dispose();
         dataContext = null;
     }
 }
Esempio n. 6
0
 public TrackWorkSimpleDialog(ISessionContext sessionContext)
     : this()
 {
     this.sessionContext = sessionContext;
     dataContext = sessionContext.CreateDataContext();
 }
Esempio n. 7
0
 protected void RefreshData()
 {
     if (dataContext != null)
     {
         dataContext.Dispose();
         dataContext = null;
     }
     dataContext = sessionContext.CreateDataContext();
     enableTracking = false;
     PerformBindings();
     UpdateActions();
     enableTracking = true;
 }
Esempio n. 8
0
        private void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            if (disposing)
            {
                if (dataContext != null)
                {
                    dataContext.SubmitChanges();
                    dataContext.Dispose();
                    dataContext = null;
                }
                buttonSave.Click -= new EventHandler(buttonSave_Click);
                buttonCancel.Click -= new EventHandler(buttonCancel_Click);
                bindingSource.ListChanged -= new ListChangedEventHandler(bindingSource_ListChanged);
            }

            disposed = true;
        }