Example #1
0
        /// <summary>
        /// 通过数据过滤规则获取用户。
        /// </summary>
        /// <param name="rol">数据过滤规则操作。</param>
        /// <param name="organization">待过滤的组织数据。</param>
        /// <param name="user">待过滤的用户数据。</param>
        /// <returns></returns>
        private UserList GetUserListByOperation(List <ResourceOperation> rol, User user, Organization organization)
        {
            UserList           userList       = new UserList();
            DataConstraintRule constraintRule = DataConstraintRule.All;

            if (null != rol)
            {
                foreach (var operation in rol)
                {
                    DataConstraintRule currentConstraintRule;
                    currentConstraintRule = System.Enum.TryParse(operation.OperationName, out currentConstraintRule) ? currentConstraintRule : DataConstraintRule.Own;
                    var value = constraintRule.CompareTo(currentConstraintRule);
                    if (value < 0)
                    {
                        constraintRule = currentConstraintRule;
                    }
                }
            }

            if (constraintRule == DataConstraintRule.Own)
            {
                userList.Add(user);
            }
            else if (constraintRule == DataConstraintRule.OwnCompany)
            {
                userList.AddRange(this.GetUserListByOwnCompanyRule(organization));
            }
            else if (constraintRule == DataConstraintRule.Lower)
            {
                userList.AddRange(this.GetUserListByLowerRule(organization));
            }

            return(userList);
        }
Example #2
0
        private void Refresh(bool rmodule, bool rmenu, bool rmenudtl, bool rrole, bool ruser)
        {
            if (rmodule)
            {
                ModuleList.Clear();
                ModuleList.AddRange(PubMaster.Mod.RoleSql.QueryWcsModuleList());
            }

            if (rmenu)
            {
                MenuList.Clear();
                MenuList.AddRange(PubMaster.Mod.RoleSql.QueryWcsMenuList());
            }

            if (rmenudtl)
            {
                MenuDtlList.Clear();
                MenuDtlList.AddRange(PubMaster.Mod.RoleSql.QueryWcsMenuDtlList());
            }

            if (rrole)
            {
                RoleList.Clear();
                RoleList.AddRange(PubMaster.Mod.RoleSql.QueryWcsRoleList());
            }

            if (ruser)
            {
                UserList.Clear();
                UserList.AddRange(PubMaster.Mod.RoleSql.QueryWcsUserList());
            }
        }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public UserList GetAllUser()
        {
            // Se obtienen los usuarios de las memberships
            UserList pUserList = new UserList();

            pUserList.AddRange(FwkMembership.GetAllUsers(_ProviderName));

            return(pUserList);
        }
Example #4
0
 public CorpPostTagUser(int tagId, IEnumerable <string> userList, IEnumerable <int> partyList)
     : this(tagId)
 {
     if (userList != null)
     {
         UserList.AddRange(userList);
     }
     if (partyList != null)
     {
         PartyList.AddRange(partyList);
     }
 }
Example #5
0
 private void Handle_TextChanged(object sender, Xamarin.Forms.TextChangedEventArgs e)
 {
     Loading.IsVisible = true;
     Loading.IsRunning = true;
     ListAllContact    = new List <UserList>();
     try
     {
         string      value = e.NewTextValue.ConvertToVN();
         List <User> users = ListUser.Where(x => !string.IsNullOrEmpty(x.Name) && x.Name.ToLower().ConvertToVN().Contains(value)).ToList();
         if (users != null)
         {
             users = users.OrderBy(x => x.Name).ToList();
             var lstUserEmpty = users.Where(x => x.Location == null);
             var lstAlphabet  = users.Where(x => x.Location != null).Select(y => y.Location).ToList();
             lstAlphabet = lstAlphabet.GroupBy(x => x.LocationId).Select(y => y.FirstOrDefault()).ToList();
             UserList userList = null;
             foreach (var item in lstAlphabet)
             {
                 userList = new UserList();
                 var heading = item;
                 var lstTemp = users.Where(x => x.Location != null && x.Location.LocationId == item.LocationId).ToList();
                 userList.Heading = heading.Name;
                 userList.AddRange(lstTemp);
                 ListAllContact.Add(userList);
             }
             userList         = new UserList();
             userList.Heading = "Unknow";
             ListAllContact.Add(userList);
             ItemsListView.ItemsSource = ListAllContact;
         }
         else
         {
             ItemsListView.ItemsSource = ListAllContact;
         }
     }
     catch (Exception ex)
     {
     }
     Loading.IsVisible = false;
     Loading.IsRunning = false;
     base.OnAppearing();
 }
