Beispiel #1
0
 public ReportGenerator(EmployeeDB employeeDb, ReportFormatEmployees format, IDBHandler dbhandler)
 {
     if (employeeDb == null) throw new ArgumentNullException("employeeDb");
     _currentOutputFormat = format;
     _employeeDb = employeeDb;
     this.dbhandler = dbhandler;
 }
Beispiel #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            _dbHandler = _dbHandlerFactory.CreateDBHandler();
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            _listView            = FindViewById <ListView>(Resource.Id.listTasksView);
            _listView.ItemClick += ListView_ItemClick;
            var swipeContainer = FindViewById <SwipeRefreshLayout>(Resource.Id.slSwipeContainer);

            swipeContainer.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloRedLight);
            swipeContainer.Refresh += SwipeContainer_Refresh;
            var searchView = FindViewById <SearchView>(Resource.Id.searchView);

            searchView.QueryTextSubmit += SearchView_QueryTextSubmit;
            searchView.Close           += SearchView_Close;
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);
            ActionBar.Title = "Tasks";
            _dbHandler.Init();
            _data = _dbHandler.GetTasks();
            var accessTokenPropery = _dbHandler.GetSetting(ACCESS_TOKEN_PROP);

            if (accessTokenPropery != null)
            {
                _accessToken = accessTokenPropery.Value;
            }
            RenderItems(_listView, _data);
        }
Beispiel #3
0
        private ToolStripMenuItem GetToolStripMenuItem(IDBHandler DBHandler)
        {
            var menuItem = new ToolStripMenuItem(DBHandler.DisplayName);

            menuItem.Click += ConnectServerMenuItem_Click;
            menuItem.Tag    = DBHandler;
            menuItem.Image  = global::Techphernalia.DBInvader.Properties.Resources.SQLServer_5728;

            var connectItem = new ToolStripMenuItem("Connect");

            connectItem.Click += ConnectServerMenuItem_Click;
            connectItem.Tag    = DBHandler;
            connectItem.Image  = global::Techphernalia.DBInvader.Properties.Resources.SQLServer_5728;

            var deleteItem = new ToolStripMenuItem("Delete");

            deleteItem.Click += DeleteServerMenuItem_Click;
            deleteItem.Tag    = DBHandler;
            deleteItem.Image  = global::Techphernalia.DBInvader.Properties.Resources.Clearallrequests_8816;

            menuItem.DropDownItems.Add(connectItem);
            menuItem.DropDownItems.Add(deleteItem);

            return(menuItem);
        }
Beispiel #4
0
 public ReportGenerator(EmployeeDB employeeDb, ReportFormatEmployees format, IDBHandler dbhandler)
 {
     if (employeeDb == null)
     {
         throw new ArgumentNullException("employeeDb");
     }
     _currentOutputFormat = format;
     _employeeDb          = employeeDb;
     this.dbhandler       = dbhandler;
 }
Beispiel #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _db = new RealmHandler();

            SetContentView(Resource.Layout.Main);

            var recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);

            recyclerView.SetLayoutManager(new LinearLayoutManager(this));
        }
        /// need to check this for dispose call
        //public async Task RunPendingActivitiesJob(CancellationToken token)
        //{
        //    await Task.Run(async () =>
        //    {
        //        var pendingActivities = _dbHandler.GetAll();

        //        foreach (var bgActivity in pendingActivities)
        //        {
        //            await CompleteActivity(bgActivity);
        //            Device.BeginInvokeOnMainThread(() =>
        //            {
        //                MessagingCenter.Send<BGActivity>(bgActivity, AppHelper.BACKGROUND_ACTIVITY_MESSAAGE);
        //            });
        //        }
        //    }, token);
        //}

        public async Task <bool> CompleteActivity(BGActivity bgActivity)
        {
            IRestHandler <BGActivity> _restHandler = new RestHandler <BGActivity>(bgActivity.ServiceURL);
            var result = await _restHandler.TriggerPUT(bgActivity.TargetObjectId, bgActivity.TargetObjectJSON);

            if (result)
            {
                DeliveryVM.Instance.RefreshDeliveries();
                using (_dbHandler = SADFactory.GetDBHandler <BGActivity>())
                {
                    _dbHandler.DeleteItem(bgActivity.ActivityId);
                }
            }
            return(result);
        }
        internal static IDBHandler GetDBHandler(string displayName, string dbServerType, string connectionString)
        {
            var        dbServer = (DBServer)Enum.Parse(typeof(DBServer), dbServerType, true);
            IDBHandler handler  = null;

            switch (dbServer)
            {
            case DBServer.MssqlServer:
                handler             = new MssqlServerHandler(connectionString);
                handler.DisplayName = displayName;
                handler.Name        = handler.DisplayName;
                break;
            }
            return(handler);
        }
