Exemplo n.º 1
0
        public void UserSearchList(
              string filter
            , int pageNumber
            , string mode
            , GlobalTemplateMembers.CommonHeadFootTemplate head
            , UserSearchListTemplate item
            , GlobalTemplateMembers.CommonHeadFootTemplate foot
            , GlobalTemplateMembers.NodataTemplate nodata
            )
        {

            AdminUserFilter searchFilter;

            UserCollection users = new UserCollection();
            int rowCount = 0;

            searchFilter = AdminUserFilter.GetFromFilter(filter);


            if (!string.IsNullOrEmpty(mode) && 
                  (mode.IndexOf("admin", StringComparison.OrdinalIgnoreCase) >= 0 
                || mode.IndexOf("realname", StringComparison.OrdinalIgnoreCase )>=0))
            {
                if (searchFilter == null)
                {
                    searchFilter = new AdminUserFilter();

                    searchFilter.Order = UserOrderBy.UserID;
                    searchFilter.IsDesc = true;
                }

                if (searchFilter.FuzzySearch == null) searchFilter.FuzzySearch = true;//默认就是模糊搜索
                users = UserBO.Instance.AdminSearchUsers(My.UserID, searchFilter, pageNumber, out rowCount);
            }
            else
            {
                if (searchFilter == null) return;
            }


            if (rowCount > 0)
            {
                head.Invoke(new GlobalTemplateMembers.CommonHeadFootTemplateParams(rowCount, searchFilter.Pagesize));
                foreach (User user in users)
                {
                    item.Invoke(user);
                }
                foot.Invoke(new GlobalTemplateMembers.CommonHeadFootTemplateParams(rowCount, searchFilter.Pagesize));
            }
            else
            {
                nodata.Invoke();
            }
        }
Exemplo n.º 2
0
        public void InviteSerialList(
              string filter
            , string mode
            , int pageNumber
            , InviteSerialManagerTemplate listItem
            , GlobalTemplateMembers.CommonHeadFootTemplate foot
            , GlobalTemplateMembers.CommonHeadFootTemplate head
            )
        {
            InviteSerialFilter searchFilter = InviteSerialFilter.GetFromFilter(filter);
            InviteSerialCollection inviteSerials;

            int rowCount;
            if (searchFilter == null) searchFilter = new InviteSerialFilter();
            int? owner = null;
            if (string.IsNullOrEmpty(mode) || !mode.Equals("admin", StringComparison.OrdinalIgnoreCase))
            {
                if (searchFilter.Status == null)
                {
                    searchFilter.Status = InviteSerialStatus.Unused;
                }
                owner =User.CurrentID;
            }

            inviteSerials = InviteBO.Instance.GetInviteSerials(User.Current, owner,searchFilter, pageNumber, out rowCount);

            UserBO.Instance.FillSimpleUsers(inviteSerials, 0);

            head.Invoke(new GlobalTemplateMembers.CommonHeadFootTemplateParams(rowCount, searchFilter.Pagesize));
            foreach (InviteSerial s in inviteSerials)
            {
                listItem.Invoke(s);
            }
            foot.Invoke(new GlobalTemplateMembers.CommonHeadFootTemplateParams(rowCount, searchFilter.Pagesize));
        }
Exemplo n.º 3
0
        public void InviteSerialStatList(
             string sortBy
            , int pageSize
            , int PageNumber
            , GlobalTemplateMembers.CommonHeadFootTemplate head
            , GlobalTemplateMembers.CommonHeadFootTemplate foot
            , InviteSerialStatTemplate item)
        {
            if (pageSize <= 0) pageSize = Consts.DefaultPageSize ;

            InviteSerialStatus orderType = InviteSerialStatus.All;
            InviteSerialStatCollection Stats;


            if (!string.IsNullOrEmpty(sortBy))
            {
                sortBy = sortBy.Trim();
                if (sortBy.Equals("used", StringComparison.OrdinalIgnoreCase))
                    orderType = InviteSerialStatus.Used;
                else if (sortBy.Equals("unused", StringComparison.OrdinalIgnoreCase))
                    orderType = InviteSerialStatus.Unused;
                else if (sortBy.Equals("noreg", StringComparison.OrdinalIgnoreCase))
                    orderType = InviteSerialStatus.Unused;
                else if (sortBy.Equals("expiress", StringComparison.OrdinalIgnoreCase))
                    orderType = InviteSerialStatus.Expires;
            }

            int rowCount;
            Stats = InviteBO.Instance.GetStatList(orderType, pageSize, PageNumber, out rowCount);

            head(new GlobalTemplateMembers.CommonHeadFootTemplateParams(rowCount, pageSize));
            if (rowCount > 0)
            {
                UserBO.Instance.FillSimpleUsers(Stats);
                foreach (InviteSerialStat stat in Stats)
                {
                    item.Invoke(stat);
                }
            }
            foot(new GlobalTemplateMembers.CommonHeadFootTemplateParams(rowCount, pageSize));
        }
