Beispiel #1
0
        public static int CreateSueetieApplication(int applicationId, string appKey, string appDescription, int groupId, int appTypeId)
        {
            var sueetieApplication = new SueetieApplication
            {
                ApplicationID     = applicationId,
                ApplicationKey    = appKey,
                GroupID           = groupId,
                ApplicationTypeID = appTypeId,
                Description       = appDescription
            };

            var provider = SueetieDataProvider.LoadProvider();

            provider.CreateSueetieApplication(sueetieApplication);
            if (sueetieApplication.ApplicationTypeID == (int)SueetieApplicationType.Blog && sueetieApplication.GroupID == 0)
            {
                var sueetieBlog = new SueetieBlog
                {
                    ApplicationID = applicationId,
                    BlogTitle     = sueetieApplication.Description
                };
                SueetieBlogs.CreateSueetieBlog(sueetieBlog);
            }

            ClearApplicationListCache();
            return(applicationId);
        }
Beispiel #2
0
        private static SueetieApplication GetApplication(Uri uri)
        {
            SueetieApplication sueetieApplication = null;

            //   uri = new Uri(HttpContext.Current.Request.RawUrl);

            // if (uri.Segments.Length > 2)
            if (uri.AbsolutePath.LastIndexOf("/") > 0)
            {
                var keyElement  = uri.Segments.ElementAt(1).Replace("/", string.Empty);
                var groupFolder = SiteSettings.Instance.GroupsFolderName;
                if (keyElement == groupFolder && uri.Segments.Length > 3)
                {
                    var groupName   = uri.Segments.ElementAt(2).Replace("/", string.Empty);
                    var groupAppKey = uri.Segments.ElementAt(3).Replace("/", string.Empty);
                    var a           = from app in Get().All
                                      where app.GroupKey == groupName && app.ApplicationKey == groupAppKey
                                      select app;
                    try
                    {
                        sueetieApplication = a.Single();
                    }
                    catch
                    {
                        sueetieApplication = GetDefaultApplication();
                    }
                }
                else
                {
                    var b = from app in Get().All
                            where app.ApplicationKey.ToLower() == keyElement.ToLower() && app.GroupKey == null
                            select app;
                    try
                    {
                        var _sueetieApplication = b.FirstOrDefault();

                        if (_sueetieApplication != null)
                        {
                            var g = from grp in Get().Groups
                                    where grp.GroupID == 0
                                    select grp;
                            _sueetieApplication.Group = g.Single();

                            sueetieApplication = _sueetieApplication;
                        }
                    }
                    catch
                    {
                        sueetieApplication = GetDefaultApplication();
                    }
                }
            }
            else
            {
                sueetieApplication = GetDefaultApplication();
            }

            return(sueetieApplication);
        }
Beispiel #3
0
        public static void UpdateSueetieApplication(string appKey, string appDescription, bool isActive, int groupId, int appTypeId, int applicationId)
        {
            var sueetieApplication = new SueetieApplication
            {
                ApplicationID     = applicationId,
                ApplicationKey    = appKey,
                IsActive          = isActive,
                GroupID           = groupId,
                ApplicationTypeID = appTypeId,
                Description       = appDescription
            };
            var provider = SueetieDataProvider.LoadProvider();

            provider.UpdateSueetieApplication(sueetieApplication);

            ClearApplicationListCache();
        }
        public static List <SueetieApplication> GetCmsApplicationList()
        {
            var provider            = SueetieDataProvider.LoadProvider();
            var sueetieApplications = provider.GetCMSApplicationList();

            if (sueetieApplications.Count == 0)
            {
                var app = new SueetieApplication
                {
                    ApplicationID = -1,
                    Description   = "Not Available"
                };
                sueetieApplications.Add(app);
            }
            else
            {
                foreach (var app in sueetieApplications)
                {
                    app.Description = app.Description + "  (" + app.ApplicationKey + ")";
                }
            }
            return(sueetieApplications);
        }