/// <summary> /// 是否当前流程实例活动的潜在代理者 /// </summary> /// <param name="wii"></param> /// <returns></returns> public bool IsEffectiveByProxyUser() { var wfps = this.GetContext().Store.GetProxyWorkflows(this.GetWorkflow().Guid); IUserComparer _uc = new IUserComparer(); if (wfps == null) { return(false); } return(wfps.Any((wfp) => { return wfp.BeginTime <= DateTime.Now && wfp.EndTime >= DateTime.Now && wfp.State == true && _uc.Equals(wfp.Owner, this.User) && _uc.Equals(wfp.ProxyUser, this.GetContext().CurUser); })); }
public bool Compare(IUserComparer userComparer, object first, object second) { if ((first == null && second != null) || (first != null && second == null)) { return(false); } else if (first != null && second != null) { IEnumerable <object> enumerableFirst, enumerableSecond; enumerableFirst = ((IEnumerable)first).Cast <object>(); enumerableSecond = ((IEnumerable)second).Cast <object>(); if (enumerableFirst.Count() != enumerableSecond.Count()) { return(false); } else { int count = enumerableFirst.Count(); object itemFirst, itemSecond; Type itemType; for (int index = 0; index < count; index++) { itemFirst = enumerableFirst.ElementAt(index); itemSecond = enumerableSecond.ElementAt(index); itemType = itemFirst.GetType(); if (ReflectionGuard.IsPrimitiveType(itemType)) { if (!_primitiveComparer.Compare(itemFirst, itemSecond)) { return(false); } } else if (!userComparer.Compare(itemFirst, itemSecond)) { return(false); } } } } return(true); }
/// <summary> /// 是否当前流程实例活动的潜在代理者 /// </summary> /// <param name="wii"></param> /// <returns></returns> public bool IsEffectiveByProxyUser() { var wfps = this.GetContext().Store.GetProxyWorkflows(this.GetWorkflow().Guid); IUserComparer _uc = new IUserComparer(); if (wfps == null) { return false; } return wfps.Any((wfp) => { return wfp.BeginTime <= DateTime.Now && wfp.EndTime >= DateTime.Now && wfp.State == true && _uc.Equals(wfp.Owner, this.User) && _uc.Equals(wfp.ProxyUser, this.GetContext().CurUser); }); }