Exemplo n.º 4
0
        public void FeedTemplateList(string appID
            , GlobalTemplateMembers.CannotDoTemplate canNotDo
            , FeedTemplateHeadFootItemTemplate head
            , FeedTemplateHeadFootItemTemplate foot
            , FeedTemplateListItemTemplate item)
        {
            Guid currentAppID;
            try
            {
                currentAppID = new Guid(appID);
            }
            catch
            {
                currentAppID = new BasicApp().AppID;
                //throw new Exception("非法的AppID");
            }


            FeedTemplateCollection feedTemplates;
            using (ErrorScope errorScope = new ErrorScope())
            {
                feedTemplates = FeedBO.Instance.GetFeedTemplates(currentAppID);
                errorScope.CatchError<ErrorInfo>(delegate(ErrorInfo error)
                {
                    canNotDo(error.Message);
                    return;
                });
            }

            int totalCount = feedTemplates.Count;

            AppBase currentApp = AppManager.GetApp(currentAppID);

            head(totalCount > 0, totalCount, currentApp);

            int i = 0;

            foreach (FeedTemplate feedTemplate in feedTemplates)
            {
                item(i++, feedTemplate, currentApp);
            }

            foot(totalCount > 0, totalCount, currentApp);
        }
Exemplo n.º 5
0
        public void AppActionList(
              AppBase app
            , GlobalTemplateMembers.CannotDoTemplate cannotDo
            , GlobalTemplateMembers.NodataTemplate nodata
            , AppActionListHeadFootTemplate head
            , AppActionListHeadFootTemplate foot
            , AppActionListItemTemplate item)
        {
            AppActionCollection appActions = app.AppActions;

            head();

            int j = 0;

            foreach (AppAction appAction in appActions)
            {
                if (FeedBO.Instance.IsSiteFeed(app.AppID, appAction.ActionType))
                    continue;

                bool display = true;
                foreach (FeedSendItem tempItem in AllSettings.Current.PrivacySettings.FeedSendItems)
                {
                    if ((tempItem.DefaultSendType == FeedSendItem.SendType.ForceSend || tempItem.DefaultSendType == FeedSendItem.SendType.ForceNotSend)
                        && tempItem.AppID == app.AppID && tempItem.ActionType == appAction.ActionType)
                        display = false;

                }

                if (display)
                    item(j++, appAction);
            }

            if (appActions.Count == 0)
                nodata();

            foot();

        }
Exemplo n.º 6
0
        public void AppList(
              GlobalTemplateMembers.CannotDoTemplate cannotDo
            , GlobalTemplateMembers.NodataTemplate nodata
            , AppListHeadFootTemplate head
            , AppListHeadFootTemplate foot
            , AppListItemTemplate item)
        {
            AppBaseCollection apps = AppManager.GetAllApps();

            int i = 0;

            head();

            foreach (AppBase app in apps)
            {
                item(i++, app);
            }

            if (apps.Count == 0)
                nodata();

            foot();

        }
Exemplo n.º 7
0
        public void MedalValidityTime(Mission mission, int medalID, bool isEdit, GlobalTemplateMembers.ValidityTimeTemplate template)
        {
            long seconds = 0;
            if (isEdit)
            {
                foreach (PrizeMedal medal in mission.Prize.Medals)
                {
                    if (medal.MedalID == medalID)
                    {
                        seconds = medal.Seconds;
                        break;
                    }
                }

            }
            else
                seconds = 0;
            new GlobalTemplateMembers().TimeFormater(seconds, template);
        }
Exemplo n.º 8
0
 public void UserGroupValidityTime(Mission mission, Guid groupID, bool isEdit, GlobalTemplateMembers.ValidityTimeTemplate template)
 {
     long seconds;
     if (isEdit)
     {
         if (mission.Prize.UserGroups.ContainsKey(groupID))
             seconds = mission.Prize.UserGroups[groupID];
         else
             seconds = 0;
     }
     else
         seconds = 0;
     new GlobalTemplateMembers().TimeFormater(seconds, template);
 }