/// <summary> /// Initializes a new instance of the <see cref="PocoTableStore{T, TPartitionKey, TRowKey}" /> class. /// </summary> /// <param name="tableName">Name of the table.</param> /// <param name="storageConnectionString">The storage connection string.</param> /// <param name="keysConverter">The table converter.</param> /// <param name="tableStorageOptions">The table storage options.</param> /// <exception cref="ArgumentNullException">tableName /// or /// storageConnectionString /// or /// tableConverter</exception> public PocoTableStore(string tableName, string storageConnectionString, CalculatedKeysConverter <T, TPartitionKey, TRowKey> keysConverter, TableStorageOptions tableStorageOptions = null) { if (tableName == null) { throw new ArgumentNullException(nameof(tableName)); } if (storageConnectionString == null) { throw new ArgumentNullException(nameof(storageConnectionString)); } if (keysConverter == null) { throw new ArgumentNullException(nameof(keysConverter)); } _keysConverter = keysConverter; tableStorageOptions = tableStorageOptions ?? new TableStorageOptions(); _tableStore = new TableStore <DynamicTableEntity>(tableName, storageConnectionString, tableStorageOptions); }
/// <summary> /// Initializes a new instance of the <see cref="TrieSearch{T}"/> class. /// </summary> /// <param name="indexName">Name of the index. Index name must follow all Azure Table Storage rules for table name</param> /// <param name="storageConnectionString">The Azure storage connection string.</param> /// <param name="rowKeyProperty">The row key property.</param> /// <param name="maxNumberOfConnections">The maximum number of connections. Analysis using test data showed 100 connections to /// be the sweet spot, but you are encouraged to test this yourself. Set this to null to use the default value set by <see cref="ServicePointManager"/> /// </param> /// <param name="options">The options.</param> /// <exception cref="System.ArgumentException"> /// indexName /// or /// MinimumIndexLength /// or /// RowKey must be string /// or /// maxNumberOfConnections /// </exception> public TrieSearch(string indexName, string storageConnectionString, Expression <Func <T, object> > rowKeyProperty, int?maxNumberOfConnections = DefaultMaxNumberConnections, TrieSearchOptions options = null) { if (!Regex.IsMatch(indexName, "^[A-Za-z][A-Za-z0-9]{2,62}$")) { throw new ArgumentException(nameof(indexName)); } _options = options ?? new TrieSearchOptions(); if (_options.MinimumIndexLength > _options.MaximumIndexLength) { throw new ArgumentException(nameof(options.MinimumIndexLength)); } var propertyName = GetPropertyNameFromExpression(rowKeyProperty); _rowKeyProperty = typeof(T).GetProperty(propertyName); if (_rowKeyProperty.PropertyType != typeof(string)) { throw new ArgumentException("RowKey must be string"); } if (maxNumberOfConnections.HasValue) { if (maxNumberOfConnections < 1) { throw new ArgumentException(nameof(maxNumberOfConnections)); } var account = CloudStorageAccount.Parse(storageConnectionString); var tableServicePoint = ServicePointManager.FindServicePoint(account.TableEndpoint); if (tableServicePoint.ConnectionLimit != maxNumberOfConnections) { tableServicePoint.ConnectionLimit = maxNumberOfConnections.Value; } } _tableStore = new TableStore <DynamicTableEntity>(indexName, storageConnectionString, new Models.TableStorageOptions { Retries = _options.NumberOfRetries, RetryWaitTimeInSeconds = _options.RetryWaitTimeInSeconds }); }
public void CopyIndexNotes() { // foreach user IEnumerable <User> allUsers = TableStore.GetAllEntitiesInAPartition <User>(TableStore.TableName.users, Constant.UserPartition); foreach (User user in allUsers) { try { IEnumerable <TableEntity> allNotes = TableStore.GetAllEntitiesInAPartition <TableEntity>(TableStore.TableName.notes, user.UserId); List <TableEntity> insertUpdateList = new List <TableEntity>(); List <TableEntity> recentTokenList = new List <TableEntity>(); // copy all user indices to new table foreach (TableEntity entity in allNotes) { if (!entity.RowKey.StartsWith("note_")) { if (entity.RowKey.Contains("rec")) { recentTokenList.Add((RecentTokenList)entity); } Index index = entity as Index; if (index == null) { Console.WriteLine("Cannot convert to index"); } else { insertUpdateList.Add(index); } } } TableStore.BatchInsertOrUpdate(TableStore.TableName.indices, insertUpdateList); TableStore.BatchInsertOrUpdate(TableStore.TableName.recentTokens, recentTokenList); } catch { continue; } } }
public async Task <IActionResult> Create([Bind("Id,CompanyName,Description,EMail,Website,ActivationCode,Activated,CreatedAt,PostCode,City,Address,Country,FederalState,Latitude,Longitude,Telephonenumber,Password,RestPassword")] TableStore tableStore, IFormFile logoFile) { if (ModelState.IsValid) { var logo = CreateImage(logoFile, EnumImageType.Logo); if (!(logo is null)) { logo.Store = tableStore; _context.TblImages.Add(logo); } _context.Add(tableStore); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(tableStore)); }
public void Test() { var fsa = new FieldSpec <int>("a"); var fsb = new FieldSpec <int>("b"); var store = TableStore.Create(fsa, fsb); var fa = store.GetField(fsa); var fb = store.GetField(fsb); var sourceTable = Table.Create(store); var subManager = new SubscriptionManager(sourceTable); subManager.Subscribe(">,b,4i", (r, changeType, n) => { Console.WriteLine("hello"); }); subManager.Insert(store, r => { r.SetValue(fa, 0); r.SetValue(fb, 5); }); }
public void Test_gt5_snapshot() { var fsa = new FieldSpec <int>("a"); var fsb = new FieldSpec <int>("b"); var store = TableStore.Create(fsa, fsb); var fa = store.GetField(fsa); var fb = store.GetField(fsb); var students = Table.Create(store); var(_, snapshot, test) = Table.Gt(students, fsb, 5); var r1 = store.Insert(); r1.SetValue(fa, 0); r1.SetValue(fb, 5); Assert.Empty(snapshot()); }
public void Test_b_gt_5_and_a_lt_2() { var fsa = new FieldSpec <int>("a"); var fsb = new FieldSpec <int>("b"); var store1 = TableStore.Create(fsa, fsb); var fa = store1.GetField(fsa); var fb = store1.GetField(fsb); var expr = new And(new Gt <int>(fsb, 5), new Lt <int>(fsa, 2)); var(_, snapshot, test) = Table.Filter(Table.Create(store1), expr); var r1 = store1.Insert(); r1.SetValue(fa, 0); r1.SetValue(fb, 5); var r2 = store1.Insert(); r2.SetValue(fa, 1); r2.SetValue(fb, 6); var r3 = store1.Insert(); r3.SetValue(fa, 2); r3.SetValue(fb, 7); Assert.Equal(new Array8[] { new Array8(1) { [0] = 1 } }, snapshot()); Assert.Empty(test(store1[0])); Assert.Equal(new Array8[] { new Array8(1) { [0] = 1 } }, test(store1[1])); Assert.Empty(test(store1[2])); }
public void Test_gt4_notify_2() { var fsa = new FieldSpec <int>("a"); var fsb = new FieldSpec <int>("b"); var store = TableStore.Create(fsa, fsb); var fa = store.GetField(fsa); var fb = store.GetField(fsb); var students = Table.Create(store); var(_, snapshot, test) = Table.Gt(students, fsb, 4); var r1 = store.Insert(); r1.SetValue(fa, 0); r1.SetValue(fb, 5); var r2 = store.Insert(); r2.SetValue(fa, 1); r2.SetValue(fb, 6); var r3 = store.Insert(); r3.SetValue(fa, 2); r3.SetValue(fb, 4); Assert.Equal(new Array8[] { new Array8(1) { [0] = 0 } }, test(store[0])); Assert.Equal(new Array8[] { new Array8(1) { [0] = 1 } }, test(store[1])); Assert.Empty(test(store[2])); }
private void btnAddTable_Click_1(object sender, EventArgs e) { if (txtAddTableCapacity.Text.Length >= 1 && txtAddTableNumber.Text.Length >= 1) { string status = rdAddTableActive.Checked ? "Active" : "Passive"; if (isValidNumber(txtAddTableNumber.Text) && isValidNumber(txtAddTableCapacity.Text)) { TableStore.CreateNewTable(new Table(int.Parse(txtAddTableNumber.Text), int.Parse(txtAddTableCapacity.Text), status)); MessageBox.Show("Tavolina u regjistrua me sukses"); txtAddTableCapacity.Clear(); txtAddTableNumber.Clear(); lblAllTables.Text = TableStore.CountAllTables().ToString(); } else { MessageBox.Show("Ju lutem shkruani fushtat ne formatin e duhur : Numer"); } } else { MessageBox.Show("ju lutem mbushni te gjitha fushat"); } }
public void Test_gt4_snapshot() { var fsa = new FieldSpec <int>("a"); var fsb = new FieldSpec <int>("b"); var store = TableStore.Create(fsa, fsb); var fa = store.GetField(fsa); var fb = store.GetField(fsb); var students = Table.Create(store); var(_, snapshot, test) = Table.Gt(students, fsb, 4); var r1 = store.Insert(); r1.SetValue(fa, 0); r1.SetValue(fb, 5); Assert.Equal(new Array8[] { new Array8(1) { [0] = 0 } }, snapshot()); }
static void Main() { Category obj = new Category(1, "Skare", "Food"); Category pije = new Category(10, "Pije", "Drink"); Category.AddNewCategory(obj); Category.AddNewCategory(pije); Food ob = new Food("hell", obj, "adssads", 3, "sadsa", "asdsad"); Drink dr = new Drink("CocaCola", obj, "sdadsa", 2, "sadasdsa"); MenuStore.CreateNewMenuItem(new Food("Mish i Bardhe", obj, "Perskrimi i mishit", (decimal)2.50, "Receta")); MenuStore.CreateNewMenuItem(new Food("Qebapa 5she", obj, "Perskrimi i mishit", (decimal)1.50, "Receta")); MenuStore.CreateNewMenuItem(new Food("Pleskavice ne pjate", obj, "Perskrimi i mishit", (decimal)3.50, "Receta")); MenuStore.CreateNewMenuItem(dr); MenuStore.CreateNewMenuItem(new Drink("Kafe Makiato", pije, "dadsadsa", 1, "dsad")); TableStore.CreateNewTable(new Table(1, 4, "Altiv")); TableStore.CreateNewTable(new Table(2, 4, "Altiv")); TableStore.CreateNewTable(new Table(3, 4, "Altiv")); TableStore.CreateNewTable(new Table(4, 4, "Altiv")); Category.AddNewCategory(new Category(20, "Supa", "Food")); Category.AddNewCategory(new Category(30, "Pizza", "Food")); Category.AddNewCategory(new Category(40, "Caj", "Drink")); Category.AddNewCategory(new Category(50, "Kafe", "Drink")); EmployesStore.AddNewEmployee(new Employee("Donald", "Isufi", "admin", "123456", "Zenel Bajraktari")); EmployesStore.AddNewEmployee(new Employee("Altin", "Gashi", "admin2", "123456", "Ismet munishi")); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Login()); }
public void get_records_by_partition_key_paged_using_maximum_page_size() { var tableStore = new TableStore <TestTableEntity>("recordsbypartmaxpage", ConnectionString, _tableStorageOptions); for (int i = 0; i < 11; i++) { var records = new List <TestTableEntity>(); for (int j = 0; j < 100; j++) { records.Add(new TestTableEntity($"{i}_{j}", "x")); } tableStore.Insert(records); } var results = tableStore.GetByPartitionKeyPaged("x", 1000); var nextPageResults = tableStore.GetByPartitionKeyPaged("x", 1000, results.ContinuationToken); results.Items.Count.Should().Be(1000); nextPageResults.Items.Count.Should().Be(100); nextPageResults.IsFinalPage.Should().BeTrue(); tableStore.DeleteTable(); }
public static void Register(HttpConfiguration configuration) { string connectionString = ConfigurationManager.AppSettings["StorageConnectionString"]; string userTableName = ConfigurationManager.AppSettings["UserTableName"]; string newsTableName = ConfigurationManager.AppSettings["NewsTableName"]; string hotNewsTableName = ConfigurationManager.AppSettings["HotNewsTableName"]; var userStore = new TableStore(connectionString, userTableName); var newsStore = new TableStore(connectionString, newsTableName); var hotNewsStore = new TableStore(connectionString, hotNewsTableName); var userTableStorage = new UserRepository(userStore); var newsTableStorage = new NewsTableRepository(newsStore); var hotNewsTableStorage = new NewsTableRepository(hotNewsStore); // Dependy injection configuration var container = new UnityContainer(); container.RegisterInstance <IUserRepository>(userTableStorage); container.RegisterInstance <INewsRepository>(newsTableStorage); container.RegisterInstance <IHotNewsRepository>(hotNewsTableStorage); container.RegisterInstance <IApiInputValidationChecks>(new ApiInputValidationChecks(new ApiInputValidationChecks())); container.RegisterInstance <IApiBusinessLogicValidationChecks>(new ApiBusinessLogicValidationChecks()); configuration.DependencyResolver = new UnityResolver(container); // Register the filter injector List <IFilterProvider> providers = configuration.Services.GetFilterProviders().ToList(); IFilterProvider defaultprovider = providers.Single(i => i is ActionDescriptorFilterProvider); configuration.Services.Remove(typeof(IFilterProvider), defaultprovider); configuration.Services.Add(typeof(IFilterProvider), new UnityFilterProvider(container)); // Web API routes configuration.MapHttpAttributeRoutes(); }
public AdminPropertyController(UserManager <User> userManager, TableStore tableStore, ImageService imageService) : base(userManager, tableStore) { this.imageService = imageService; }
public TableContext(string table, TableStore tableStore) { _table = table; _tableStore = tableStore; }
public DevelopmentController(UserManager <User> userManager, TableStore tableStore) : base(userManager, tableStore) { }
public BaseController(UserManager <User> userManager, TableStore tableStore) { this.UserManager = userManager; this.TableStore = tableStore; }
static void Main(string[] args) { //MallardDuck mallard = new MallardDuck(); //RubberDuck rubberDuck = new RubberDuck(); //DecoyDuck decoyDuck = new DecoyDuck(); //mallard.Display(); //mallard.PerformFly(); //mallard.PerformQuack(); //rubberDuck.Display(); //rubberDuck.PerformFly(); //rubberDuck.PerformQuack(); //decoyDuck.Display(); //decoyDuck.PerformFly(); //decoyDuck.PerformQuack(); //ModelDuck modelDuck = new ModelDuck(); //modelDuck.SetFlyBehavior(new FlyWithRocketPower()); //modelDuck.SetQuackBehavior(new Mute()); //modelDuck.PerformFly(); //modelDuck.PerformQuack(); //Bat bat = new Bat(); //bat.Display(); //bat.PerformSleep(); //bat.PerformEat(); //Giraffe giraffe = new Giraffe(); //giraffe.Display(); //giraffe.PerformSleep(); //giraffe.PerformEat(); //Elephant elephant = new Elephant(); //elephant.Display(); //elephant.PerformSleep(); //elephant.PerformEat(); //Sloth sloth = new Sloth(); //sloth.SetSleepBehavior(new SleepNormalDuration()); //sloth.SetEatingBehavior(new EatPlant()); //sloth.Display(); //sloth.PerformSleep(); //sloth.PerformEat(); ////Weather Station //WeatherData weatherData = new WeatherData(); //CurrentConditonsDisplay currentConditonsDisplay = new CurrentConditonsDisplay(weatherData); //StatisticsDisplay statisticsDisplay = new StatisticsDisplay(weatherData); //weatherData.SetMeasurements(80, 65, 30.4f); //weatherData.SetMeasurements(82, 70, 29.2f); //weatherData.SetMeasurements(78, 90, 29.2f); //CompanyData Data = new CompanyData(); //CurrentConditionsDisplayTwo currentConditionsDisplayTwo = new CurrentConditionsDisplayTwo(Data); //StatisticsDisplayTwo statisticsDisplayTwo = new StatisticsDisplayTwo(Data); //Data.setData(11, 1); //Data.setData(23, 3); //Data.setData(19, 3); //Beverage beverage = new Espresso(); //Console.WriteLine(beverage.GetDescription() + " $" + beverage.Cost()); //Beverage beverage2 = new HouseBlend(); //CondimentDecorator beverage3 = new Soy(beverage2); //beverage3 = new Mocha(beverage3); //Console.WriteLine(beverage3.GetDescription() + " $" + beverage3.Cost()); //Meal meal = new ChickenMeal(); //Console.WriteLine(meal.GetDescription() + " $" + meal.GetCost()); //VegetableDecorator vegMeal1 = new Carrot(meal); //Console.WriteLine(vegMeal1.GetDescription() + " $" + vegMeal1.GetCost()); //Meal meal2 = new BeefMeal(); //Console.WriteLine(meal2.GetDescription() + " $" + meal2.GetCost()); //VegetableDecorator vegMeal2 = new Carrot(meal2); //Console.WriteLine(vegMeal2.GetDescription() + " $" + vegMeal2.GetCost()); //VegetableDecorator vegMeal3 = new Mushroom(vegMeal2); //Console.WriteLine(vegMeal3.GetDescription() + " $" + vegMeal3.GetCost()); //Singleton singleton = Singleton.GetInstance(); //Console.WriteLine(singleton.GetDescription()); //SingletonThreadSafeOne singletonThreadSafeOne = SingletonThreadSafeOne.GetInstance(); //Console.WriteLine(singletonThreadSafeOne.GetDescription()); //SingletonThreadSafeTwo singletonThreadSafeTwo = SingletonThreadSafeTwo.Instance; //Console.WriteLine(singletonThreadSafeTwo.GetDescription()); //SingletonThreadSafeThree singletonThreadSafeThree = SingletonThreadSafeThree.Instance(); //Console.WriteLine(singletonThreadSafeThree.GetDescription()); //SingletonThreadSafeFour singletonThreadSafeFour = SingletonThreadSafeFour.Instance; //Console.WriteLine(singletonThreadSafeFour.GetDescription()); //SingltonThreadSafeFive singletonThreadSafeFive = SingltonThreadSafeFive.Instance; //Console.WriteLine(singletonThreadSafeFive.GetDescription()); //GumballMachine gumballMachine = new GumballMachine(5); //Console.WriteLine(gumballMachine); //gumballMachine.InsertQuarter(); //gumballMachine.TurnCrank(); //Console.WriteLine(gumballMachine); //Car car1 = new Car(); //car1.SetState(new ParkState(car1)); //Console.WriteLine(car1.GetState()); //car1.Accelerate(); //car1.Decelerate(); //car1.Stop(); //car1.Start(); //Console.WriteLine(car1.GetState()); //car1.Accelerate(); //car1.Decelerate(); //car1.Start(); //car1.Stop(); //Console.WriteLine(car1.GetState()); //DinerMenu dinerMenu = new DinerMenu(); //dinerMenu.AddItem("Cake"); //PancakeHouseMenu pancakeHouseMenu = new PancakeHouseMenu(); //pancakeHouseMenu.AddItem("Strawberry Pancakes"); //Iterator pancakeIterator = pancakeHouseMenu.CreateIterator(); //Iterator dinerIterator = dinerMenu.CreateIterator(); //Console.WriteLine("\nMenu (with iterators)\n---\nBREAKFAST"); //PrintMenu(pancakeIterator); //Console.WriteLine("\nLUNCH"); //PrintMenu(dinerIterator); //ClothesInventory clothesInventory = new ClothesInventory(); //IIterator clothesIterator = clothesInventory.CreateInventory(); //Console.WriteLine("\nInventory (with iterators)\n---\nCLOTHES"); //PrintInventory(clothesIterator); //FurnitureInventory furnitureInventory = new FurnitureInventory(); //IIterator furnitureIterator = furnitureInventory.CreateInventory(); //Console.WriteLine("\n---\nFURNITURES"); //PrintInventory(furnitureIterator); //SimplePizzaFactory factory = new SimplePizzaFactory(); //PizzaStore store = new PizzaStore(factory); //Pizza pizza = store.OrderPizza("cheese"); //Console.WriteLine("We ordered a " + pizza.GetName() + "\n"); //Console.WriteLine(pizza + "\n"); //Pizza pizza2 = store.OrderPizza("pepperoni"); //Console.WriteLine("We ordered a " + pizza2.GetName() + "\n"); //Console.WriteLine(pizza2); TableStore tableStore = new TableStore(); tableStore.CreateTable("side"); tableStore.OrderTable(); tableStore.CreateTable("bunching"); tableStore.OrderTable(); tableStore.CreateTable(null); tableStore.OrderTable(); tableStore.CreateTable("unknown"); tableStore.OrderTable(); }
public AuthController(UserManager <User> userManager, TableStore tableStore, SignInManager <User> signInManager) : base(userManager, tableStore) { this.signInManager = signInManager; }
public ProfileController(UserManager <User> userManager, TableStore tableStore, IOptions <StoreOption> storageOptions) : base(userManager, tableStore) { this.storageOptions = storageOptions.Value; }
public BudgetController(UserManager <User> userManager, TableStore tableStore) : base(userManager, tableStore) { }
public RevenueController(UserManager <User> userManager, TableStore tableStore) : base(userManager, tableStore) { }
public BaseHandler(TableStore TableStore, I18n.TranslationService i18n) { this.TableStore = TableStore; this.I18n = i18n; }
public async Task <ExSaveDataResult> RegisterShop(ExShopRegistration exShopRegistration) { using (Db db = new Db()) { var shop = await db.TblStores.FirstOrDefaultAsync(a => a.EMail.ToLower() == exShopRegistration.EMail.ToLower()); if (shop == null) { //NEU ANLEGEN shop = new TableStore(); shop.EMail = exShopRegistration.EMail.ToLower(); shop.CreatedAt = DateTime.UtcNow; shop.CompanyName = ""; db.TblStores.Add(shop); } else if (shop.Activated) { return(new ExSaveDataResult { Result = EnumSaveDataResult.Error }); } string pwd = PasswordHelper.GeneratePassword(6); shop.Password = PasswordHelper.CumputeHash(pwd); shop.ActivationCode = PasswordHelper.GeneratePassword(10); await db.SaveChangesAsync(); BissEMail bm = new BissEMail(WebAppSettings.EmailCredentials); ExEmailRegistration er = new ExEmailRegistration(); er.Message = $"Bitte bestätige den folgenden Link um dein Geschäft freizuschalten. Du kannst dich anschließend mit dem Passwort {pwd} einloggen"; er.ApproveLink = $"{Constants.WebAppBaseUrl}Activate/?guid={shop.ActivationCode}"; List <string> eMails2Inform; if (Constants.CurrentAppSettings.AppConfigurationConstants == 0) //master { eMails2Inform = new List <string> { exShopRegistration.EMail }; //ToDo: Wenn die Settings Tabelle existiert dann über die Settings Tabelle } else { eMails2Inform = new List <string> { "*****@*****.**", exShopRegistration.EMail }; //ToDo: Wenn die Settings Tabelle existiert dann über die Settings Tabelle } string email = _mailgenerator.GetRegistrationEmail(er); var res = await bm.SendHtmlEMail(Constants.SendEMailAs, eMails2Inform, "Danke für die Registrierung", email, Constants.SendEMailAsDisplayName); return(new ExSaveDataResult()); } }
public async Task <IActionResult> StoreData([Bind("Id,CompanyName,Description,EMail,Website,Activated,CreatedAt,PostCode,City,Address,Country,FederalState,Telephonenumber,Password")] TableStore tableStore, IFormFile logoFile) { var storeId = User.FindFirst(ClaimTypes.NameIdentifier).Value; if (ModelState.IsValid) { //update try { var tbStore = await _context.TblStores.FirstOrDefaultAsync(x => x.Id == tableStore.Id); var logo = CreateImage(logoFile, EnumImageType.Logo); if (!(logo is null)) { var storeImages = _context.TblStores.Where(s => s.Id.ToString() == storeId).Select(s => s.Images).ToArray(); logo.Store = tbStore; if (storeImages[0].Any()) { for (int i = 0; i < storeImages[0].Count(); i++) { if (storeImages[0][i].ImageType == EnumImageType.Logo) { _context.TblImages.Remove(storeImages[0][i]); break; } } } _context.TblImages.Add(logo); } if (tbStore == null) { return(NotFound()); } if (!String.IsNullOrEmpty(tableStore.Telephonenumber)) { string outPhoneNumber; var a = ValidationHelper.ProoveValidPhoneNumber(tableStore.Telephonenumber, out outPhoneNumber); //TODO: Meldung wenn nicht passt tableStore.Telephonenumber = outPhoneNumber; } if (!String.IsNullOrEmpty(tableStore.Website)) { if (!tableStore.Website.StartsWith("http")) { tableStore.Website = $"http://{tableStore.Website}"; } } tbStore.CompanyName = tableStore.CompanyName; tbStore.Description = tableStore.Description; tbStore.EMail = tableStore.EMail; tbStore.Country = tableStore.Country; tbStore.FederalState = tableStore.FederalState; tbStore.PostCode = tableStore.PostCode; tbStore.City = tableStore.City; tbStore.Address = tableStore.Address; tbStore.Website = tableStore.Website; tbStore.Telephonenumber = tableStore.Telephonenumber; var sec = await _context.TblLocations.FirstOrDefaultAsync(a => a.StoreId == tbStore.Id); if (sec == null) { sec = new TableLocation(); sec.StoreId = tbStore.Id; _context.TblLocations.Add(sec); } sec.EMail = tbStore.EMail; sec.Address = tbStore.Address; sec.City = tbStore.City; sec.Country = tbStore.Country; sec.PostCode = tbStore.PostCode; sec.Name = tbStore.CompanyName; sec.Telephonenumber = tbStore.Telephonenumber; try { var res = GeocodeService.ConvertToGPSCoordinates(tableStore.PostCode, tableStore.City, tableStore.Address); tbStore.Longitude = res.Geometry.Location.Longitude; tbStore.Latitude = res.Geometry.Location.Latitude; } catch (Exception e) { } sec.Latitude = tbStore.Latitude; sec.Longitude = tbStore.Longitude; if (!string.IsNullOrWhiteSpace(tableStore.Password)) { tbStore.Password = PasswordHelper.CumputeHash(tableStore.Password); } await _context.SaveChangesAsync(); TempData.Add("message", "Daten erfolgreich gespeichert"); return(RedirectToAction(nameof(StoreData))); } catch (DbUpdateConcurrencyException) { ViewData.Add("message", "Daten konnten nicht gespeichert werden"); return(View(tableStore)); //if (!TableStoreExists(store.Id)) //{ // return NotFound(); //} //else //{ // throw; //} } } return(View(tableStore)); }
public AdminEventController(UserManager <User> userManager, TableStore tableStore) : base(userManager, tableStore) { }
public DashboardController(UserManager <User> userManager, TableStore tableStore) : base(userManager, tableStore) { }
public void Ifc4PSetsTest() { const string file = "PSetsSample.xlsx"; var model = new IO.Memory.MemoryModel(new Ifc4.EntityFactory()); using (var txn = model.BeginTransaction("Sample data")) { model.EntityNew += entity => { var root = entity as IfcRoot; if (root != null) { root.GlobalId = Guid.NewGuid(); } }; var slab = model.Instances.New <IfcSlab>(s => s.Name = "Tremendous slab"); model.Instances.New <IfcRelDefinesByProperties>(r => { r.RelatedObjects.Add(slab); r.RelatingPropertyDefinition = model.Instances.New <IfcPropertySet>(ps => { ps.Name = "Slab properties A"; ps.HasProperties.Add(model.Instances.New <IfcPropertySingleValue>(p => { p.Name = "Property AA"; p.NominalValue = new IfcLengthMeasure(5.5); })); ps.HasProperties.Add(model.Instances.New <IfcPropertySingleValue>(p => { p.Name = "Property AB"; p.NominalValue = new IfcLogical(true); })); }); }); model.Instances.New <IfcRelDefinesByProperties>(r => { r.RelatedObjects.Add(slab); r.RelatingPropertyDefinition = model.Instances.New <IfcPropertySet>(ps => { ps.Name = "Slab properties B"; ps.HasProperties.Add(model.Instances.New <IfcPropertySingleValue>(p => { p.Name = "Property BA"; p.NominalValue = new IfcInteger(5); })); ps.HasProperties.Add(model.Instances.New <IfcPropertySingleValue>(p => { p.Name = "Property BB"; p.NominalValue = new IfcLabel("LabellebaL"); })); }); }); txn.Commit(); } var mapping = ModelMapping.Load(Properties.Resources.IFC4SampleMapping); mapping.Init(model.Metadata); var w = new Stopwatch(); w.Start(); var storage = new TableStore(model, mapping); storage.Store(file); w.Stop(); //Debug.WriteLine(@"{0}ms to store the data as a table.", w.ElapsedMilliseconds); Trace.WriteLine(string.Format(@"{0}ms to store the data as a table.", w.ElapsedMilliseconds)); var loaded = new IO.Memory.MemoryModel(new Ifc4.EntityFactory()); using (var txn = loaded.BeginTransaction("Import from XLSX")) { storage = new TableStore(loaded, mapping); storage.LoadFrom(file); txn.Commit(); } var sl = loaded.Instances.FirstOrDefault <IfcSlab>(); Assert.IsNotNull(sl); var rels = sl.IsDefinedBy.ToList(); Assert.AreEqual(2, rels.Count); foreach (var rel in rels) { var pSet = rel.RelatingPropertyDefinition as IfcPropertySet; Assert.IsNotNull(pSet); Assert.IsNotNull(pSet.Name); if (pSet.Name == "Slab properties A") { var propA = pSet.HasProperties.OfType <IfcPropertySingleValue>().First(p => p.Name == "Property AA"); Assert.IsNotNull(propA); Assert.IsNotNull(propA.NominalValue); Assert.IsTrue(Math.Abs((IfcLengthMeasure)propA.NominalValue - 5.5) < 1e-9); var propB = pSet.HasProperties.OfType <IfcPropertySingleValue>().First(p => p.Name == "Property AB"); Assert.IsNotNull(propB); Assert.IsNotNull(propB.NominalValue); Assert.IsTrue(((IfcLogical)propB.NominalValue).Equals((IfcLogical)true)); } if (pSet.Name == "Slab properties B") { var propA = pSet.HasProperties.OfType <IfcPropertySingleValue>().First(p => p.Name == "Property BA"); Assert.IsNotNull(propA); Assert.IsNotNull(propA.NominalValue); Assert.IsTrue(((IfcInteger)propA.NominalValue).Equals((IfcInteger)5)); var propB = pSet.HasProperties.OfType <IfcPropertySingleValue>().First(p => p.Name == "Property BB"); Assert.IsNotNull(propB); Assert.IsNotNull(propB.NominalValue); Assert.IsTrue(((IfcLabel)propB.NominalValue).Equals((IfcLabel)"LabellebaL")); } } }
public ImportExportController(UserManager <User> userManager, TableStore tableStore) : base(userManager, tableStore) { }