Example #1
0
        //Initializations

        #region 加载 —— void Load(InfoSystemInfo infoSystem)
        /// <summary>
        /// 加载
        /// </summary>
        /// <param name="infoSystem">信息系统</param>
        public void Load(InfoSystemInfo infoSystem)
        {
            this.InfoSystemNo = infoSystem.Number;
            this.Host         = infoSystem.Host;
            this.Port         = infoSystem.Port;
            this.Index        = infoSystem.Index;
        }
Example #2
0
        /// <summary>
        /// 初始化事件
        /// </summary>
        private async void Btn_Init_Click(object sender, EventArgs eventArgs)
        {
            #region # 验证

            if (string.IsNullOrWhiteSpace(this.Txt_FilePath.Text))
            {
                MessageBox.Show(@"文件路径不可为空!", @"Warning");
                return;
            }
            if (this.Cbx_InfoSystems.SelectedItem == null)
            {
                MessageBox.Show(@"信息系统不可为空!", @"Warning");
                return;
            }
            if (this.Cbx_ApplicationTypes.SelectedItem == null)
            {
                MessageBox.Show(@"应用程序类型不可为空!", @"Warning");
                return;
            }

            #endregion

            string         assemblyPath       = this.Txt_FilePath.Text;
            InfoSystemInfo selectedSystemItem = (InfoSystemInfo)this.Cbx_InfoSystems.SelectedItem;
            KeyValuePair <string, string> selectedApplicationTypeItem = (KeyValuePair <string, string>) this.Cbx_ApplicationTypes.SelectedItem;
            string          infoSystemNo    = selectedSystemItem.Number;
            ApplicationType applicationType = (ApplicationType)Enum.Parse(typeof(ApplicationType), selectedApplicationTypeItem.Key);

            await this.InitAuthorities(assemblyPath, infoSystemNo, applicationType);

            MessageBox.Show(@"OK", @"OK");
        }
        //查询部分

        #region # 获取信息系统 —— InfoSystemInfo GetInfoSystem(string infoSystemNo)
        /// <summary>
        /// 获取信息系统
        /// </summary>
        /// <param name="infoSystemNo">信息系统编号</param>
        /// <returns>信息系统</returns>
        public InfoSystemInfo GetInfoSystem(string infoSystemNo)
        {
            InfoSystem     infoSystem     = this._repMediator.InfoSystemRep.Single(infoSystemNo);
            InfoSystemInfo infoSystemInfo = infoSystem.ToDTO();

            return(infoSystemInfo);
        }
Example #4
0
        /// <summary>
        /// 信息系统视图模型映射
        /// </summary>
        /// <param name="systemInfo">信息系统数据传输对象</param>
        /// <returns>信息系统视图模型</returns>
        public static InfoSystemView ToViewModel(this InfoSystemInfo systemInfo)
        {
            InfoSystemView systemView = Transform <InfoSystemInfo, InfoSystemView> .Map(systemInfo);

            systemView.ApplicationTypeName = systemInfo.ApplicationType.GetEnumMember();

            return(systemView);
        }
        /// <summary>
        /// 获取信息系统的权限树
        /// </summary>
        /// <param name="infoSystemNo">信息系统编号</param>
        /// <param name="applicationType">应用程序类型</param>
        /// <returns>权限树</returns>
        public Node GetAuthorityTree(string infoSystemNo, ApplicationType?applicationType)
        {
            InfoSystemInfo          infoSystemInfo = this._authorizationContract.GetInfoSystem(infoSystemNo);
            IEnumerable <Authority> authorities    = this.GetAuthoritiesByInfoSystem(infoSystemNo, applicationType);
            Node node = infoSystemInfo.ToModel().ToNode(authorities);

            return(node);
        }
        /// <summary>
        /// 获取信息系统的权限树
        /// </summary>
        /// <param name="systemNo">信息系统编号</param>
        /// <returns>权限树</returns>
        public Node GetAuthorityTree(string systemNo)
        {
            InfoSystemInfo system = this._authorizationContract.GetInfoSystem(systemNo);
            IEnumerable <AuthorityView> authorities = this.GetAuthoritiesBySystem(systemNo);
            Node node = system.ToViewModel().ToNode(authorities);

            return(node);
        }
        /// <summary>
        /// 信息系统模型映射
        /// </summary>
        public static InfoSystem ToModel(this InfoSystemInfo infoSystemInfo)
        {
            InfoSystem infoSystem = infoSystemInfo.Map <InfoSystemInfo, InfoSystem>();

            infoSystem.ApplicationTypeName = infoSystemInfo.ApplicationType.GetEnumMember();

            return(infoSystem);
        }
        /// <summary>
        /// 获取信息系统
        /// </summary>
        /// <param name="systemNo">信息系统编号</param>
        /// <returns>信息系统</returns>
        public InfoSystemView GetInfoSystem(string systemNo)
        {
            InfoSystemInfo systemInfo = this._authorizationContract.GetInfoSystem(systemNo);

            return(systemInfo.ToViewModel());
        }
        /// <summary>
        /// 获取信息系统
        /// </summary>
        /// <param name="infoSystemNo">信息系统编号</param>
        /// <returns>信息系统</returns>
        public InfoSystem GetInfoSystem(string infoSystemNo)
        {
            InfoSystemInfo infoSystemInfo = this._authorizationContract.GetInfoSystem(infoSystemNo);

            return(infoSystemInfo.ToModel());
        }
        /// <summary>
        /// 信息系统映射
        /// </summary>
        /// <param name="infoSystem">信息系统领域模型</param>
        /// <returns>信息系统数据传输对象</returns>
        public static InfoSystemInfo ToDTO(this InfoSystem infoSystem)
        {
            InfoSystemInfo systemInfo = Transform <InfoSystem, InfoSystemInfo> .Map(infoSystem);

            return(systemInfo);
        }
Example #11
0
        //Initializations

        #region 加载 —— void Load(InfoSystemInfo infoSystem)
        /// <summary>
        /// 加载
        /// </summary>
        /// <param name="infoSystem">信息系统</param>
        public void Load(InfoSystemInfo infoSystem)
        {
            this.InfoSystemNo   = infoSystem.Number;
            this.InfoSystemName = infoSystem.Name;
        }
        /// <summary>
        /// 信息系统映射
        /// </summary>
        public static InfoSystemInfo ToDTO(this InfoSystem infoSystem)
        {
            InfoSystemInfo infoSystemInfo = infoSystem.Map <InfoSystem, InfoSystemInfo>();

            return(infoSystemInfo);
        }