Пример #1
0
        public Exambuddy2EFCoreDbContext CreateDbContext(string[] args)
        {
            var connectionString = HandyFunctions.GetConnectionString();
            var optionsBuilder   = new DbContextOptionsBuilder <Exambuddy2EFCoreDbContext>().UseSqlServer(connectionString);

            return(new Exambuddy2EFCoreDbContext(optionsBuilder.Options));
        }
Пример #2
0
 private void View_CreateCustomCurrentObjectDetailView(object sender,
                                                       CreateCustomCurrentObjectDetailViewEventArgs e)
 {
     if (e.ListViewCurrentObject is ThinResult currentRec)
     {
         currentRec.FatResults = HandyFunctions.MakeFatResults(currentRec.Id, View.ObjectSpace);
     }
 }
Пример #3
0
        protected override void OnDeactivated()
        {
            var os = (NonPersistentObjectSpace)ObjectSpace;

            os.ObjectsGetting -= os_ObjectsGetting;
            // View.CollectionSource.CriteriaApplied -= CollectionSource_CriteriaApplied;
            base.OnDeactivated();

            View.CreateCustomCurrentObjectDetailView -= View_CreateCustomCurrentObjectDetailView;
            HandyFunctions.DisposeAdditionalPersistentObjectSpace(Application, os);
        }
Пример #4
0
        protected override void OnActivated()
        {
            base.OnActivated();


            var os = (NonPersistentObjectSpace)ObjectSpace;

            HandyFunctions.AddPersistentOsToNonPersistentOs(Application, os, typeof(Thing));
            os.ObjectsGetting += os_ObjectsGetting;
            //  View.CollectionSource.CriteriaApplied += CollectionSource_CriteriaApplied;
            View.CreateCustomCurrentObjectDetailView += View_CreateCustomCurrentObjectDetailView;
        }
Пример #5
0
        private DateTime?RecordCurrentStartUtc()
        {
            // look for history record up to a millisecond before the current record
            if (!(View.CurrentObject is Answer ans))
            {
                return(null);
            }
            var sql = @$ "declare @dttime datetime
                select @dttime = getutcdate()
                update answers set answertext = answertext from answers where id = {ans.Id}
                select @dttime as Dt ";

            return(HandyFunctions.RunDateQuery(sql));
        }
Пример #6
0
        public object DataSource(object[] paramObjects)
        {
            using var connect = HandyFunctions.MakeContext();
            var fromDate = (DateTime)paramObjects[0];
            var toDate   = (DateTime)paramObjects[1];
            //var searchFor = (String)paramObjects[2];
            //searchFor = $"%{searchFor}%";
            //var sql = "select ";
            //var results = HandyFunctions.RunQuery(connect,sql, x => new AnswerResult { Num = (int)x[0] }, p1)
            //     connect.Database.ExecuteSqlRaw().SqlQuery<AnswerResult>("exec jtTaskSelectSQMOrderedReport @p0,@p1,@p2", fromDate, toDate, searchFor);
            var results = new  List <AnswerResult>();
            var output  = results.ToArray();

            return(output.ToList());
        }
Пример #7
0
        static void Main()
        {
#if EASYTEST
            DevExpress.ExpressApp.Win.EasyTest.EasyTestRemotingRegistration.Register();
#endif
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            EditModelPermission.AlwaysGranted = System.Diagnostics.Debugger.IsAttached;
            if (Tracing.GetFileLocationFromSettings() == DevExpress.Persistent.Base.FileLocation.CurrentUserApplicationDataFolder)
            {
                Tracing.LocalUserAppDataPath = Application.LocalUserAppDataPath;
            }
            Tracing.Initialize();
            Things6WindowsFormsApplication winApplication = new Things6WindowsFormsApplication();
            // Refer to the https://documentation.devexpress.com/eXpressAppFramework/CustomDocument112680.aspx help article for more details on how to provide a custom splash form.
            //winApplication.SplashScreen = new DevExpress.ExpressApp.Win.Utils.DXSplashScreen("YourSplashImage.png");
            SecurityAdapterHelper.Enable();
            if (ConfigurationManager.ConnectionStrings["ConnectionString"] != null)
            {
                winApplication.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
            }
#if EASYTEST
            if (ConfigurationManager.ConnectionStrings["EasyTestConnectionString"] != null)
            {
                winApplication.ConnectionString = ConfigurationManager.ConnectionStrings["EasyTestConnectionString"].ConnectionString;
            }
#endif
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached && winApplication.CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
            {
                winApplication.DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
            }
#endif
            try {
                // access db so it is created here.
                HandyFunctions.EnsureDatabaseIsCreated();
                // end of modification

                winApplication.Setup();
                winApplication.Start();
            }
            catch (Exception e) {
                winApplication.HandleException(e);
            }
        }
Пример #8
0
        protected override void OnSetupStarted()
        {
            base.OnSetupStarted();
            ConnectionString = HandyFunctions.GetConnectionString();

#if EASYTEST
            if (configuration.GetConnectionString("EasyTestConnectionString") != null)
            {
                ConnectionString = configuration.GetConnectionString("EasyTestConnectionString");
            }
#endif
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached && CheckCompatibilityType == CheckCompatibilityType.DatabaseSchema)
            {
                DatabaseUpdateMode = DatabaseUpdateMode.UpdateDatabaseAlways;
            }
#endif
        }