public void RegisterDemoApp(DocumentsDemoApp app) { DemoAppRegistryEntry entry = new DemoAppRegistryEntry(app); entry.UpdateLastUsageTime(); AppDictionary.AddOrUpdate(app.Id, entry, (appId, oldEntry) => entry); EnsureAppDisposingActivated(); }
public async Task <IHttpActionResult> GetAppDictionary(int id) { AppDictionary appDictionary = await _dbContext.AppDictionaries.FindAsync(id); if (appDictionary == null) { return(NotFound()); } return(Ok(appDictionary)); }
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; })); }
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(); } } }
/// <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; } }
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++; } }
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"; }
public async Task <bool> UpdateAppDictionaryAsync(AppDictionary appDictionary) { var dto = await _appDictionaryFactory.MapAppDictionaryToDto(appDictionary); return(await base.AddAsync(dto)); }
public void BindDictionaryData(AppDictionary appDictionary) { lblMale.Text = appDictionary.male; lblFemale.Text = appDictionary.female; plcName.Placeholder = appDictionary.namePlaceholder; }