Exemplo n.º 1
0
 public MainForm()
 {
     Application.ApplicationExit += Application_ApplicationExit;
     InitializeComponent();
     _sessionHelper = new SessionHelper();
     _sessionHelper.OpenSession("APL");
     _sessionHelper.OpenSession("FHG");
     _cronDaemon.Start();
 }
Exemplo n.º 2
0
        public NewsItemEdit()
        {
            this.ShowInTaskbar = false;
            AllowDrop = true;
            _sessionHelper = new SessionHelper();

            InitializeComponent();
            PopulateForm();
        }
Exemplo n.º 3
0
 private void PopulateForm()
 {
     DataLayer.SessionHelper _sessionHelper = new SessionHelper();
     Repository<Guid, NewsItem> _newsItemRepo = new Repository<Guid, NewsItem>(_sessionHelper.GetSession("APL"));
     UnitOfWork _unitOfWork = new UnitOfWork(_sessionHelper.GetSessionFactory("APL"));
     var newsItems = _newsItemRepo.All().ToList();
     dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
     dataGridView1.CellContentDoubleClick += DataGridView1_CellContentDoubleClick;
     dataGridView1.ReadOnly = true;
     dataGridView1.DataSource = newsItems;
 }
Exemplo n.º 4
0
        public NewsItemEdit(Guid newsItemId)
        {
            this.ShowInTaskbar = false;

            AllowDrop = true;
            _newsItemId = newsItemId;
            _sessionHelper = new SessionHelper();
            Repository<Guid, NewsItem> _newsItemRepo = new Repository<Guid, NewsItem>(_sessionHelper.GetSession("APL"));
            _newsItem = _newsItemRepo.FindBy(_newsItemId);
            InitializeComponent();
            PopulateForm();
        }
Exemplo n.º 5
0
        private System.Threading.Tasks.Task DoSync()
        {
            System.Threading.Tasks.Task t = new System.Threading.Tasks.Task(() =>
            {
                DataLayer.SessionHelper _sessionHelper = new SessionHelper();
                UnitOfWork _unitOfWork = new UnitOfWork(_sessionHelper.GetSessionFactory("APL"));
                Repository<Guid, Setting> _settingRepo = new Repository<Guid, APLBackendDB.Setting>(_unitOfWork.Session);
                Setting _settings = new Setting();

                SetStatusText("Starting sync...");

                Util.DBSync d = new Util.DBSync();
                d.ProgressUpdate += D_ProgressUpdate;

                SetStatusText("Syncing States...");
                d.SyncState();

                SetStatusText("Syncing Brands...");
                d.SyncBrand();

                SetStatusText("Syncing Regions...");
                d.SyncRegion();

                SetStatusText("Syncing Venues...");
                d.SyncVenue();

                SetStatusText("Syncing Game Types...");
                d.SyncGameType();

                SetStatusText("Syncing Games...");
                d.SyncGame();

                SetStatusText("Syncing Customers...");
                d.SyncCustomer();

                SetStatusText("Sync Completed.");
                btSync.Enabled = true;

                Setting lastSync = _settingRepo.FindBy(p => (p.Keyname == "LastCompleteSync"));
                if (lastSync == null || string.IsNullOrEmpty(lastSync.Value))
                {
                    lastSync = new Setting();
                    lastSync.Keyname = "LastCompleteSync";
                }
                lastSync.Value = DateTime.Now.ToString();

                _settingRepo.AddOrUpdate(lastSync);
                _unitOfWork.Commit();

            });
            t.Start();
            return t;
        }