Example #1
0
        public void Handle(ChangeEmployeeOwnerEvent e)
        {
            this.EditDate = e.CreateDate;
            this.Editor   = e.Creator;

            this.GroupSort    = e.GroupSort;
            this.DepartmentId = e.DepartmentId;
        }
        public void Handle(ChangeResourceActionDescnEvent e)
        {
            if (!this.IsContextCall)
            {
                return;
            }

            this.ActionDescn = e.Descn;
            this.GroupSort   = e.GroupSort;
            this.EditDate    = e.CreateDate;
            this.Editor      = e.Creator;
        }
Example #3
0
        /// <summary>
        /// 检查当前用户的操作权限
        /// </summary>
        private string CheckCurrentOperator(GroupSort targetSort, AppUser current)
        {
            if (current == null)
            {
                return("你当前登陆信息为找到");
            }

            if (current.GroupSort >= targetSort)
            {
                return(null);
            }

            return("你当前登陆权限无法操作该资源");
        }
 private void GetSortBy(SortOrderData sod, out List <SortBy> sortBy, out List <GroupByAndOrder> groupBy, out int expandCount)
 {
     sortBy  = new List <SortBy>();
     groupBy = new List <GroupByAndOrder>();
     foreach (SortOrderMember sortOrderMember in sod.Members)
     {
         if (groupBy.Count >= 4 || groupBy.Count + sortBy.Count >= 6)
         {
             break;
         }
         SortOrder sortOrder;
         if ((sortOrderMember.Flags & 1) != 0)
         {
             sortOrder = SortOrder.Descending;
         }
         else
         {
             sortOrder = SortOrder.Ascending;
         }
         if (sortOrderMember.IsCategory)
         {
             PropertyDefinition propertyDefinition = base.Mailbox.ConvertPropTagsToDefinitions(new PropTag[]
             {
                 (PropTag)sortOrderMember.PropTag
             })[0];
             Aggregate aggregate;
             if ((sortOrderMember.Flags & 4) != 0)
             {
                 aggregate = Aggregate.Max;
             }
             else
             {
                 aggregate = Aggregate.Min;
             }
             GroupSort groupSortColumn = new GroupSort(propertyDefinition, sortOrder, aggregate);
             groupBy.Add(new GroupByAndOrder(propertyDefinition, groupSortColumn));
         }
         else
         {
             sortBy.Add(new SortBy(base.Mailbox.ConvertPropTagsToDefinitions(new PropTag[]
             {
                 (PropTag)sortOrderMember.PropTag
             })[0], sortOrder));
         }
     }
     expandCount = groupBy.Count;
 }
        public void ChangeInfo(IWorkContext context, string descn, GroupSort groupSort)
        {
            if (this.ActionDescn.IsEquals(descn) && this.GroupSort == groupSort)
            {
                return;
            }

            this.ApplyEvent(new ChangeResourceActionDescnEvent()
            {
                AggregateId = this.AggregateId,
                Creator     = context.GetWorkerName(),
                CreateDate  = context.WorkTime,
                Version     = this.Version,
                Descn       = descn,
                GroupSort   = groupSort
            });
        }
Example #6
0
        public void Handle(CreateEmployeeEvent e)
        {
            if (!this.IsContextCall)
            {
                return;
            }

            this.CreateDate = e.CreateDate;
            this.EditDate   = e.CreateDate;
            this.Creator    = e.Creator;
            this.Editor     = e.Creator;

            this.GroupSort    = e.GroupSort;
            this.UserName     = e.UserName;
            this.NickName     = e.NickName;
            this.Password     = e.Password;
            this.DepartmentId = e.DepartmentId;
        }
Example #7
0
        public ReadOnlyCollection<Group> Search([NotNull] string query, out int totalCount, uint? offset = null, uint? count = null, GroupSort sort = GroupSort.Normal, GroupType type = null, uint? countryId = null, uint? cityId = null, bool future = false)
        {
            VkErrors.ThrowIfNullOrEmpty(() => query);

            var parameters = new VkParameters
            {
                { "q", query },
                { "offset", offset },
                { "count", count },
                { "future", future },
                { "sort", sort },
                { "type", type },
                { "country_id", countryId },
                { "city_id", cityId }
            };

            VkResponseArray response = _vk.Call("groups.search", parameters);

            totalCount = response[0];

            return response.Skip(1).ToReadOnlyCollectionOf<Group>(r => r);
        }
Example #8
0
        public ReadOnlyCollection<Group> Search([NotNull] string query, out int totalCount, uint? offset = null, uint? count = null, GroupSort sort = GroupSort.Normal, GroupType type = null, uint? countryId = null, uint? cityId = null, bool future = false)
        {
            VkErrors.ThrowIfNullOrEmpty(() => query);

            var parameters = new GroupsSearchParams
            {
                Query = query,
                Sort = sort,
                Count = count,
                Offset = offset,
                Type = type,
                CityId = cityId,
                CountryId = countryId,
                Future = future
            };
            var result = Search(parameters);

            totalCount = Convert.ToInt32(result.TotalCount);

            return result.ToReadOnlyCollection();
        }
Example #9
0
 public virtual bool HasGroupSortings()
 {
     return(GroupSort != null && GroupSort.Any());
 }
Example #10
0
 /// <summary>
 /// 检查当前用户的操作权限
 /// </summary>
 private string CheckCurrentOperator(GroupSort targetSort)
 {
     return(CheckCurrentOperator(targetSort, this.Me));
 }
