Ejemplo n.º 1
0
        void LoadACategory()
        {
            DataEntityQuery <Organization> query = new DataEntityQuery <Organization>();

            EAS.Controls.Window.ShowLoading("请求数据...");
            DataPortal <Organization> dp = new DataPortal <Organization>();

            dp.BeginExecuteQuery(query).Completed +=
                (s, e2) =>
            {
                EAS.Controls.Window.HideLoading();

                QueryTask <Organization> task = s as QueryTask <Organization>;
                if (task.Error != null)
                {
                    MessageBox.Show("请求数据时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK);
                    return;
                }
                else
                {
                    this.categoryList = task.Entities;
                    this.InitializeTree();
                }
            };
        }
Ejemplo n.º 2
0
        private void dataPager_PageChanged(object sender, RoutedEventArgs e)
        {
            this.btnTrack.IsEnabled = this.btnExecute.IsEnabled = false;
            if (this.vList == null)
            {
                return;
            }

            var v = this.vList.Skip(this.dataPager.Skip).Take(this.dataPager.Take);
            DataPortal <WFInstance> dataPortal = new DataPortal <WFInstance>();

            dataPortal.BeginExecuteQuery(v).Completed += (s, e2)
                                                         =>
            {
                QueryTask <WFInstance> task = s as QueryTask <WFInstance>;
                if (task.Error != null)
                {
                    MessageBox.Show("请求数据时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK);
                }
                else
                {
                    this.dgFlow.ItemsSource = task.Entities;
                }
            };
        }
Ejemplo n.º 3
0
        void GetPermissionList()
        {
            DataEntityQuery <ACL> query = new DataEntityQuery <ACL>();
            var v = from c in query
                    where c.PObject == this.Module.Guid
                    select c;

            DataPortal <ACL> dp = new DataPortal <ACL>();

            dp.BeginExecuteQuery(v).Completed +=
                (s, e2) =>
            {
                QueryTask <ACL> task = s as QueryTask <ACL>;
                if (task.Error != null)
                {
                    MessageBox.Show("读取模块权限时出错:" + task.Error.Message, "错误", MessageBoxButton.OK);
                    return;
                }
                else
                {
                    this.permissionList = task.Entities;
                    this.dataPermissions.ItemsSource = this.permissionList;
                    if (this.permissionList.Count > 0)
                    {
                        this.dataPermissions.SelectedItem = this.permissionList[0];
                    }
                }
            };
        }
Ejemplo n.º 4
0
        void LoadPermissionList()
        {
            this.permissionList = new List <ACLEx>();
            DataEntityQuery <ACL> query = new DataEntityQuery <ACL>();
            var v = from c in query
                    where c.Privileger == this.Role.Name
                    select c;

            DataPortal <ACL> dp = new DataPortal <ACL>();

            dp.BeginExecuteQuery(v).Completed +=
                (s, e2) =>
            {
                QueryTask <ACL> task = s as QueryTask <ACL>;
                if (task.Error != null)
                {
                    MessageBox.Show("读取权限数据时出错:" + task.Error.Message, "错误", MessageBoxButton.OK);
                    return;
                }
                else
                {
                    ModuleConverter.LoadAllPermission(this.dataPermissions, task.Entities, this.permissionList);
                }
            };
        }
Ejemplo n.º 5
0
        void LoadMemberList()
        {
            DataEntityQuery <AccountGrouping> query = new DataEntityQuery <AccountGrouping>();
            var v = from c in query
                    where c.RoleName == this.Role.Name
                    select c;

            DataPortal <AccountGrouping> dp = new DataPortal <AccountGrouping>();

            dp.BeginExecuteQuery(v).Completed +=
                (s, e2) =>
            {
                QueryTask <AccountGrouping> task = s as QueryTask <AccountGrouping>;
                if (task.Error != null)
                {
                    MessageBox.Show("读取成员数据时出错:" + task.Error.Message, "错误", MessageBoxButton.OK);
                    return;
                }
                else
                {
                    this.memberList = task.Entities;
                    this.dataMembers.ItemsSource = this.memberList;
                }
            };
        }
Ejemplo n.º 6
0
        void LoadGroupTree()
        {
            DataEntityQuery <NavigateGroup> query = new DataEntityQuery <NavigateGroup>();
            var v = from c in query
                    select c;

            EAS.Controls.Window.ShowLoading("请求数据...");
            DataPortal <NavigateGroup> dp = new DataPortal <NavigateGroup>();

            dp.BeginExecuteQuery(v).Completed +=
                (s, e2) =>
            {
                EAS.Controls.Window.HideLoading();

                QueryTask <NavigateGroup> task = s as QueryTask <NavigateGroup>;
                if (task.Error != null)
                {
                    MessageBox.Show("请求数据时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK);
                    return;
                }
                else
                {
                    this.groupList = task.Entities;
                    this.InitializeNavigationTree();
                }
            };
        }
Ejemplo n.º 7
0
        void GetPageList(int pIndex)
        {
            int index = pIndex;

            if (index < 1)
            {
                index = 1;
            }
            if (index > this.pager.PageCount)
            {
                index = this.pager.PageCount;
            }

            int skip = index * PageSize - PageSize;
            int take = this.iCount - skip;

            if (take > PageSize)
            {
                take = PageSize;
            }
            if (take == 0)
            {
                take = PageSize;
            }

            DataEntityQuery <Account> query = new DataEntityQuery <Account>();
            var v = from c in query
                    where c.OrganID == this.selectCategory.Guid
                    select c;
            var v2 = v.Skip(skip).Take(take);

            DataPortal <Account> dp = new DataPortal <Account>();

            dp.BeginExecuteQuery(v2).Completed +=
                (s, e2) =>
            {
                EAS.Controls.Window.HideLoading();

                QueryTask <Account> task = s as QueryTask <Account>;
                if (task.Error != null)
                {
                    MessageBox.Show("请求数据时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK);
                    return;
                }
                else
                {
                    this.accountList = task.Entities;
                    this.dataAccounts.ItemsSource = this.accountList;
                }
            };
        }
Ejemplo n.º 8
0
        void GetPageList(int pIndex)
        {
            int index = pIndex;

            if (index < 1)
            {
                index = 1;
            }
            if (index > this.pager.PageCount)
            {
                index = this.pager.PageCount;
            }

            int skip = index * PageSize - PageSize;
            int take = this.iCount - skip;

            if (take > PageSize)
            {
                take = PageSize;
            }
            if (take == 0)
            {
                take = PageSize;
            }

            DataEntityQuery <Role> query = new DataEntityQuery <Role>();
            var v = from c in query
                    where c.Name.StartsWith(this.tbSeach.Text) || c.Description.StartsWith(this.tbSeach.Text)
                    select c;
            var v2 = v.Skip(skip).Take(take);

            DataPortal <Role> dp = new DataPortal <Role>();

            dp.BeginExecuteQuery(v2).Completed +=
                (s, e2) =>
            {
                EAS.Controls.Window.HideLoading();

                QueryTask <Role> task = s as QueryTask <Role>;
                if (task.Error != null)
                {
                    MessageBox.Show("请求数据时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK);
                    return;
                }
                else
                {
                    roleList = task.Entities;
                    this.dataList.ItemsSource = roleList;
                }
            };
        }
Ejemplo n.º 9
0
        public void Seach(string key = "")
        {
            this.btnOK.IsEnabled = false;

            DataEntityQuery <WFDefine> query = new DataEntityQuery <WFDefine>();
            var v = from c in query
                    where (c.Name.StartsWith(key) || c.Module.StartsWith(key)) && c.IsPublish > 0 && c.IsEnable > 0
                    orderby c.FCTime descending
                    select new WFDefine
            {
                FlowID         = c.FlowID,
                Name           = c.Name,
                Version        = c.Version,
                Module         = c.Module,
                MType          = c.MType,
                SilverModule   = c.SilverModule,
                SilverMType    = c.SilverMType,
                Desctiption    = c.Desctiption,
                Creator        = c.Creator,
                FCTime         = c.FCTime,
                Modifier       = c.Modifier,
                LMTime         = c.LMTime,
                Publisher      = c.Publisher,
                PublishTime    = c.PublishTime,
                IsPublish      = c.IsPublish,
                StartTime      = c.StartTime,
                EndTime        = c.EndTime,
                InitialState   = c.InitialState,
                CompletedState = c.CompletedState
            };

            DataPortal <WFDefine> dataPortal = new DataPortal <WFDefine>();

            dataPortal.BeginExecuteQuery(v).Completed += (s, e) =>
            {
                QueryTask <WFDefine> task = s as QueryTask <WFDefine>;
                if (task.Error != null)
                {
                    MessageBox.Show("请求数据时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK);
                }
                else
                {
                    this.dgList.ItemsSource = task.Entities;
                }
            };
        }
Ejemplo n.º 10
0
        private void btnSearch_Click(object sender, RoutedEventArgs e)
        {
            this.tbSelected.Text = string.Empty;
            DataEntityQuery <Module> query = new DataEntityQuery <Module>();
            var v2 = from c in query
                     where c.Assembly.StartsWith(this.tbKey.Text) || c.Type.StartsWith(this.tbKey.Text)
                     select c;

            DataPortal <Module> dp = new DataPortal <Module>();

            dp.BeginExecuteQuery(v2).Completed +=
                (s, e2) =>
            {
                QueryTask <Module> task = s as QueryTask <Module>;

                if (task.Error != null)
                {
                    MessageBox.Show("查询角色时出错:" + task.Error.Message, "错误", MessageBoxButton.OK);
                    return;
                }
                else
                {
                    this.displayList = task.Entities.Where(p => (p.Attributes & this.SelectMask) == this.SelectMask).ToList();

                    for (int i = this.displayList.Count - 1; i >= 0; i--)
                    {
                        bool bFlag = (this.displayList[i].Attributes & this.SelectMask) == this.SelectMask;
                        if (!bFlag)
                        {
                            this.displayList.RemoveAt(i);
                        }
                    }

                    if (this.WfAddIn)
                    {
                        this.displayList = this.displayList.Where(p => p.WorkFlowAddIn).ToList();
                    }

                    this.dataList.ItemsSource = null;
                    this.dataList.ItemsSource = this.displayList;
                }
            };
        }
Ejemplo n.º 11
0
        void LoadRoles()
        {
            DataEntityQuery <Role> query = new DataEntityQuery <Role>();
            var v2 = from c in query
                     where c.Name.StartsWith(this.tbKey.Text)
                     select c;

            DataPortal <Role> dp = new DataPortal <Role>();

            dp.BeginExecuteQuery(v2).Completed +=
                (s, e2) =>
            {
                this.m_LoadRole = true;

                QueryTask <Role> task = s as QueryTask <Role>;

                if (task.Error != null)
                {
                    MessageBox.Show("查询角色时出错:" + task.Error.Message, "错误", MessageBoxButton.OK);
                    return;
                }
                else
                {
                    IList <Role> roleList = task.Entities;
                    foreach (Role item in roleList)
                    {
                        this.displayList.Add(new SelectedPrivileger {
                            Name = item.Name, Type = PrivilegerType.Role, Permissions = (int)Privileges.Execute, Tag = item
                        });
                    }

                    if ((this.cbAccount.IsChecked ?? false) && (!this.m_LoadAccount))
                    {
                        this.LoadAccounts();
                    }
                    else
                    {
                        this.dataList.ItemsSource = null;
                        this.dataList.ItemsSource = this.displayList;
                    }
                }
            };
        }
Ejemplo n.º 12
0
        void LoadWfExecuteList()
        {
            DataEntityQuery <WFExecute> query = new DataEntityQuery <WFExecute>();
            var v = from c in query
                    where c.InstanceID == this.m_InstanceID
                    orderby c.ExecuteTime
                    select c;

            DataPortal <WFExecute> dataPortal = new DataPortal <WFExecute>();

            dataPortal.BeginExecuteQuery(v).Completed += (s, e) =>
            {
                QueryTask <WFExecute> task = s as QueryTask <WFExecute>;
                if (task.Error != null)
                {
                    MessageBox.Show("请求数据时发生错误:" + task.Error.Message, "错误", MessageBoxButton.OK);
                }
                else
                {
                    this.dgList.ItemsSource = task.Entities;
                }
            };
        }
Ejemplo n.º 13
0
        void LoadAccounts()
        {
            DataEntityQuery <Account> query = new DataEntityQuery <Account>();
            var v = from c in query
                    where c.LoginID.StartsWith(this.tbKey.Text) || c.Name.StartsWith(this.tbKey.Text)
                    select c;

            DataPortal <Account> dp = new DataPortal <Account>();

            dp.BeginExecuteQuery(v).Completed +=
                (s, e2) =>
            {
                this.m_LoadAccount = true;

                QueryTask <Account> task = s as QueryTask <Account>;
                if (task.Error != null)
                {
                    MessageBox.Show("查询账号时出错:" + task.Error.Message, "错误", MessageBoxButton.OK);
                    return;
                }
                else
                {
                    ShowAccounts(task);

                    if ((this.cbRole.IsChecked ?? false) && (!this.m_LoadRole))
                    {
                        this.LoadRoles();
                    }
                    else
                    {
                        this.dataList.ItemsSource = null;
                        this.dataList.ItemsSource = this.displayList;
                    }
                }
            };
        }
Ejemplo n.º 14
0
        public static void LoadAllPermission(DataGrid dataGrid, IList <ACL> permissionList, IList <ACLEx> allPermissionList)
        {
            IList <string> sList = new List <string>(permissionList.Count);

            foreach (var item in permissionList)
            {
                sList.Add(item.PObject.ToUpper());
            }

#if DEBUG
            //MessageBox.Show("N:" + sList.Count.ToString());
#endif
            DataEntityQuery <Module> query = new DataEntityQuery <Module>();
            var v = from c in query
                    where sList.Contains(c.Guid)
                    select new EAS.Explorer.Entities.Module
            {
                Guid        = c.Guid,
                Name        = c.Name,
                Description = c.Description
            };

#if DEBUG
            //MessageBox.Show("2");
#endif

            DataPortal <Module> dp = new DataPortal <Module>();
            dp.BeginExecuteQuery(v).Completed +=
                (s, e2) =>
            {
                QueryTask <Module> task = s as QueryTask <Module>;
                if (task.Error != null)
                {
                    MessageBox.Show("读取模块数据时出错:" + task.Error.Message, "错误", MessageBoxButton.OK);
                    return;
                }
                else
                {
#if DEBUG
                    //MessageBox.Show("3:");
#endif

                    IList <Module> modules = task.Entities;

#if DEBUG
                    //MessageBox.Show("X2:" + modules.Count.ToString());
#endif

                    foreach (var item in permissionList)
                    {
                        ACLEx permission = new ACLEx();
                        permission.Changed    = item.Changed;
                        permission.PObject    = item.PObject;
                        permission.Privileger = item.Privileger;
                        permission.PType      = item.PType;
                        permission.PValue     = item.PValue;
                        permission.MInfo      = modules.Where(p => p.Guid.ToUpper() == item.PObject.ToUpper()).FirstOrDefault();
                        allPermissionList.Add(permission);
                    }

                    dataGrid.ItemsSource = allPermissionList;

#if DEBUG
                    //MessageBox.Show("4:");
#endif
                    if (allPermissionList.Count > 0)
                    {
                        dataGrid.SelectedItem = allPermissionList[0];
                    }
                }
            };
        }