Beispiel #8
0
        protected override void OnResume()
        {
            base.OnResume();
            db = new RealmHandler();
            Person p = db.Read(Intent.GetIntExtra("id", 0)) as Person;

            if (p != null)
            {
                FindViewById <TextView>(Resource.Id.editPersonId).Text  = p.Id.ToString();
                FindViewById <EditText>(Resource.Id.editPersonFn).Text  = p.Fn;
                FindViewById <EditText>(Resource.Id.editPersonLn).Text  = p.Ln;
                FindViewById <EditText>(Resource.Id.editPersonAge).Text = p.Age.ToString();
            }

            FindViewById <Button>(Resource.Id.editPersonSaveBtn).Click += delegate { OnBackPressed(); };
        }
        public bool SaveActivity(BGActivity bGActivity)
        {
            int rowsEffected = -1;

            using (_dbHandler = SADFactory.GetDBHandler <BGActivity>())
            {
                var existingActivitys = _dbHandler.GetAll(a => a.TargetObjectId == bGActivity.TargetObjectId);

                if (existingActivitys.Count > 0)
                {
                    var existingActivity = existingActivitys.First();
                    _dbHandler.DeleteItem(existingActivity.ActivityId);
                }
                rowsEffected = _dbHandler.Add(bGActivity);
            }
            return(rowsEffected != -1);
        }
 public static void AddServer(IDBHandler dbHandler)
 {
     DBHandlers.Add(dbHandler);
     SaveConfig();
 }
Beispiel #11
0
 public ApuQueries(IDBHandler dBHandler)
 {
     this.dBHandler = dBHandler;
     this.filters   = new Filters();
 }
Beispiel #12
0
 public MessageRepository(IDBHandler idbHandler)
 {
     _idbHandler = idbHandler;
 }
Beispiel #13
0
 public static IEnumerable <Record> DBAdd(this IEnumerable <Record> items, IDBHandler handler, Action <IEnumerable <Record> > action, int bulkCount = 10000)
 => handler.Add(items, action, bulkCount);
Beispiel #14
0
 public SQLiteQueries(IDBHandler dBHandler)
 {
     this.dBHandler = dBHandler;
     filters        = new Filters();
 }
Beispiel #15
0
 public static IEnumerable <T> DBAdd <T>(this IEnumerable <T> items, IDBHandler handler, int bulkCount = 10000) where T : IEntity
 => handler.Add(items, bulkCount);
 internal static void DeleteServer(IDBHandler dbHandler)
 {
     DBHandlers.Remove(dbHandler);
     SaveConfig();
 }
 public DBExplorer(IDBHandler dbHandler)
 {
     InitializeComponent();
     this.DBHandler = dbHandler;
     this.Text      = " " + DBHandler.DisplayName + " - " + TP_CONSTANTS.DB_Invader;
 }
Beispiel #18
0
 public FollowRepository(IDBHandler idbHandler)
 {
     _idbHandler = idbHandler;
 }
Beispiel #19
0
 public DBSet(IDBHandler dBHandler)
 {
     Handler = dBHandler;
 }