Example #11
0
        public ReadOnlyCollection <Group> Search([NotNull] string query, out int totalCount, uint?offset = null, uint?count = null, GroupSort sort = GroupSort.Normal, GroupType type = null, uint?countryId = null, uint?cityId = null, bool future = false)
        {
            VkErrors.ThrowIfNullOrEmpty(() => query);

            var parameters = new GroupsSearchParams
            {
                Query     = query,
                Sort      = sort,
                Count     = count,
                Offset    = offset,
                Type      = type,
                CityId    = cityId,
                CountryId = countryId,
                Future    = future
            };

            return(Search(out totalCount, parameters));
        }
Example #12
0
        /// <summary>
        /// 获取检索结果
        /// </summary>
        /// <param name="query">检索对象</param>
        /// <param name="usetime">检索用时</param>
        /// <param name="errmsg">错误信息</param>
        /// <returns>检索结果</returns>
        public static SearchResult SearchQuery(QuerySearchModel query, ref TimeSpan usetime, ref string errmsg)
        {
            ISeeClient      ISee           = new ISeeClient();
            ISeeIndexServer ISeeServerInfo = GetISeeServer(query.restype);

            if (ISeeServerInfo == null)
            {
                errmsg = "未获取到对应索引:" + query.restype;
                return(null);
            }
            ISee.Ip            = ISeeServerInfo.IP;
            ISee.Port          = ISeeServerInfo.Port;
            ISee.AutoFilterTag = false;// ISeeServerInfo.AutoFilterTag;
            ISee.MaxMatchCount = ISeeServerInfo.MaxMatchCount;
            ISee.SearchMode    = SearchMode.MatchExtended2;
            if (query.rows <= 0)
            {
                query.rows = ISeeServerInfo.MaxMatchCount;
            }

            SearchOptions option = new SearchOptions();

            option.Limit  = query.rows;
            option.Offset = (query.page - 1) * query.rows;
            option.Offset = option.Offset + ISee.Limit > ISeeServerInfo.MaxMatchCount ? (ISeeServerInfo.MaxMatchCount - ISee.Limit) : option.Offset;
            option.Index  = ISeeServerInfo.Index;
            FilterAttrs(query.queryExp, query.restype, ref option, out errmsg);
            if (!string.IsNullOrEmpty(errmsg))
            {
                return(null);
            }
            // 分组字段
            if (!string.IsNullOrEmpty(query.groupName))
            {
                option.GroupAttrName = query.groupName;
                option.ResultAttrs   = query.groupName;
                // 分组排序
                GroupSort groupSort = GroupSort.CountDesc;
                if (!string.IsNullOrEmpty(query.sortExp) && Enum.TryParse <GroupSort>(query.sortExp, out groupSort))
                {
                    option.GroupSort = groupSort;
                }
                else
                {
                    option.GroupSort = GroupSort.CountDesc; // 默认
                }
            }
            else
            {
                // 排序
                if (!string.IsNullOrEmpty(query.sortExp))
                {
                    option.SortExp = query.sortExp;
                }
                //查询词计数
                //if (!string.IsNullOrEmpty(option.KeyExp))
                //{
                //    if (query.isSearch)
                //    {
                //        string _errmsg;
                //        Regex regex = new Regex("[\u4e00-\u9fa5]+");
                //        Dictionary<string, int> keylist = new Dictionary<string, int>();
                //        foreach (Match match in regex.Matches(option.KeyExp))
                //        {
                //            if (match.Success && match.Groups.Count > 0 && !keylist.ContainsKey(match.Groups[0].Value))
                //                keylist.Add(match.Groups[0].Value, 0);
                //        }
                //        if (keylist.Count > 0)
                //        {
                //            string[] keyarr = new string[keylist.Count];
                //            int i = 0;
                //            foreach (string key in keylist.Keys)
                //            {
                //                keyarr[i] = key;
                //                i++;
                //            }
                //            DAL.SearchDAL.UpdateHotKeyData(keyarr, out _errmsg);
                //        }
                //    }
                //}
            }
            // 查询结果
            SearchResult results = ISee.Query(option);

            if (!string.IsNullOrEmpty(ISee.ErrMsg))
            {
                errmsg = ISee.ErrMsg;
                return(null);
            }
            if (!string.IsNullOrEmpty(results.Warnmsg))
            {
            }
            usetime = ISee.FoundTime;
            return(results);
        }
Example #13
0
        public ReadOnlyCollection <Group> Search([NotNull] string query, out int totalCount, uint?offset = null, uint?count = null, GroupSort sort = GroupSort.Normal, GroupType type = null, uint?countryId = null, uint?cityId = null, bool future = false)
        {
            VkErrors.ThrowIfNullOrEmpty(() => query);

            var parameters = new VkParameters
            {
                { "q", query },
                { "offset", offset },
                { "count", count },
                { "future", future },
                { "sort", sort },
                { "type", type },
                { "country_id", countryId },
                { "city_id", cityId }
            };

            VkResponseArray response = _vk.Call("groups.search", parameters);

            totalCount = response[0];

            return(response.Skip(1).ToReadOnlyCollectionOf <Group>(r => r));
        }
 public IEnumerable <ResourceModel> GetAllResource(GroupSort flag)
 {
     return(this.daoBuilder.Build().ToEasyXmlDao(new { GroupSort = (int)flag }).QueryForEnumerable <ResourceModel>("qryResourceRoot"));
 }