private object GetBinding(dynamic parameters)
        {
            SiteBinding siteBinding = this._siteBindingRepository.GetSiteBinding(parameters.SiteId);

            logManager.Write($"[GET]-> GetBinding Id: {siteBinding.Id}");
            return(Response.AsJson(siteBinding));
        }
        private object PostBinding(dynamic parameters)
        {
            SiteBinding newBinding = this.Bind <SiteBinding>();
            int         result     = _siteBindingRepository.PostSiteBinding(newBinding);

            logManager.Write($"[POST]-> PostBinding Id: {result}");
            return(Response.AsJson(result));
        }
Exemplo n.º 3
0
 public void Save(SiteBinding Model, string UserOwnerID)
 {
     using (var _c = db)
     {
         var _Site = _c.SiteUsers.Where(m => m.UserID.Equals(UserOwnerID) && m.SiteID == Model.SiteID).Select(m => m.Site).SingleOrDefault();
         _Site.GAID        = Model.GAID;
         _Site.DefaultLang = Model.DefaultLang;
         _c.SaveChanges();
     }
 }
Exemplo n.º 4
0
        protected override void LoadMessage(PropertyBag bag)
        {
            int count = (int)bag[0];

            bindings = new SiteBinding[count];

            for (int i = 0; i < count; i++)
            {
                bindings[i] = new SiteBinding((PropertyBag)bag[i + 1]);
            }
        }
Exemplo n.º 5
0
        public List <SiteInfo> GetSites()
        {
            List <SiteInfo> siteInfos = new List <SiteInfo>();
            var             server    = new ServerManager();//请使用管理员模式

            foreach (Site site in server.Sites)
            {
                SiteInfo siteInfo = new SiteInfo()
                {
                    Name            = site.Name,
                    Id              = site.Id,
                    ServerAutoStart = site.ServerAutoStart,
                    AppPoolName     = site.ApplicationDefaults.ApplicationPoolName,
                    SiteState       = (SiteState)(int)site.State,
                    PhysicalPath    = site.Applications["/"].VirtualDirectories["/"].PhysicalPath
                };
                // s.Pool = site.Applications["/"].ApplicationPoolName;
                var appPool = server.ApplicationPools.Where(q => q.Name == siteInfo.AppPoolName).FirstOrDefault();
                if (appPool != null)
                {
                    siteInfo.AppPoolState = (SiteState)(int)appPool.State;
                }
                siteInfo.Bindings = new List <SiteBinding>();
                foreach (Binding item in site.Bindings)
                {
                    string url = item.Protocol + "://";
                    if (item.EndPoint.Address.ToString() == "0.0.0.0")
                    {
                        url += item.Host + ":" + item.EndPoint.Port;
                    }
                    else
                    {
                        url += item.EndPoint.Address.ToString() + ":" + item.EndPoint.Port;
                    }
                    //s.List_url.Add(url);

                    SiteBinding siteBinding = new SiteBinding()
                    {
                        BindingInformation = item.BindingInformation,
                        Protocol           = item.Protocol,
                        Host = item.Host,
                        IsIPPortHostBinding = item.IsIPPortHostBinding
                    };
                    siteInfo.Bindings.Add(siteBinding);
                }
                siteInfos.Add(siteInfo);
            }

            return(siteInfos);
        }
Exemplo n.º 6
0
 public SiteAllBinding(SiteBinding Site, List<CultureBase> Cultures)
 {
     foreach (PropertyInfo prop in Site.GetType().GetProperties())
         GetType().GetProperty(prop.Name).SetValue(this, prop.GetValue(Site, null), null);
     var _Cultures = new List<CultureBinding>();
     foreach (var item in Cultures)
     {
         _Cultures.Add(new CultureBinding
         {
             Name = item.Name,
             Facebook = item.Facebook,
             GPlus = item.GPlus,
             Instagram = item.Instagram,
             Tumblr = item.Tumblr,
             Twitter = item.Twitter,
             YoutubeChannel=item.YoutubeChannel
         });
     }
     this.Cultures = _Cultures;
 }
Exemplo n.º 7
0
        public SiteAllBinding(SiteBinding Site, List <CultureBase> Cultures)
        {
            foreach (PropertyInfo prop in Site.GetType().GetProperties())
            {
                GetType().GetProperty(prop.Name).SetValue(this, prop.GetValue(Site, null), null);
            }
            var _Cultures = new List <CultureBinding>();

            foreach (var item in Cultures)
            {
                _Cultures.Add(new CultureBinding
                {
                    Name           = item.Name,
                    Facebook       = item.Facebook,
                    GPlus          = item.GPlus,
                    Instagram      = item.Instagram,
                    Tumblr         = item.Tumblr,
                    Twitter        = item.Twitter,
                    YoutubeChannel = item.YoutubeChannel
                });
            }
            this.Cultures = _Cultures;
        }
Exemplo n.º 8
0
 public IHttpActionResult PutSaveSite(SiteBinding Model)
 {
     SiteService.Save(Model, User.Identity.GetUserId());
     return Ok();
 }
Exemplo n.º 9
0
 public void Save(SiteBinding Model, string UserOwnerID)
 {
     using (var _c = db)
     {
         var _Site = _c.SiteUsers.Where(m => m.UserID.Equals(UserOwnerID) && m.SiteID == Model.SiteID).Select(m => m.Site).SingleOrDefault();
         _Site.GAID = Model.GAID;
         _Site.DefaultLang = Model.DefaultLang;
         _c.SaveChanges();
     }
 }
Exemplo n.º 10
0
 public int PostSiteBinding(SiteBinding siteBinding)
 {
     return(DataVault
            .Post(DapperMethod.CoreServices.PostSiteBinding, siteBinding));
 }
Exemplo n.º 11
0
 public IHttpActionResult PutSaveSite(SiteBinding Model)
 {
     SiteService.Save(Model, User.Identity.GetUserId());
     return(Ok());
 }
Exemplo n.º 12
0
 public static SiteBinding PostSiteBinding(SiteBinding item)
 {
     return(WebOperations
            .WebPost(item, WebOperations.WebMethod.POST_BINDING_MULTIPLE, _authToken));
 }