当前位置: 首页>>代码示例>>C#>>正文


C# Store.Save方法代码示例

本文整理汇总了C#中Store.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Store.Save方法的具体用法?C# Store.Save怎么用?C# Store.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Store的用法示例。


在下文中一共展示了Store.Save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BtnCreate_Click

        protected void BtnCreate_Click( object sender, EventArgs e )
        {
            if ( Page.IsValid ) {
            Store store = new Store( TxtName.Text );
            store.Save();

            //Give permissions to the current logged in user
            Permissions permissions = PermissionService.Instance.GetCurrentLoggedInUserPermissions();
            if ( permissions != null && !permissions.IsUserSuperAdmin ) {
              StoreSpecificPermissionType storePermissions = StoreSpecificPermissionType.None;

              foreach ( StoreSpecificPermissionType permissionType in Enum.GetValues( typeof( StoreSpecificPermissionType ) ).Cast<StoreSpecificPermissionType>() ) {
            storePermissions |= permissionType;
              }
              permissions.StoreSpecificPermissions.Add( store.Id, storePermissions );
              permissions.Save();
            }

            const string editOrderFilePath = @"macroScripts\tea-commerce\edit-order.cshtml";
            if ( File.Exists( HostingEnvironment.MapPath( "~" + Path.DirectorySeparatorChar + editOrderFilePath ) ) ) {
              store.UISettings.EditOrderUiFile = editOrderFilePath;
              store.Save();
            }

            if ( store.GeneralSettings.ConfirmationEmailTemplateId != null ) {
              const string emailTemplateFile = @"macroScripts\tea-commerce\email-template-confirmation.cshtml";

              if ( File.Exists( HostingEnvironment.MapPath( "~" + Path.DirectorySeparatorChar + emailTemplateFile ) ) ) {
            EmailTemplate emailTemplate = EmailTemplateService.Instance.Get( store.Id, store.GeneralSettings.ConfirmationEmailTemplateId.Value );
            EmailTemplateSettings defaultSettings = emailTemplate.Settings.SingleOrDefault( s => s.LanguageId == null );
            if ( defaultSettings != null ) {
              defaultSettings.TemplateFile = emailTemplateFile;
            }
            emailTemplate.Save();
              }
            }

            if ( store.GeneralSettings.PaymentInconsistencyEmailTemplateId != null ) {
              const string emailTemplateFile = @"macroScripts\tea-commerce\email-template-payment-inconsistency.cshtml";

              if ( File.Exists( HostingEnvironment.MapPath( "~" + Path.DirectorySeparatorChar + emailTemplateFile ) ) ) {
            EmailTemplate emailTemplate = EmailTemplateService.Instance.Get( store.Id, store.GeneralSettings.PaymentInconsistencyEmailTemplateId.Value );
            EmailTemplateSettings defaultSettings = emailTemplate.Settings.SingleOrDefault( s => s.LanguageId == null );
            if ( defaultSettings != null ) {
              defaultSettings.TemplateFile = emailTemplateFile;
            }
            emailTemplate.Save();
              }
            }

            Redirect( WebUtils.GetPageUrl( Constants.Pages.EditStore ) + "?id=" + store.Id );
              }
        }
开发者ID:uniquelau,项目名称:Tea-Commerce-for-Umbraco,代码行数:53,代码来源:CreateStore.ascx.cs

示例2: Main

        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();
        }
开发者ID:Pondidum,项目名称:Ambry,代码行数:32,代码来源:Program.cs

示例3: Store

        public void Daten_können_gespeichert_und_geladen_werden() {
            var daten = new[] {
                new Datensatz {Name = "Stefan", Strasse = "Am Bahnhof"},
                new Datensatz {Name = "Paul", Strasse = "Drumroad 42"}
            };

            var sut = new Store();
            sut.Save(daten);

            var geladeneDaten = sut.Load();

            Assert.AreEqual(2, geladeneDaten.Count());

            Assert.AreEqual("Stefan", geladeneDaten.ElementAt(0).Name);
            Assert.AreEqual("Am Bahnhof", geladeneDaten.ElementAt(0).Strasse);
            
            Assert.AreEqual("Paul", geladeneDaten.ElementAt(1).Name);
            Assert.AreEqual("Drumroad 42", geladeneDaten.ElementAt(1).Strasse);

            //Assert.AreEqual(new[]{"Stefan", "Paul"}, geladeneDaten.Select(x => x.Name));
            //Assert.AreEqual(new[]{"Am Bahnhof", "Drumroad 42"}, geladeneDaten.Select(x => x.Strasse));
        }
开发者ID:slieser,项目名称:sandbox2,代码行数:22,代码来源:StoreTests.cs


注:本文中的Store.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。