public static void CreateNewProcessOverview(string ProcessName, ProjectItem processFile, ProjectItem diagramFile) { var store = new Store(typeof(CloudCoreArchitectProcessOverviewDomainModel)); var partition = new Partition(store); var result = new SerializationResult(); using (Transaction t = store.TransactionManager.BeginTransaction("create new process overview model")) { try { var processOverviewSerializationHelper = CloudCoreArchitectProcessOverviewSerializationHelper.Instance; Architect.ProcessOverview.Process process = processOverviewSerializationHelper.CreateModelHelper(partition); SetProcessOverviewProperties(ProcessName, process); var diagram = processOverviewSerializationHelper.CreateDiagramHelper(partition, process); processOverviewSerializationHelper.SaveModelAndDiagram(result, process, processFile.FileNames[0], diagram, diagramFile.FileNames[0]); AddAssemblyReference(ProcessName, process); t.Commit(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
static void ProcShipDataChanged(Store ds, int shipId) { var ship = ds.Ships[shipId]; var histo = new IShipsLogAccessor[] { ds.CurrentLogbook.Ships, ds.Weekbook.Ships }; foreach(var storage in histo) { Ship shipHisto; if(ship == null) { if(!storage.Contains(shipId)) continue; shipHisto = storage[shipId]; shipHisto.ExistenceLog.Append(ShipExistenceStatus.NonExistence, 0); } else { shipHisto = storage[shipId]; shipHisto.EnhancedAntiAir.Append(ship.EnhancedAntiAir, ds.Settings.ShipDataLoggingInterval, false); shipHisto.EnhancedDefense.Append(ship.EnhancedDefense, ds.Settings.ShipDataLoggingInterval, false); shipHisto.EnhancedLuck.Append(ship.EnhancedLuck, ds.Settings.ShipDataLoggingInterval, false); shipHisto.EnhancedPower.Append(ship.EnhancedPower, ds.Settings.ShipDataLoggingInterval, false); shipHisto.EnhancedTorpedo.Append(ship.EnhancedTorpedo, ds.Settings.ShipDataLoggingInterval, false); shipHisto.Exp.Append(ship.Exp, ds.Settings.ShipDataLoggingInterval); shipHisto.Level.Append(ship.Level, ds.Settings.ShipDataLoggingInterval, false); shipHisto.SRate.Append(ship.SRate, ds.Settings.ShipDataLoggingInterval, false); shipHisto.ShipNameType.Append(ship.ShipInfo, 0, false); if(ship.Locked) { shipHisto.ExistenceLog.Append(ShipExistenceStatus.Locked, 0, false); } else { shipHisto.ExistenceLog.Append(ShipExistenceStatus.Existing, 0, false); } } shipHisto.RefreshUpdateTime(); } }
public static Store RetrieveSettings() { Uri uri = new Uri(String.Format("http://{0}/store.sh", AppSettings.IPAddress)); GetData(uri, false, (sender, args) => { AutoResetEvent evt = args.UserState as AutoResetEvent; if (args.Error == null && !string.IsNullOrEmpty(args.Result)) { JObject j = JObject.Parse(args.Result); Store = JsonConvert.DeserializeObject<Store>(args.Result); Store.Remove("FavLists"); Store.FavLists = new FavLists(); if (j["FavLists"] != null) { // We can deserialize this list in one call with JsonConvert.DeserializeObject<FavLists>(j["FavLists"].ToString()); // but we want to correctly "bind" the games in the Favorite lists to the Games in the games list returned in // data.xml foreach (JProperty jProperty in j["FavLists"].OfType<JProperty>().Where(p => p.Count > 0)) { List<Game> games = new List<Game>(); games.AddRange( jProperty.First.Cast<JObject>().Select( game => Games.FirstOrDefault( g => g.ID.Equals(game["id"].ToString(), StringComparison.InvariantCultureIgnoreCase))) .Where(favGame => favGame != null)); Store.FavLists.Add(new FavList(games) {HtmlName = jProperty.Name}); } } } if (evt != null) evt.Set(); }); return Store; }
public IEnumerable<Store> GetAll() { List<Store> _stores = new List<Store>(); Store store = new Store(); store.base_url = "http://www.buccaneers.com"; store.id = "1"; store.name = "Bucs"; store.typical_donation = "5%"; _stores.Add(store); store = new Store(); store.base_url = "http://www.yahoo.com"; store.id = "2"; store.name = "Yahoo"; store.typical_donation = "10%"; _stores.Add(store); store = new Store(); store.base_url = "http://www.danschocolates.com"; store.id = "144"; store.name = "Dan's Chocolates"; store.typical_donation = "12%"; _stores.Add(store); return _stores.ToArray(); }
public void SubsetMandatory_1a(Store store) { myTestServices.LogValidationErrors("No Errors Found Initially"); ORMModel model = store.ElementDirectory.FindElements<ORMModel>()[0]; Role role_2 = (Role)store.ElementDirectory.GetElement(new Guid("82DF5594-2020-4CA3-8154-FD92EE83F726")); myTestServices.LogValidationErrors("Intoduce Error: Make a role of supertype mandatory"); using (Transaction t = store.TransactionManager.BeginTransaction("Add simple mandatory constraint")) { role_2.IsMandatory = true; t.Commit(); } myTestServices.LogValidationErrors("Error Found. Calling Undo to remove error..."); store.UndoManager.Undo(); myTestServices.LogValidationErrors("Error removed with undo."); myTestServices.LogValidationErrors("Intoduce Error: Make a role of subtype mandatory"); using (Transaction t = store.TransactionManager.BeginTransaction("Add simple mandatory constraint")) { role_2.IsMandatory = true; t.Commit(); } myTestServices.LogValidationErrors("Error Found. Calling Undo to remove error..."); using (Transaction t = store.TransactionManager.BeginTransaction("Add simple mandatory constraint")) { role_2.IsMandatory = false; t.Commit(); } myTestServices.LogValidationErrors("Error is removed with changing property value..."); }
internal string GenerateOrderNumber(Store store, OrderInfo orderInfo, out int lastOrderReferenceNumber) { lastOrderReferenceNumber = 0; var currentHighestOrderNumber = UwebshopConfiguration.Current.ShareBasketBetweenStores ? _orderRepository.GetHighestOrderNumber(ref lastOrderReferenceNumber) : _orderRepository.GetHighestOrderNumberForStore(store.Alias, ref lastOrderReferenceNumber); Log.Instance.LogDebug("GenerateOrderNumber currentHighestOrderNumber: " + currentHighestOrderNumber + " lastOrderReferenceNumber: " + lastOrderReferenceNumber); var orderNumberPrefix = store.OrderNumberPrefix; if (lastOrderReferenceNumber <= 0) { if (!string.IsNullOrEmpty(currentHighestOrderNumber) && currentHighestOrderNumber.Length >= orderNumberPrefix.Length) int.TryParse(currentHighestOrderNumber.Substring(orderNumberPrefix.Length, currentHighestOrderNumber.Length - orderNumberPrefix.Length), out lastOrderReferenceNumber); else int.TryParse(currentHighestOrderNumber, out lastOrderReferenceNumber); } lastOrderReferenceNumber++; lastOrderReferenceNumber = Math.Max(lastOrderReferenceNumber, store.OrderNumberStartNumber); orderInfo.StoreOrderReferenceId = lastOrderReferenceNumber; Log.Instance.LogDebug("GenerateOrderNumber lastOrderReferenceNumber: " + lastOrderReferenceNumber); return GenerateOrderNumber(store, orderInfo, lastOrderReferenceNumber, orderNumberPrefix); }
public MainClass() { userdir = Path.Combine ( Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "Monopod"); // check userdir exists, make if not if (!Directory.Exists (userdir)) { DirectoryInfo d = Directory.CreateDirectory (userdir); if ( d == null ) { // TODO: throw a wobbly } } store = new Store (Path.Combine (userdir, ".monopod.db"), userdir); if (store.NumberOfChannels == 0) { store.AddDefaultChannels (); channels = new ChannelWindow (store); channels.Show (); } else { channels = new ChannelWindow (store); } #if USING_IPOD ipodwindow = new IPodChooseWindow (store); #endif InitIcon (); InitMenu (); // kick off downloading store.FetchNextChannel (); store.FetchNextCast (); }
public void ExactlyOneTest_1b(Store store) { myTestServices.LogValidationErrors("No errors expected"); ORMModel model = store.ElementDirectory.FindElements<ORMModel>()[0]; FrequencyConstraint constraint = (FrequencyConstraint)model.ConstraintsDictionary.GetElement("FrequencyConstraint1").SingleElement; // DomainTypeDescriptor.CreatePropertyDescriptor(constraint, FrequencyConstraint.MaxFrequencyDomainPropertyId).SetValue(constraint, 1); myTestServices.LogValidationErrors("Introduce Error[FrequencyConstraintExactlyOneError]"); using (Transaction t = store.TransactionManager.BeginTransaction("Read the error")) { constraint.MinFrequency = 1; constraint.MaxFrequency = 1; t.Commit(); } myTestServices.LogValidationErrors("Fixing error with error activation service"); ((IORMToolServices)store).ModelErrorActivationService.ActivateError(constraint, constraint.FrequencyConstraintExactlyOneError); myTestServices.LogValidationErrors("[FrequencyConstraintExactlyOneError] removed, different error introduced. Removing new error"); // Deleting one of the two uniqnuess constraints... UniquenessConstraint uniqueC = (UniquenessConstraint)model.ConstraintsDictionary.GetElement("InternalUniquenessConstraint5").SingleElement; using (Transaction t = store.TransactionManager.BeginTransaction("Read the error")) { uniqueC.Delete(); t.Commit(); } myTestServices.LogValidationErrors("All errors resolved"); }
public XMLIniFile(string aaDocElementname, int aaVersion, Store aaStore) { xmldoc = new XmlDocument(); DocElementname = aaDocElementname; DocElementVersion = aaVersion; XmlFormat = aaStore; }
public void DoValidateCollectionItemFailsForDuplicateNamedElements() { Store store = new Store(typeof(CoreDesignSurfaceDomainModel), typeof(ServiceContractDslDomainModel)); ServiceContractModel model; using (Transaction transaction = store.TransactionManager.BeginTransaction()) { string name = "Duplicate Name"; model = store.ElementFactory.CreateElement(ServiceContractModel.DomainClassId) as ServiceContractModel; Message contract = store.ElementFactory.CreateElement(Message.DomainClassId) as Message; contract.Name = name; MessagePart part = store.ElementFactory.CreateElement(PrimitiveMessagePart.DomainClassId) as PrimitiveMessagePart; part.Name = name; contract.MessageParts.Add(part); TestableMessagePartElementCollectionValidator target = new TestableMessagePartElementCollectionValidator(); ValidationResults results = new ValidationResults(); target.TestDoValidateCollectionItem(part, contract, String.Empty, results); Assert.IsFalse(results.IsValid); transaction.Commit(); } }
public void DoValidateCollectionItemSucceedsForUniqueNamedElements() { Store store = new Store(typeof(CoreDesignSurfaceDomainModel), typeof(ServiceContractDslDomainModel)); ServiceContractModel model; using (Transaction transaction = store.TransactionManager.BeginTransaction()) { model = store.ElementFactory.CreateElement(ServiceContractModel.DomainClassId) as ServiceContractModel; ServiceContract contract = store.ElementFactory.CreateElement(ServiceContract.DomainClassId) as ServiceContract; contract.Name = "Contract Name"; Operation part = store.ElementFactory.CreateElement(Operation.DomainClassId) as Operation; part.Name = "Part Name"; contract.Operations.Add(part); TestableOperationElementCollectionValidator target = new TestableOperationElementCollectionValidator(); ValidationResults results = new ValidationResults(); target.TestDoValidateCollectionItem(part, contract, String.Empty, results); Assert.IsTrue(results.IsValid); transaction.Commit(); } }
public void DataElementAddRuleAddsObjectExtender() { Store store = new Store(typeof(CoreDesignSurfaceDomainModel), typeof(Microsoft.Practices.ServiceFactory.DataContracts.DataContractDslDomainModel)); DataContractModel dcModel; DataContract dataContract; DataMember dataElement; using(Transaction transaction = store.TransactionManager.BeginTransaction()) { dcModel = store.ElementFactory.CreateElement(DataContractModel.DomainClassId) as DataContractModel; dataContract = store.ElementFactory.CreateElement(DataContract.DomainClassId) as DataContract; dataElement = store.ElementFactory.CreateElement(PrimitiveDataType.DomainClassId) as DataMember; dcModel.ImplementationTechnology = new DataContractWcfExtensionProvider(); dcModel.Contracts.Add(dataContract); dataContract.DataMembers.Add(dataElement); Assert.IsNotNull(dataElement, "DataContract is null"); Assert.IsNotNull(dataElement.DataContract.DataContractModel.ImplementationTechnology, "ImplementationTechnology is null"); transaction.Commit(); } Assert.IsNotNull(dataElement.ObjectExtenderContainer, "ObjectExtenderContainer is null"); Assert.IsFalse(dataElement.ObjectExtenderContainer.ObjectExtenders.Count == 0, "Extender count is zero"); }
public bool DeleteStore(Store store) { if (store == null) return false; _unitOfWork.StoreRepository.Delete(store); _unitOfWork.Save(); return true; }
public AddEntityForm(Store store) : this() { this._Store = store; this.typeNames = _Store.ElementDirectory.FindElements<ModelClass>().Select(e => e.Name); entityNameTextBox.Text = GetNewEntityName(); }
public static void Main (string[] args) { Console.WriteLine ("Hello World!"); Model model = new Model(typeof(Demo)); model.Write<ExtModel,ExtModelField>(); Store store = new Store(typeof(Demo)); store.Write(); List list = new List(typeof(Demo)); list.Write(); Form form = new Form(typeof(Demo)); form.Write(); Controller controller = new Controller(typeof(Demo)); controller.Write(); Application app = new Application(typeof(Demo)); app.Write(); Console.WriteLine ("This is The End my friend!"); }
public void ValidationPassedWhenProjectDiffersButNameIsSame() { Store store = new Store(typeof(CoreDesignSurfaceDomainModel), typeof(HostDesignerDomainModel)); using(Transaction t = store.TransactionManager.BeginTransaction()) { HostApplication hostApp1 = new HostApplication(store, new PropertyAssignment(HostApplication.ImplementationProjectDomainPropertyId, "Project1")); HostApplication hostApp2 = new HostApplication(store, new PropertyAssignment(HostApplication.ImplementationProjectDomainPropertyId, "SomeOtherProject")); HostDesignerModel model = new HostDesignerModel(store); model.HostApplications.Add(hostApp1); model.HostApplications.Add(hostApp2); ServiceReference serviceReference1 = new ServiceReference(store, new PropertyAssignment(ServiceReference.NameDomainPropertyId, "ServiceRef1")); ServiceReference serviceReference2 = new ServiceReference(store, new PropertyAssignment(ServiceReference.NameDomainPropertyId, "ServiceRef1")); hostApp1.ServiceDescriptions.Add(serviceReference1); hostApp2.ServiceDescriptions.Add(serviceReference2); TestableHostModelContainsUniqueServiceReferencesAcrossHostsValidator validator = new TestableHostModelContainsUniqueServiceReferencesAcrossHostsValidator(); Assert.IsTrue(validator.IsValid(model)); t.Rollback(); } }
public LayoutInfo ConvertStringToLayoutInfo(string layoutInfo, Store store) { LayoutInfo lInfo = null; Microsoft.VisualStudio.Modeling.SerializationResult serializationResult = new Microsoft.VisualStudio.Modeling.SerializationResult(); DomainXmlSerializerDirectory directory = this.GetDirectory(store); System.Text.Encoding encoding = System.Text.Encoding.GetEncoding("ISO-8859-1"); Microsoft.VisualStudio.Modeling.SerializationContext serializationContext = new SerializationContext(directory, "", serializationResult); this.InitializeSerializationContext(store.DefaultPartition, serializationContext, false); DomainClassXmlSerializer rootSerializer = directory.GetSerializer(LayoutInfo.DomainClassId); using(System.Xml.XmlReader reader = System.Xml.XmlReader.Create(new System.IO.StringReader(layoutInfo)) ) { reader.Read(); // Move to the first node - will be the XmlDeclaration if there is one. serializationResult.Encoding = encoding; reader.MoveToContent(); lInfo = rootSerializer.TryCreateInstance(serializationContext, reader, store.DefaultPartition) as LayoutInfo; rootSerializer.Read(serializationContext, lInfo, reader); } return lInfo; }
public override void Initialize(Store sharedStore) { base.Initialize(sharedStore); observer = new ModelingDocDataObserver(this); validationObserver = new ValidationOutputObserver(this); this.ValidationController.AddObserver(validationObserver); }
/// <summary> /// 检验用户名和密码 /// </summary> /// <param name="email"></param> /// <param name="password"></param> /// <returns>通过返回 true ,否则返回 false </returns> public Store CheckUserInfo(string username, string password) { string sql = "select StoreName,StorePassword,StoreBusinessID,StoreID from Store where StoreName=@StoreName and StorePassword=@Password"; //为了安全性,就直接提示用户名和密码错误,而不是提示“用户名不存在”或者“密码错误” //不分开检查 email 和 password 了 //string sqlEmail = "select Email from Tb_UserLogin where Email=@Email"; //string sqlPassword = "******"; //为了从 cookies 直接登录, 将 MD5 加密放在 LoginButton_Click 事件中 //password = CommentHelper.GetMD5(password); SqlParameter emailParameter = new SqlParameter("StoreName", username); SqlParameter passwordParameter = new SqlParameter("Password", password); //判断邮箱和密码 //1.判断两者都符合 DataTable dt = SqlHelper.ExecuteDataTable(sql, emailParameter, passwordParameter); if (dt.Rows.Count == 1) { Store store = new Store(); store.StoreBusinessID =(Guid) dt.Rows[0]["StoreBusinessID"]; store.StoreID = (Guid)dt.Rows[0]["StoreID"]; return store; } else { return null; } }
public void ValidationPassedWhenProjectDiffersButNameIsSame() { Store store = new Store(typeof(CoreDesignSurfaceDomainModel), typeof(HostDesignerDomainModel)); using (Transaction t = store.TransactionManager.BeginTransaction()) { ClientApplication clientApp1 = new ClientApplication(store, new PropertyAssignment(ClientApplication.ImplementationProjectDomainPropertyId, "Project1")); ClientApplication clientApp2 = new ClientApplication(store, new PropertyAssignment(ClientApplication.ImplementationProjectDomainPropertyId, "AnotherProject")); HostDesignerModel model = new HostDesignerModel(store); model.ClientApplications.Add(clientApp1); model.ClientApplications.Add(clientApp2); Proxy proxy1 = new Proxy(store, new PropertyAssignment(Proxy.NameDomainPropertyId, "Proxy1")); Proxy proxy2 = new Proxy(store, new PropertyAssignment(Proxy.NameDomainPropertyId, "Proxy1")); clientApp1.Proxies.Add(proxy1); clientApp2.Proxies.Add(proxy2); TestableHostModelContainsUniqueProxyNamesAcrossClientsValidator validator = new TestableHostModelContainsUniqueProxyNamesAcrossClientsValidator(); t.Rollback(); } }
static void Main(string[] args) { try { var factory = DbProviderFactories.GetFactory("MySql.Data.MySqlClient"); var store = new Store(factory, ConnectionString); var builder = new StoreBuilder(factory, ConnectionString, new MySqlProvider()); //builder.CreateTable<TypesRecord>(); builder.CreateIndex<TypesRecord>(x => x.Name); //builder.CreateIndex<TypesRecord>(x => x.Age); //builder.CreateIndex<TypesRecord>(x => x.DateOfBirth); var test = new TypesRecord { Age = 1337, DateOfBirth = new DateTime(2011, 10, 09, 08, 07, 6), Name = "Testing" }; store.Save(test); store.GetByProperty<TypesRecord>(x => x.Age, 21); } catch (Exception ex) { System.Console.WriteLine(ex); } System.Console.WriteLine("Done."); System.Console.ReadKey(); }
public void InsertUser(Store store) { //ID 和 IsDeleted 在数据库中有默认值 newid() 和 0 string sql = "Insert into Store(StoreName,StorePassword) values(@Name,@Password) "; SqlHelper.ExecuteNonQuery(sql, new SqlParameter("Name", store.StoreName), new SqlParameter("Password", store.StorePassword)); }
public static void AddPage(Store store, string itemGuid, string subProcessGuid) { Project dteProject = getDteProject(store, "page"); string defaultNamespace = dteProject.Properties.Item("DefaultNamespace").Value.ToString(); var view = FileTypes.getFileType(FileType.View); var model = FileTypes.getFileType(FileType.PageModel); var controller = FileTypes.getFileType(FileType.Controller); #region Add View byte[] item = new UTF8Encoding(true).GetBytes(string.Format(view.Content, defaultNamespace, itemGuid.Replace("-", "_"))); string fileName = string.Format("{0}.cshtml", itemGuid.Replace("-", "_")); AddProcessFile(dteProject, subProcessGuid, view.FolderName, fileName, item, true); #endregion #region Add Controller item = new UTF8Encoding(true).GetBytes(string.Format(controller.Content, defaultNamespace, subProcessGuid.Replace("-", "_"), itemGuid.Replace("-", "_"))); fileName = string.Format("{0}Controller.cs", itemGuid.Replace("-", "_")); AddController(dteProject, controller.FolderName, fileName, item); #endregion #region Add Model item = new UTF8Encoding(true).GetBytes(string.Format(model.Content, itemGuid.Replace("-", "_"), defaultNamespace)); fileName = string.Format("{0}Model.cs", itemGuid.Replace("-", "_")); AddProcessFile(dteProject, subProcessGuid, model.FolderName, fileName, item, true); #endregion }
public async Task<IHttpActionResult> PostStore(Store entity) { if (!ModelState.IsValid) { return BadRequest(ModelState); } entity.TrackingState = TrackingState.Added; _dbContext.ApplyChanges(entity); try { await _dbContext.SaveChangesAsync(); } catch (DbUpdateException) { if (_dbContext.Stores.Any(e => e.StoreId == entity.StoreId)) { return Conflict(); } throw; } await _dbContext.LoadRelatedEntitiesAsync(entity); entity.AcceptChanges(); return CreatedAtRoute("DefaultApi", new { id = entity.StoreId }, entity); }
public async Task<IHttpActionResult> PutStore(Store entity) { if (!ModelState.IsValid) { return BadRequest(ModelState); } _dbContext.ApplyChanges(entity); try { await _dbContext.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!_dbContext.Stores.Any(e => e.StoreId == entity.StoreId)) { return Conflict(); } throw; } await _dbContext.LoadRelatedEntitiesAsync(entity); entity.AcceptChanges(); return Ok(entity); }
public static SubProcess ProcessExists(string processGuid, string processFolder) { var store = new Store(typeof(CloudCoreArchitectSubProcessDomainModel)); if (Directory.Exists(processFolder)) { foreach (string file in Directory.GetFiles(processFolder).Where(f => f.IndexOf(".subprocess") > -1).Select(f => f)) { StreamReader streamReader = File.OpenText(file); var str = streamReader.ReadToEnd(); streamReader.Close(); if (str.IndexOf(string.Format(@"visioId=""{0}""", processGuid)) > -1) { using (Transaction transaction = store.TransactionManager.BeginTransaction("load model and diagram")) { SubProcess btProcess = CloudCoreArchitectSubProcessSerializationHelper.Instance.LoadModelAndDiagram(store, file, file + ".diagram", null, null, null); transaction.Commit(); return btProcess; } } } } return null; }
// Update Store <store> public static bool update(Store store) { using (DataClasses1DataContext database = new DataClasses1DataContext(Globals.connectionString)) { var query = from a in database.Stores where (a.StoreID == store.StoreID) select a; foreach (var a in query) { a.StoreNum = store.StoreNum; a.StoreName = store.StoreName; a.StoreAddress = store.StoreAddress; a.StoreServiceCharge = store.StoreServiceCharge; } try { database.SubmitChanges(); return true; } catch (Exception e) { return false; } } }
private static Dictionary<DomainClassInfo, object> BuildCustomSerializationOmissions(Store store) { Dictionary<DomainClassInfo, object> retVal = new Dictionary<DomainClassInfo, object>(); DomainDataDirectory dataDir = store.DomainDataDirectory; retVal[dataDir.FindDomainRelationship(ExcludedORMModelElement.DomainClassId)] = null; return retVal; }
public async void should_allow_for_passing_parameters_to_async_actions() { var storeReducerReached = 0; var reducer = new SimpleReducer<List<string>>(() => new List<string> {"a"}).When<SomeAction>((s, e) => { storeReducerReached += 1; return s; }); var store = new Store<List<string>>(reducer); var action1 = store.asyncAction<LoginInfo, int>(async (dispatcher, store2, msg) => { await Task.Delay(300); Assert.That(msg.username, Is.EqualTo("John")); dispatcher(new SomeAction()); return 112; }); var result = await store.Dispatch(action1(new LoginInfo { username = "******" })); Assert.That(storeReducerReached, Is.EqualTo(1)); Assert.That(result, Is.EqualTo(112)); }
public static string GetUniqueName(Store store, Guid domainClassId) { string nameFree = LanguageDSLElementTypeProvider.Instance.GetTypeName(domainClassId); int counter = 1; List<string> usedNames = new List<string>(); ReadOnlyCollection<ModelElement> elements = store.ElementDirectory.FindElements(domainClassId); foreach (ModelElement element in elements) { if (LanguageDSLElementNameProvider.Instance.HasName(element)) { string s = LanguageDSLElementNameProvider.Instance.GetName(element); usedNames.Add(s); } } while (true) { if( usedNames.Contains(nameFree + counter.ToString()) ) counter++; else break; } return nameFree + counter.ToString(); }
public Snapshot GetSnapshot() { return(Store.GetSnapshot()); }
// Use this for initialization void Start() { startPosition = transform.position; gameController = FindObjectOfType <GameController>(); _store = FindObjectOfType <Store>(); }
static void DisplayPastOrders(Store StoreChoice) { PrintOrders(AllRepo.GetOrderByStore(StoreChoice)); }
/// <summary> /// Generate a feed /// </summary> /// <param name="stream">Stream</param> /// <param name="store">Store</param> /// <returns>Generated feed</returns> public void GenerateFeed(Stream stream, Store store) { if (stream == null) { throw new ArgumentNullException("stream"); } if (store == null) { throw new ArgumentNullException("store"); } const string googleBaseNamespace = "http://base.google.com/ns/1.0"; var settings = new XmlWriterSettings { Encoding = Encoding.UTF8 }; using (var writer = XmlWriter.Create(stream, settings)) { //Generate feed according to the following specs: http://www.google.com/support/merchants/bin/answer.py?answer=188494&expand=GB writer.WriteStartDocument(); writer.WriteStartElement("rss"); writer.WriteAttributeString("version", "2.0"); writer.WriteAttributeString("xmlns", "g", null, googleBaseNamespace); writer.WriteStartElement("channel"); writer.WriteElementString("title", "Google Base feed"); writer.WriteElementString("link", "http://base.google.com/base/"); writer.WriteElementString("description", "Information about products"); var products = _productService.SearchProducts(storeId: store.Id); foreach (var product in products) { var productVariants = _productService.GetProductVariantsByProductId(product.Id); foreach (var productVariant in productVariants) { writer.WriteStartElement("item"); #region Basic Product Information //id [id]- An identifier of the item writer.WriteElementString("g", "id", googleBaseNamespace, productVariant.Id.ToString()); //title [title] - Title of the item writer.WriteStartElement("title"); var title = productVariant.FullProductName; //title should be not longer than 70 characters if (title.Length > 70) { title = title.Substring(0, 70); } writer.WriteCData(title); writer.WriteEndElement(); // title //description [description] - Description of the item writer.WriteStartElement("description"); string description = productVariant.Description; if (String.IsNullOrEmpty(description)) { description = product.FullDescription; } if (String.IsNullOrEmpty(description)) { description = product.ShortDescription; } if (String.IsNullOrEmpty(description)) { description = product.Name; } if (String.IsNullOrEmpty(description)) { description = productVariant.FullProductName; //description is required } //resolving character encoding issues in your data feed description = StripInvalidChars(description, true); writer.WriteCData(description); writer.WriteEndElement(); // description //google product category [google_product_category] - Google's category of the item //the category of the product according to Google’s product taxonomy. http://www.google.com/support/merchants/bin/answer.py?answer=160081 string googleProductCategory = ""; var googleProduct = _googleService.GetByProductVariantId(productVariant.Id); if (googleProduct != null) { googleProductCategory = googleProduct.Taxonomy; } if (String.IsNullOrEmpty(googleProductCategory)) { googleProductCategory = _froogleSettings.DefaultGoogleCategory; } if (String.IsNullOrEmpty(googleProductCategory)) { throw new NopException("Default Google category is not set"); } writer.WriteStartElement("g", "google_product_category", googleBaseNamespace); writer.WriteCData(googleProductCategory); writer.WriteFullEndElement(); // g:google_product_category //product type [product_type] - Your category of the item var defaultProductCategory = _categoryService.GetProductCategoriesByProductId(product.Id).FirstOrDefault(); if (defaultProductCategory != null) { var categoryBreadCrumb = GetCategoryBreadCrumb(defaultProductCategory.Category); string yourProductCategory = ""; for (int i = 0; i < categoryBreadCrumb.Count; i++) { var cat = categoryBreadCrumb[i]; yourProductCategory = yourProductCategory + cat.Name; if (i != categoryBreadCrumb.Count - 1) { yourProductCategory = yourProductCategory + " > "; } } if (!String.IsNullOrEmpty((yourProductCategory))) { writer.WriteStartElement("g", "product_type", googleBaseNamespace); writer.WriteCData(yourProductCategory); writer.WriteFullEndElement(); // g:product_type } } //link [link] - URL directly linking to your item's page on your website var productUrl = string.Format("{0}{1}", store.Url, product.GetSeName(_workContext.WorkingLanguage.Id)); writer.WriteElementString("link", productUrl); //image link [image_link] - URL of an image of the item string imageUrl; var picture = _pictureService.GetPictureById(productVariant.PictureId); if (picture == null) { picture = _pictureService.GetPicturesByProductId(product.Id, 1).FirstOrDefault(); } if (picture != null) { imageUrl = _pictureService.GetPictureUrl(picture, _froogleSettings.ProductPictureSize, storeLocation: store.Url); } else { imageUrl = _pictureService.GetDefaultPictureUrl(_froogleSettings.ProductPictureSize, storeLocation: store.Url); } writer.WriteElementString("g", "image_link", googleBaseNamespace, imageUrl); //condition [condition] - Condition or state of the item writer.WriteElementString("g", "condition", googleBaseNamespace, "new"); #endregion #region Availability & Price //availability [availability] - Availability status of the item string availability = "in stock"; //in stock by default if (productVariant.ManageInventoryMethod == ManageInventoryMethod.ManageStock && productVariant.StockQuantity <= 0) { switch (productVariant.BackorderMode) { case BackorderMode.NoBackorders: { availability = "out of stock"; } break; case BackorderMode.AllowQtyBelow0: case BackorderMode.AllowQtyBelow0AndNotifyCustomer: { availability = "available for order"; //availability = "preorder"; } break; default: break; } } writer.WriteElementString("g", "availability", googleBaseNamespace, availability); //price [price] - Price of the item var currency = GetUsedCurrency(); decimal price = _currencyService.ConvertFromPrimaryStoreCurrency(productVariant.Price, currency); writer.WriteElementString("g", "price", googleBaseNamespace, price.ToString(new CultureInfo("en-US", false).NumberFormat) + " " + currency.CurrencyCode); #endregion #region Unique Product Identifiers /* Unique product identifiers such as UPC, EAN, JAN or ISBN allow us to show your listing on the appropriate product page. If you don't provide the required unique product identifiers, your store may not appear on product pages, and all your items may be removed from Product Search. * We require unique product identifiers for all products - except for custom made goods. For apparel, you must submit the 'brand' attribute. For media (such as books, movies, music and video games), you must submit the 'gtin' attribute. In all cases, we recommend you submit all three attributes. * You need to submit at least two attributes of 'brand', 'gtin' and 'mpn', but we recommend that you submit all three if available. For media (such as books, movies, music and video games), you must submit the 'gtin' attribute, but we recommend that you include 'brand' and 'mpn' if available. */ //GTIN [gtin] - GTIN var gtin = productVariant.Gtin; if (!String.IsNullOrEmpty(gtin)) { writer.WriteStartElement("g", "gtin", googleBaseNamespace); writer.WriteCData(gtin); writer.WriteFullEndElement(); // g:gtin } //brand [brand] - Brand of the item var defaultManufacturer = _manufacturerService.GetProductManufacturersByProductId((product.Id)).FirstOrDefault(); if (defaultManufacturer != null) { writer.WriteStartElement("g", "brand", googleBaseNamespace); writer.WriteCData(defaultManufacturer.Manufacturer.Name); writer.WriteFullEndElement(); // g:brand } //mpn [mpn] - Manufacturer Part Number (MPN) of the item var mpn = productVariant.ManufacturerPartNumber; if (!String.IsNullOrEmpty(mpn)) { writer.WriteStartElement("g", "mpn", googleBaseNamespace); writer.WriteCData(mpn); writer.WriteFullEndElement(); // g:mpn } #endregion #region Apparel Products /* Apparel includes all products that fall under 'Apparel & Accessories' (including all sub-categories) * in Google’s product taxonomy. */ //gender [gender] - Gender of the item if (googleProduct != null && !String.IsNullOrEmpty(googleProduct.Gender)) { writer.WriteStartElement("g", "gender", googleBaseNamespace); writer.WriteCData(googleProduct.Gender); writer.WriteFullEndElement(); // g:gender } //age group [age_group] - Target age group of the item if (googleProduct != null && !String.IsNullOrEmpty(googleProduct.AgeGroup)) { writer.WriteStartElement("g", "age_group", googleBaseNamespace); writer.WriteCData(googleProduct.AgeGroup); writer.WriteFullEndElement(); // g:age_group } //color [color] - Color of the item if (googleProduct != null && !String.IsNullOrEmpty(googleProduct.Color)) { writer.WriteStartElement("g", "color", googleBaseNamespace); writer.WriteCData(googleProduct.Color); writer.WriteFullEndElement(); // g:color } //size [size] - Size of the item if (googleProduct != null && !String.IsNullOrEmpty(googleProduct.Size)) { writer.WriteStartElement("g", "size", googleBaseNamespace); writer.WriteCData(googleProduct.Size); writer.WriteFullEndElement(); // g:size } #endregion #region Tax & Shipping //tax [tax] //The tax attribute is an item-level override for merchant-level tax settings as defined in your Google Merchant Center account. This attribute is only accepted in the US, if your feed targets a country outside of the US, please do not use this attribute. //IMPORTANT NOTE: Set tax in your Google Merchant Center account settings //IMPORTANT NOTE: Set shipping in your Google Merchant Center account settings //shipping weight [shipping_weight] - Weight of the item for shipping //We accept only the following units of weight: lb, oz, g, kg. if (_froogleSettings.PassShippingInfo) { var weightName = "kg"; var shippingWeight = productVariant.Weight; switch (_measureService.GetMeasureWeightById(_measureSettings.BaseWeightId).SystemKeyword) { case "ounce": weightName = "oz"; break; case "lb": weightName = "lb"; break; case "grams": weightName = "g"; break; case "kg": weightName = "kg"; break; default: //unknown weight weightName = "kg"; break; } writer.WriteElementString("g", "shipping_weight", googleBaseNamespace, string.Format(CultureInfo.InvariantCulture, "{0} {1}", shippingWeight.ToString(new CultureInfo("en-US", false).NumberFormat), weightName)); } #endregion writer.WriteElementString("g", "expiration_date", googleBaseNamespace, DateTime.Now.AddDays(28).ToString("yyyy-MM-dd")); writer.WriteEndElement(); // item } } writer.WriteEndElement(); // channel writer.WriteEndElement(); // rss writer.WriteEndDocument(); } }
static void Main(string[] args) { int Total = 0; Store store = new Store(); SalesMan v1 = new SalesMan(); v1.Name = "Carlos"; v1.Age = 30; store.AddSalesMan(v1); SalesMan v2 = new SalesMan(); v2.Name = "Juan"; v2.Age = 30; store.AddSalesMan(v2); SalesMan v3 = new SalesMan(); v3.Name = "Alberto"; v3.Age = 30; store.AddSalesMan(v3); Product p1 = new Product(); p1.Name = "Computer"; p1.Price = 500; store.AddProduc(p1); Product p2 = new Product(); p2.Name = "Keyboard"; p2.Price = 50; store.AddProduc(p2); Product p3 = new Product(); p3.Name = "Monitor"; p3.Price = 100; store.AddProduc(p3); Sale s1 = new Sale(); s1.SalesMan = v1; s1.Product = p1; s1.Comments = "Good seller and great product"; store.AddSale(s1); Sale s4 = new Sale(); s4.SalesMan = v2; s4.Product = p1; s4.Comments = "Good seller and great product"; store.AddSale(s4); Sale s2 = new Sale(); s2.SalesMan = v2; s2.Product = p2; s2.Comments = "Good seller and great product"; store.AddSale(s2); Sale s3 = new Sale(); s3.SalesMan = v3; s3.Product = p3; s3.Comments = "Good seller and great product"; store.AddSale(s3); //Calculate sales total amount Total = p1.Price + p2.Price + p3.Price; System.Console.WriteLine("The total amount of sales is: " + Total); Console.WriteLine("\nProducts"); store.printProducts(); Console.WriteLine("\nSalesMan"); store.printSalesMan(); Console.WriteLine("\nSales"); store.printSales(); Console.WriteLine("\nSales Man That Sold The Cheapest Product: "); store.sellerThatSoldCheapestProduct().salesManStatus(); Console.WriteLine("\nAverage Products Price: "); Console.WriteLine(store.averageProductsPrice()); Console.WriteLine("\nNumber Sells by seller: "); store.printNumberSellsBySalesMan(); Console.WriteLine("\nThe most expensive product: "); store.MostExpensiveProduct().ProductStatus(); }
/// <summary cref="IValueVisitor.Visit(Store)"/> public void Visit(Store store) => CodeGenerator.GenerateCode(store);
public static Props Props(NeoSystem system, Store store) { return(Akka.Actor.Props.Create(() => new Blockchain(system, store)).WithMailbox("blockchain-mailbox")); }
/// <summary> /// /// </summary> /// <returns></returns> public IEnumerator <KeyValuePair <string, string[]> > GetEnumerator() { return(Store.GetEnumerator()); }
/// <summary> /// Determines whether the collection contains an element with the specified key. /// </summary> /// <param name="key"></param> /// <returns></returns> public bool ContainsKey(string key) { return(Store.ContainsKey(key)); }
public void TestInitialize() { _workContext = null; _store = new Store { Id = "1" }; var tempStoreContext = new Mock <IStoreContext>(); { tempStoreContext.Setup(x => x.CurrentStore).Returns(_store); _storeContext = tempStoreContext.Object; } var pluginFinder = new PluginFinder(_serviceProvider); _shoppingCartSettings = new ShoppingCartSettings(); _catalogSettings = new CatalogSettings(); var tempEventPublisher = new Mock <IMediator>(); { //tempEventPublisher.Setup(x => x.PublishAsync(It.IsAny<object>())); _eventPublisher = tempEventPublisher.Object; } var cacheManager = new TestMemoryCacheManager(new Mock <IMemoryCache>().Object, _eventPublisher); _productService = new Mock <IProductService>().Object; //price calculation service _discountService = new Mock <IDiscountService>().Object; _categoryService = new Mock <ICategoryService>().Object; _manufacturerService = new Mock <IManufacturerService>().Object; _customerService = new Mock <ICustomerService>().Object; _customerProductService = new Mock <ICustomerProductService>().Object; _productReservationService = new Mock <IProductReservationService>().Object; _currencyService = new Mock <ICurrencyService>().Object; _auctionService = new Mock <IAuctionService>().Object; _serviceProvider = new Mock <IServiceProvider>().Object; _stateProvinceService = new Mock <IStateProvinceService>().Object; _productAttributeParser = new Mock <IProductAttributeParser>().Object; _priceCalcService = new PriceCalculationService(_workContext, _storeContext, _discountService, _categoryService, _manufacturerService, _productAttributeParser, _productService, _customerProductService, _vendorService, _currencyService, _shoppingCartSettings, _catalogSettings); _localizationService = new Mock <ILocalizationService>().Object; //shipping _shippingSettings = new ShippingSettings(); _shippingSettings.ActiveShippingRateComputationMethodSystemNames = new List <string>(); _shippingSettings.ActiveShippingRateComputationMethodSystemNames.Add("FixedRateTestShippingRateComputationMethod"); _shippingMethodRepository = new Mock <IRepository <ShippingMethod> >().Object; _deliveryDateRepository = new Mock <IRepository <DeliveryDate> >().Object; _warehouseRepository = new Mock <IRepository <Warehouse> >().Object; _logger = new NullLogger(); _shippingService = new ShippingService(_shippingMethodRepository, _deliveryDateRepository, _warehouseRepository, null, _logger, _productService, _productAttributeParser, _checkoutAttributeParser, _localizationService, _addressService, _countryService, _stateProvinceService, pluginFinder, _eventPublisher, _currencyService, cacheManager, _shoppingCartSettings, _shippingSettings); _shipmentService = new Mock <IShipmentService>().Object; tempPaymentService = new Mock <IPaymentService>(); { _paymentService = tempPaymentService.Object; } _checkoutAttributeParser = new Mock <ICheckoutAttributeParser>().Object; _giftCardService = new Mock <IGiftCardService>().Object; _genericAttributeService = new Mock <IGenericAttributeService>().Object; _geoLookupService = new Mock <IGeoLookupService>().Object; _countryService = new Mock <ICountryService>().Object; _customerSettings = new CustomerSettings(); _addressSettings = new AddressSettings(); //tax _taxSettings = new TaxSettings { ShippingIsTaxable = true, PaymentMethodAdditionalFeeIsTaxable = true, DefaultTaxAddressId = "10" }; var tempAddressService = new Mock <IAddressService>(); { tempAddressService.Setup(x => x.GetAddressByIdSettings(_taxSettings.DefaultTaxAddressId)) .ReturnsAsync(new Address { Id = _taxSettings.DefaultTaxAddressId }); _addressService = tempAddressService.Object; } _taxService = new TaxService(_addressService, _workContext, pluginFinder, _geoLookupService, _countryService, _logger, _taxSettings, _customerSettings, _addressSettings); _rewardPointsSettings = new RewardPointsSettings(); _orderTotalCalcService = new OrderTotalCalculationService(_workContext, _storeContext, _priceCalcService, _taxService, _shippingService, _paymentService, _checkoutAttributeParser, _discountService, _giftCardService, null, _productService, _currencyService, _taxSettings, _rewardPointsSettings, _shippingSettings, _shoppingCartSettings, _catalogSettings); _orderService = new Mock <IOrderService>().Object; _webHelper = new Mock <IWebHelper>().Object; _languageService = new Mock <ILanguageService>().Object; _priceFormatter = new Mock <IPriceFormatter>().Object; _productAttributeFormatter = new Mock <IProductAttributeFormatter>().Object; _shoppingCartService = new Mock <IShoppingCartService>().Object; _checkoutAttributeFormatter = new Mock <ICheckoutAttributeFormatter>().Object; _encryptionService = new Mock <IEncryptionService>().Object; _workflowMessageService = new Mock <IWorkflowMessageService>().Object; _customerActivityService = new Mock <ICustomerActivityService>().Object; _currencyService = new Mock <ICurrencyService>().Object; _affiliateService = new Mock <IAffiliateService>().Object; _vendorService = new Mock <IVendorService>().Object; _pdfService = new Mock <IPdfService>().Object; _paymentSettings = new PaymentSettings { ActivePaymentMethodSystemNames = new List <string> { "Payments.TestMethod" } }; _orderSettings = new OrderSettings(); _localizationSettings = new LocalizationSettings(); ICustomerActionEventService tempICustomerActionEventService = new Mock <ICustomerActionEventService>().Object; _orderProcessingService = new OrderProcessingService(_orderService, _webHelper, _localizationService, _languageService, _productService, _paymentService, _logger, _orderTotalCalcService, _priceCalcService, _priceFormatter, _productAttributeParser, _productAttributeFormatter, _giftCardService, _shoppingCartService, _checkoutAttributeFormatter, _shippingService, _taxService, _customerService, _discountService, _encryptionService, _workContext, _workflowMessageService, _vendorService, _currencyService, _affiliateService, _eventPublisher, _pdfService, null, _storeContext, _productReservationService, _auctionService, _countryService, _shippingSettings, _shoppingCartSettings, _paymentSettings, _orderSettings, _taxSettings, _localizationSettings); }
public void LoadOrCreateNewTransientCart(string cartName, Store store, User user, Language language, Currency currency, string type = null) { LoadOrCreateNewTransientCartAsync(cartName, store, user, language, currency).GetAwaiter().GetResult(); }
/// <summary> /// Get the associated values from the collection in their original format. /// Returns null if the key is not present. /// </summary> /// <param name="key"></param> /// <returns></returns> public IList <string> GetValues(string key) { string[] values; Store.TryGetValue(key, out values); return(values); }
public User_ImportFromExcelViewModel(Store store) : base(store) { }
public VisualElement CreateOnboardingElement(Store store) { return(new Onboarding(store)); }
public virtual Task <IList <T> > Get() { using (Session = Store.OpenAsyncSession()) return(Session.Query <T>().ToListAsync()); }
protected virtual CartSearchCriteria CreateCartSearchCriteria(string cartName, Store store, User user, Language language, Currency currency, string type) { return(new CartSearchCriteria { StoreId = store.Id, Customer = user, Name = cartName, Currency = currency, Type = type }); }
public ConsensusService(IActorRef localNode, IActorRef taskManager, Store store, Wallet wallet) : this(localNode, taskManager, new ConsensusContext(wallet, store)) { }
public override void ElementPropertyChanged(ElementPropertyChangedEventArgs e) { base.ElementPropertyChanged(e); ModelRoot element = (ModelRoot)e.ModelElement; Store store = element.Store; Transaction current = store.TransactionManager.CurrentTransaction; if (current.IsSerializing || ModelRoot.BatchUpdating) { return; } if (Equals(e.NewValue, e.OldValue)) { return; } List <string> errorMessages = EFCoreValidator.GetErrors(element).ToList(); bool redraw = false; switch (e.DomainProperty.Name) { case "ConnectionString": if (e.NewValue != null) { element.ConnectionStringName = null; } break; case "ConnectionStringName": if (e.NewValue != null) { element.ConnectionString = null; } break; case "DatabaseSchema": if (string.IsNullOrEmpty((string)e.NewValue)) { element.DatabaseSchema = "dbo"; } break; case "EntityFrameworkVersion": element.EntityFrameworkPackageVersion = "Latest"; if (element.EntityFrameworkVersion == EFVersion.EFCore) { element.InheritanceStrategy = CodeStrategy.TablePerHierarchy; } break; case "EnumOutputDirectory": if (string.IsNullOrEmpty((string)e.NewValue) && !string.IsNullOrEmpty(element.EntityOutputDirectory)) { element.EnumOutputDirectory = element.EntityOutputDirectory; } break; case "ExposeForeignKeys": if (!element.ExposeForeignKeys) { foreach (Association association in element.Store.ElementDirectory.AllElements.OfType <Association>() .Where(a => (a.SourceRole == EndpointRole.Dependent || a.TargetRole == EndpointRole.Dependent) && !string.IsNullOrWhiteSpace(a.FKPropertyName))) { association.FKPropertyName = null; } } break; case "StructOutputDirectory": if (string.IsNullOrEmpty((string)e.NewValue) && !string.IsNullOrEmpty(element.EntityOutputDirectory)) { element.StructOutputDirectory = element.EntityOutputDirectory; } break; case "EntityOutputDirectory": if (string.IsNullOrEmpty(element.EnumOutputDirectory) || element.EnumOutputDirectory == (string)e.OldValue) { element.EnumOutputDirectory = (string)e.NewValue; } if (string.IsNullOrEmpty(element.StructOutputDirectory) || element.StructOutputDirectory == (string)e.OldValue) { element.StructOutputDirectory = (string)e.NewValue; } break; case "FileNameMarker": string newFileNameMarker = (string)e.NewValue; if (!Regex.Match($"a.{newFileNameMarker}.cs", @"^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\x00-\x1f\\?*:\"";|/]+$") .Success) { errorMessages.Add("Invalid value to make part of file name"); } break; case "InheritanceStrategy": if ((element.EntityFrameworkVersion == EFVersion.EFCore) && (element.NuGetPackageVersion.MajorMinorVersionNum < 2.1)) { element.InheritanceStrategy = CodeStrategy.TablePerHierarchy; } break; case "Namespace": errorMessages.Add(CommonRules.ValidateNamespace((string)e.NewValue, CodeGenerator.IsValidLanguageIndependentIdentifier)); break; case "ShowCascadeDeletes": // Normally you'd think that we should be able to register this in a AssociateValueWith call // in AssociationConnector, but that doesn't appear to work. So call the update method here. foreach (Association association in store.ElementDirectory.FindElements <Association>()) { PresentationHelper.UpdateAssociationDisplay(association); } redraw = true; break; case "ShowWarningsInDesigner": redraw = true; break; case "WarnOnMissingDocumentation": if (element.ShowWarningsInDesigner) { redraw = true; } ModelRoot.ExecuteValidator?.Invoke(); break; } errorMessages = errorMessages.Where(m => m != null).ToList(); if (errorMessages.Any()) { current.Rollback(); ErrorDisplay.Show(string.Join("\n", errorMessages)); } if (redraw) { element.InvalidateDiagrams(); } }
protected override void AfterMetaModelsLoaded(object storeKey, Store store) { // Create the store-specific property description redirector new SFSchemaLanguagePropertyDescriptionRedirector(this.ServiceProvider, this.Store); }
public virtual Task <T> Get(int id) { using (Session = Store.OpenAsyncSession()) return(Session.LoadAsync <T>(id)); }
public virtual decimal ConvertCurrency(decimal amount, Currency sourceCurrency, Currency targetCurrency, Store store = null) { Guard.NotNull(sourceCurrency, nameof(sourceCurrency)); Guard.NotNull(targetCurrency, nameof(targetCurrency)); decimal result = amount; if (sourceCurrency.Id == targetCurrency.Id) { return(result); } if (result != decimal.Zero && sourceCurrency.Id != targetCurrency.Id) { result = ConvertToPrimaryExchangeRateCurrency(result, sourceCurrency, store); result = ConvertFromPrimaryExchangeRateCurrency(result, targetCurrency, store); } return(result); }
protected override ElementProvider[] GetElementProviders(Store store, object storeKey) { return(new ElementProvider[0]); }
protected override int DoExecuteWithoutFetch(params Query[] queries) { return(Store.DoExecuteWithoutFetch(m_Connection, m_Transaction, queries)); }
public virtual decimal ConvertFromPrimaryExchangeRateCurrency(decimal amount, Currency targetCurrency, Store store = null) { Guard.NotNull(targetCurrency, nameof(targetCurrency)); decimal result = amount; var primaryExchangeRateCurrency = store == null ? _storeContext.CurrentStore.PrimaryExchangeRateCurrency : store.PrimaryExchangeRateCurrency; if (result != decimal.Zero && targetCurrency.Id != primaryExchangeRateCurrency.Id) { decimal exchangeRate = targetCurrency.Rate; if (exchangeRate == decimal.Zero) { throw new SmartException(string.Format("Exchange rate not found for currency [{0}]", targetCurrency.Name)); } result *= exchangeRate; } return(result); }
protected override List <RowsetBase> DoLoad(bool oneDoc, params Query[] queries) { return(Store.DoLoad(m_Connection, m_Transaction, queries, oneDoc)); }
public virtual decimal ConvertFromPrimaryStoreCurrency(decimal amount, Currency targetCurrency, Store store = null) { Guard.NotNull(targetCurrency, nameof(targetCurrency)); var primaryStoreCurrency = store == null ? _storeContext.CurrentStore.PrimaryStoreCurrency : store.PrimaryStoreCurrency; return(ConvertCurrency(amount, primaryStoreCurrency, targetCurrency, store)); }
protected override int DoDelete(Doc doc, IDataStoreKey key) { return(Store.DoDelete(m_Connection, m_Transaction, doc, key)); }
protected override Cursor DoOpenCursor(Query query) { return(Store.DoOpenCursor(m_Connection, m_Transaction, query)); }
protected override int DoUpdate(Doc doc, IDataStoreKey key, FieldFilterFunc filter = null) { return(Store.DoUpdate(m_Connection, m_Transaction, doc, key, filter)); }
protected override Schema DoGetSchema(Query query) { return(Store.DoGetSchema(m_Connection, m_Transaction, query)); }