Esempio n. 1
0
    public void RegisterDemoApp(DocumentsDemoApp app)
    {
        DemoAppRegistryEntry entry = new DemoAppRegistryEntry(app);

        entry.UpdateLastUsageTime();
        AppDictionary.AddOrUpdate(app.Id, entry, (appId, oldEntry) => entry);
        EnsureAppDisposingActivated();
    }
Esempio n. 2
0
        public async Task <IHttpActionResult> GetAppDictionary(int id)
        {
            AppDictionary appDictionary = await _dbContext.AppDictionaries.FindAsync(id);

            if (appDictionary == null)
            {
                return(NotFound());
            }

            return(Ok(appDictionary));
        }
Esempio n. 3
0
    public DocumentsDemoApp GetDemoApp(string appId)
    {
        DemoAppRegistryEntry entry;

        if (!AppDictionary.TryGetValue(appId, out entry))
        {
            return(null);
        }
        entry.UpdateLastUsageTime();
        return(entry.DemoApp);
    }
        public async Task <AppDictionaryDto> MapAppDictionaryToDto(AppDictionary appDictionary)
        {
            return(await Task.Run(() =>
            {
                var dto = new AppDictionaryDto();
                dto.Exit = appDictionary.exit;
                dto.Male = appDictionary.male;
                dto.Female = appDictionary.female;
                dto.Languages = appDictionary.languages;
                dto.NamePlaceholder = appDictionary.namePlaceholder;

                return dto;
            }));
        }
        public async Task <AppDictionary> MapDtoToAppDictionaryAsync(AppDictionaryDto dto)
        {
            return(await Task.Run(() =>
            {
                var obj = new AppDictionary();
                obj.namePlaceholder = dto.NamePlaceholder;
                obj.languages = dto.Languages;
                obj.male = dto.Male;
                obj.female = dto.Female;
                obj.exit = dto.Exit;

                return obj;
            }));
        }
Esempio n. 6
0
    void DisposeOldApps()
    {
        List <DemoAppRegistryEntry> appEntries = AppDictionary.Values.ToList();
        DateTime timeLowerBoundary             = DateTime.UtcNow.Subtract(AppDisposeTimeout);

        foreach (DemoAppRegistryEntry appEntry in appEntries)
        {
            if (appEntry.LastAccessTime <= timeLowerBoundary)
            {
                DemoAppRegistryEntry removedEntry;
                AppDictionary.TryRemove(appEntry.DemoApp.Id, out removedEntry);
                appEntry.DemoApp.Dispose();
            }
        }
    }
Esempio n. 7
0
 /// <summary>
 /// Fills Applications with data from the Application_IDs table.
 /// </summary>
 /// <param name="Applications"></param>
 public void GetApplications(AppDictionary Applications)
 {
     try
     {
         SqlCommand Cmd = GetCommand("PAY_Get_Applications");
         Applications.AddData(Cmd.ExecuteReader());
     }
     catch (Exception ex)
     {
         Logger.Log(ex);
     }
     finally
     {
         ApplicationInfoStamp = DateTime.Now;
     }
 }
Esempio n. 8
0
File: Nod.cs Progetto: eltoca03/Gxt
        public static void WriteToNod(ProfileObject obj)
        {
            Editor      ed    = Application.DocumentManager.MdiActiveDocument.Editor;
            Transaction trans = Application.DocumentManager.MdiActiveDocument.Database.TransactionManager.StartTransaction();

            using (trans)
            {
                if (!AppDictionary.IsWriteEnabled)
                {
                    AppDictionary.UpgradeOpen();
                }

                //create new Xrecord
                Xrecord xrecord = new Xrecord();
                //create the resbuf list
                ResultBuffer data = new ResultBuffer(new TypedValue((int)DxfCode.Text, obj.NodKey),
                                                     new TypedValue((int)DxfCode.Int64, obj.DistanceAtCrossing),
                                                     new TypedValue((int)DxfCode.Text, obj.Layer),
                                                     new TypedValue((int)DxfCode.Text, obj.LineType),
                                                     new TypedValue((int)DxfCode.Int32, obj.Depth));
                //add data to new record
                xrecord.Data = data;

                //create the entry to nod
                AppDictionary.SetAt(obj.NodKey, xrecord);

                try
                {
                    //add to transaction, if exist then handle in catch
                    trans.AddNewlyCreatedDBObject(xrecord, true);
                }
                catch
                {
                    //what todo when xrecord already exists
                }

                //all ok then commit
                trans.Commit();

                //increment object counter
                Count++;
            }
        }
Esempio n. 9
0
        private static void Main(string[] args)
        {
            string connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            var store = new AppDictionary(connectionString);

            store["Greeting"]  = "hello";
            store["DateValue"] = DateTime.Today;
            store["BoolValue"] = true;
            store["IntValue"]  = 329;

            Console.WriteLine(store["Greeting"] as string);
            Console.WriteLine((DateTime)store["DateValue"]);
            Console.WriteLine((bool)store["BoolValue"]);
            Console.WriteLine((int)store["IntValue"]);
            Console.ReadLine();

            //var userSession = new SessionDictionary(connectionString, "adamo");
            //userSession["Greeting"] = "this be my hello to you";
        }
Esempio n. 10
0
        public async Task <bool> UpdateAppDictionaryAsync(AppDictionary appDictionary)
        {
            var dto = await _appDictionaryFactory.MapAppDictionaryToDto(appDictionary);

            return(await base.AddAsync(dto));
        }
Esempio n. 11
0
 public void BindDictionaryData(AppDictionary appDictionary)
 {
     lblMale.Text        = appDictionary.male;
     lblFemale.Text      = appDictionary.female;
     plcName.Placeholder = appDictionary.namePlaceholder;
 }