예제 #1
0
        protected bool InitPositions(MixCmsContext context, IDbContextTransaction transaction)
        {
            bool isSucceed = true;
            var  count     = context.MixPortalPage.Count();

            if (count == 0)
            {
                var p = new MixPosition()
                {
                    Description = nameof(MixEnums.CatePosition.Nav)
                };
                context.Entry(p).State = EntityState.Added;
                p = new MixPosition()
                {
                    Description = nameof(MixEnums.CatePosition.Top)
                };
                context.Entry(p).State = EntityState.Added;
                p = new MixPosition()
                {
                    Description = nameof(MixEnums.CatePosition.Left)
                };
                context.Entry(p).State = EntityState.Added;
                p = new MixPosition()
                {
                    Description = nameof(MixEnums.CatePosition.Footer)
                };
                context.Entry(p).State = EntityState.Added;

                context.SaveChanges();
            }
            return(isSucceed);
        }
예제 #2
0
 protected static bool InitCultures(InitCulture culture, MixCmsContext context, IDbContextTransaction transaction)
 {
     V_0 = true;
     try
     {
         if (context.get_MixCulture().Count <MixCulture>() == 0)
         {
             stackVariable5 = new MixCulture();
             stackVariable5.set_Id(1);
             stackVariable5.set_Specificulture(culture.get_Specificulture());
             stackVariable5.set_FullName(culture.get_FullName());
             stackVariable5.set_Description(culture.get_Description());
             stackVariable5.set_Icon(culture.get_Icon());
             stackVariable5.set_Alias(culture.get_Alias());
             stackVariable5.set_Status(2.ToString());
             stackVariable5.set_CreatedDateTime(DateTime.get_UtcNow());
             context.Entry <MixCulture>(stackVariable5).set_State(4);
             dummyVar0 = context.SaveChanges();
         }
     }
     catch
     {
         dummyVar1 = exception_0;
         V_0       = false;
     }
     return(V_0);
 }
예제 #3
0
        protected bool InitCultures(InitCulture culture, MixCmsContext context, IDbContextTransaction transaction)
        {
            bool isSucceed = true;

            try
            {
                if (context.MixCulture.Count() == 0)
                {
                    // EN-US

                    var enCulture = new MixCulture()
                    {
                        Specificulture = culture.Specificulture,
                        FullName       = culture.FullName,
                        Description    = culture.Description,
                        Icon           = culture.Icon,
                        Alias          = culture.Alias,
                        Status         = (int)MixEnums.MixContentStatus.Published
                    };
                    context.Entry(enCulture).State = EntityState.Added;

                    context.SaveChanges();
                }
            }
            catch
            {
                isSucceed = false;
            }
            return(isSucceed);
        }