Example #6
0
 async void OnUnAprovalClicked(object sender, SelectedItemChangedEventArgs args)
 {
     try
     {
         btnFilter.BackgroundColor     = Color.FromHex("#979392");
         btnUnApproval.BackgroundColor = Color.FromHex("#d8192f");
         ListAllContact = new List <UserList>();
         List <User> users = ListUser.Where(x => x.Status == CommonConstant.USER_DEACTIVE).ToList();
         if (users != null)
         {
             users = users.OrderBy(x => x.Name).ToList();
             var lstUserEmpty = users.Where(x => x.Location == null);
             var lstAlphabet  = users.Where(x => x.Location != null).Select(y => y.Location).ToList();
             lstAlphabet = lstAlphabet.GroupBy(x => x.LocationId).Select(y => y.FirstOrDefault()).ToList();
             UserList userList = null;
             foreach (var item in lstAlphabet)
             {
                 userList = new UserList();
                 var heading = item;
                 var lstTemp = users.Where(x => x.Location != null && x.Location.LocationId == item.LocationId).ToList();
                 userList.Heading = heading.Name;
                 userList.AddRange(lstTemp);
                 ListAllContact.Add(userList);
             }
             userList         = new UserList();
             userList.Heading = "Unknow";
             ListAllContact.Add(userList);
             ItemsListView.ItemsSource = ListAllContact;
         }
         else
         {
             ItemsListView.ItemsSource = ListAllContact;
         }
     }
     catch
     {
     }
 }
        public void TestInitialise()
        {
            this.roleList.Add(new Role { Id = "role-1" });
            this.roleList.Add(new Role { Id = "role-2" });
            this.roleList.Add(new Role { Id = "originator", SystemDefined = true, RoleName = "originator" });
            Dictionary<string, string> user1Roles = new Dictionary<string, string>
                                                    {
                    { "role-2", "role-2" }
                };
            Dictionary<string, string> user2Roles = new Dictionary<string, string>
                                                    {
                    { "role-2", "role-2" }
                };
            Dictionary<string, string> user3Roles = new Dictionary<string, string>
                                                    {
                    { "role-1", "role-1" }
                };

            this.userList.Add(new User { Id = "user-1", EmailAddress = "*****@*****.**", Roles = user1Roles });
            this.userList.Add(new User { Id = "user-2", EmailAddress = "*****@*****.**", Roles = user2Roles });
            this.userList.Add(new User { Id = "user-3", EmailAddress = "*****@*****.**", Roles = user3Roles });

            this.action = new EmailWorkflowTransitionAction
                          {
                AttachPdf = false,
                Condition = null,
                Content = "The email body goes here",
                Recipients = this.recipientList,
                Subject = "The subject line",
                EmailLinks = new List<string>()
            };
            this.application = new Application
                               {
                Id = "123456",
                FormId = "654321",
                ApplicationData = new ApplicationData()
            };

            this.systemSettings.Uris[SystemUriType.BaseSite] = "test.iapply.web";

            this.emptyPageList = new PageList
                                 {
                                     new UserPage
                                     {
                                         Controls = new ControlList()
                                     }
                                 };

            this.getUserFn = criteria =>
            {
                UserList users = new UserList();
                if (criteria.RoleIds != null)
                {
                    foreach (var role in criteria.RoleIds)
                    {
                        users.AddRange(this.userList.Where(u => u.HasRole(role)));
                    }
                }

                if (criteria.UserIds != null)
                {
                    foreach (var user in criteria.UserIds)
                    {
                        users.AddRange(this.userList.Where(u => u.Id == user));
                    }
                }

                return users;
            };
        }
Example #8
0
        protected override async void OnAppearing()
        {
            try
            {
                Loading.IsVisible             = true;
                Loading.IsRunning             = true;
                btnUnApproval.BackgroundColor = Color.FromHex("#979392");
                btnFilter.BackgroundColor     = Color.FromHex("#d8192f");
                ListAllContact = new List <UserList>();
                List <User> users      = new List <User>();
                RestClient  restClient = App.restClient;
                var         repository = App.Get <UserRepository>();
                if (App.IsConnectivity)
                {
                    #region Neu nhu co mang
                    users = await restClient.Get <List <User> >("users/all/locations/-1");

                    #endregion
                }
                else
                {
                    #region Neu nhu mat mang
                    var ListContact = repository.GetAll();
                    ListContact = ListContact.GroupBy(x => new { x.UserId, x.Name }).Select(y => y.FirstOrDefault()).ToList();
                    users       = ListContact.ConvertToListUser();
                    #endregion
                }
                if (users != null)
                {
                    //Danh sach nguoi dung ma ko ton tai tren db local
                    var ListContactOnline = users.Where(x => !App.UserLites.Select(y => y.UserId).Contains(x.UserId)).ToList();
                    if (ListContactOnline.Any())
                    {
                        await CreateContact(ListContactOnline, repository);
                    }
                    ListUser = users;
                    users    = users.Where(x => CommonConstant.USER_ACTIVE == x.Status).ToList();
                    users    = users.OrderBy(x => x.Name).ToList();
                    var lstUserEmpty = users.Where(x => x.Location == null);
                    var lstAlphabet  = users.Where(x => x.Location != null).Select(y => y.Location).ToList();
                    lstAlphabet = lstAlphabet.GroupBy(x => x.LocationId).Select(y => y.FirstOrDefault()).ToList();
                    UserList userList = null;
                    foreach (var item in lstAlphabet)
                    {
                        userList = new UserList();
                        var heading = item;
                        var lstTemp = users.Where(x => x.Location != null && x.Location.LocationId == item.LocationId).ToList();
                        userList.Heading = heading.Name;
                        userList.AddRange(lstTemp);
                        ListAllContact.Add(userList);
                    }
                    if (lstUserEmpty.Any())
                    {
                        userList         = new UserList();
                        userList.Heading = "Unknow";
                        userList.AddRange(lstUserEmpty);
                        ListAllContact.Add(userList);
                    }
                    ItemsListView.ItemsSource = ListAllContact;
                }
                else
                {
                    ItemsListView.ItemsSource = ListAllContact;
                }
            }
            catch
            {
            }
            Loading.IsVisible = false;
            Loading.IsRunning = false;
            base.OnAppearing();
        }
Example #9
0
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public UserList GetAllUser()
        {

            // Se obtienen los usuarios de las memberships
            UserList pUserList = new UserList();
            pUserList.AddRange(FwkMembership.GetAllUsers(_ProviderName));

            return pUserList;
        }
Example #10
0
 public void RefreshClients(Client[] clients)
 {
     UserList.Clear();
     UserList.AddRange(clients);
 }