Ejemplo n.º 1
0
        private void SaveData()
        {
            IModuleService service = ServiceContainer.GetService <IModuleService>();

            int[] selections = this.Grid2.SelectedRowIndexArray;
            try
            {
                foreach (int rowIndex in selections)
                {
                    var vType   = System.Type.GetType(string.Format("{0},{1}", this.Grid2.DataKeys[rowIndex][0].ToString(), this.Grid2.DataKeys[rowIndex][1].ToString()));
                    var vMethod = vType.GetMethod(this.Grid2.DataKeys[rowIndex][2].ToString());
                    var vM      = Attribute.GetCustomAttribute(vMethod, typeof(ServiceMethodAttribute)) as ServiceMethodAttribute;
                    var vModule = new EAS.Explorer.Entities.Module
                    {
                        Guid        = vM.Guid.ToUpper(),
                        Name        = vM.Name,
                        Description = vM.Description,
                        Type        = MetaHelper.GetTypeString(vType),
                        Assembly    = MetaHelper.GetAssemblyString(vType),
                        Method      = vMethod.Name,
                        Developer   = MetaHelper.GetDeveloperString(vType),
                        Version     = MetaHelper.GetVersionString(vType),
                        SortCode    = 0,
                        Attributes  = (int)EAS.Explorer.GoComType.Business,
                        LMTime      = DateTime.Now
                    };
                    service.InstallModule(vModule);
                }
            }
            catch (System.Exception exc)
            {
                Alert.Show(exc.Message, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        private void LoadModules()
        {
            string file = this.cbxFiles.SelectedValue;

            file = Path.Combine(Server.MapPath("~/bin/"), file);

            var assembly = Assembly.LoadFile(file);
            var types    = assembly.GetTypes().Where(p => p.IsPublic && this.GetBizCount(p) > 0).ToList();

            var vList = new List <EAS.Explorer.Entities.Module>();

            foreach (var item in types)
            {
                var xList = item.GetMethods().Where(x => Attribute.GetCustomAttribute(x, typeof(ServiceMethodAttribute)) != null)
                            .Select(p => new { Type = item, Method = p, M = Attribute.GetCustomAttribute(p, typeof(ServiceMethodAttribute)) as ServiceMethodAttribute })
                            .Select(p => new EAS.Explorer.Entities.Module
                {
                    Guid        = p.M.Guid.ToUpper(),
                    Name        = p.M.Name,
                    Description = p.M.Description,
                    Type        = MetaHelper.GetTypeString(p.Type),
                    Assembly    = MetaHelper.GetAssemblyString(p.Type),
                    Method      = p.Method.Name,
                    Developer   = MetaHelper.GetDeveloperString(p.Type),
                    Version     = MetaHelper.GetVersionString(p.Type),
                    SortCode    = 0,
                    LMTime      = DateTime.Now
                })
                            .ToList();

                vList.AddRange(xList);
            }

            string sortField     = this.Grid2.SortField;
            string sortDirection = this.Grid2.SortDirection;

            if (!string.IsNullOrEmpty(sortField))
            {
                vList = vList.AsQueryable().DynamicSorting(sortField, sortDirection).ToList();
            }

            this.Grid2.DataSource = vList;
            this.Grid2.DataBind();
        }
Ejemplo n.º 3
0
        private void LoadModules()
        {
            string file = this.cbxFiles.SelectedValue;

            file = Path.Combine(Server.MapPath("~/bin/"), file);

            var assembly = Assembly.LoadFile(file);
            var vList    = assembly.GetTypes()
                           .Where(p => Attribute.GetCustomAttribute(p, typeof(AddInAttribute)) != null)
                           .Select(p => new { Type = p, M = Attribute.GetCustomAttribute(p, typeof(AddInAttribute)) as AddInAttribute })
                           .Select(p => new EAS.Explorer.Entities.Module
            {
                Guid        = p.M.Guid.ToUpper(),
                Name        = p.M.Name,
                Description = p.M.Description,
                Type        = MetaHelper.GetTypeString(p.Type),
                Assembly    = MetaHelper.GetAssemblyString(p.Type),
                Method      = string.Empty,
                Developer   = MetaHelper.GetDeveloperString(p.Type),
                Version     = MetaHelper.GetVersionString(p.Type),
                SortCode    = 0,
                LMTime      = DateTime.Now
            })
                           .ToList();

            string sortField     = this.Grid2.SortField;
            string sortDirection = this.Grid2.SortDirection;

            if (!string.IsNullOrEmpty(sortField))
            {
                vList = vList.AsQueryable().DynamicSorting(sortField, sortDirection).ToList();
            }

            this.Grid2.DataSource = vList;
            this.Grid2.DataBind();
        }
Ejemplo n.º 4
0
        void InitializeNavigationDebug()
        {
            //=======================================================

            Assembly assembly = EAS.Objects.ClassProvider.GetAssembly(SLContext.Instance.Assembly);

            System.Type[] types = assembly.GetTypes();

            List <NavigateModule> moduleList = new List <NavigateModule>();
            List <NavigateGroup>  groupList  = new List <NavigateGroup>();

            #region 提取模块

            foreach (System.Type type in types)
            {
                AddInAttribute ma = Attribute.GetCustomAttribute(type, typeof(AddInAttribute)) as AddInAttribute;
                if (!Object.Equals(null, ma))
                {
                    NavigateModule dataEntity = new NavigateModule();
                    dataEntity.Guid        = ma.Guid;
                    dataEntity.Name        = ma.Name;
                    dataEntity.Description = ma.Description;
                    dataEntity.Assembly    = MetaHelper.GetAssemblyString(type);
                    dataEntity.Type        = MetaHelper.GetTypeString(type);
                    dataEntity.Version     = MetaHelper.GetVersionString(type);
                    dataEntity.Developer   = MetaHelper.GetDeveloperString(type);
                    moduleList.Add(dataEntity);
                }
            }

            foreach (NavigateModule item in moduleList)
            {
                if (item.GroupName == null)
                {
                    item.GroupName = string.Empty;
                }

                if (item.GroupName.Length == 0)
                {
                    item.GroupName = "调试模块";
                }

                NavigateGroup GX = groupList.Where(p => p.Name == item.GroupName).FirstOrDefault();

                if (GX != null)
                {
                    item.GroupID = GX.ID;
                }
                else
                {
                    GX            = new NavigateGroup();
                    GX.ParentID   = Guid.Empty.ToString().ToUpper();
                    GX.ID         = Guid.NewGuid().ToString().ToUpper();
                    GX.Name       = item.GroupName;
                    GX.Attributes = 0xffff;
                    groupList.Add(GX);
                    item.GroupID = GX.ID;
                }
            }

            #endregion

            (this.m_Menu as INavigation).Initialize(groupList, moduleList);
        }