示例#1
0
        /// <summary>
        /// Get list of controls which appropriate to multilanguage.
        /// </summary>
        /// <returns></returns>
        public Map <string, ScreenDetail> GetControlList()
        {
            if (MapControlCache == null)
            {
                m_mapControlCache = new Map <string, ScreenDetail>();
            }
            else
            {
                return(MapControlCache);
            }

            // Store own form.
            ScreenDetail screenDetail = new ScreenDetail();

            screenDetail.ObjOwner = this;
            screenDetail.Text     = ScreenAttribute.GetScreenAttribute(this.GetType()).ScreenDescription;
            screenDetail.Name     = this.Name;
            screenDetail.Type     = ScreenDetail.TYPE_FORM;
            m_mapControlCache.Put(this.Name, screenDetail);

            // Store recursive child controls.
            for (int i = 0; i < this.Controls.Count; i++)
            {
                RetrieveControls(MapControlCache, this.Controls[i]);
            }
            return(MapControlCache);
        }
示例#2
0
        protected void InitialPermissionValue()
        {
            if (Common.CurrentUserInfomation == null)
            {
                return;
            }
            UserPermission.View   = PermissionValue.ePermission.No;
            UserPermission.Add    = PermissionValue.ePermission.No;
            UserPermission.Edit   = PermissionValue.ePermission.No;
            UserPermission.Delete = PermissionValue.ePermission.No;

            GroupPermission.View   = PermissionValue.ePermission.No;
            GroupPermission.Add    = PermissionValue.ePermission.No;
            GroupPermission.Edit   = PermissionValue.ePermission.No;
            GroupPermission.Delete = PermissionValue.ePermission.No;



            #region Get Permission value from database
            AuthorizedMaintenanceController authorizedMntCtrl = new AuthorizedMaintenanceController();

            EVOFramework.Windows.Forms.ScreenAttribute screenAttribute = EVOFramework.Windows.Forms.ScreenAttribute.GetScreenAttribute(this.GetType());

            if (screenAttribute != null)
            {
                DataTable dtUser = authorizedMntCtrl.LoadUserPermissionJoinScreen(screenAttribute.ScreenCD);
                // Check User Permission First
                if (dtUser != null)
                {
                    DataRow[] dr = dtUser.Select(String.Format("USER_CD = '{0}'", Common.CurrentUserInfomation.UserCD.StrongValue));

                    if (dr.Length != 0)
                    {
                        UserPermission.View = (PermissionValue.ePermission)Enum.Parse(typeof(PermissionValue.ePermission), dr[0][(int)PermissionValue.eUserPermission.FLG_VIEW].ToString());

                        UserPermission.Add = (PermissionValue.ePermission)Enum.Parse(typeof(PermissionValue.ePermission), dr[0][(int)PermissionValue.eUserPermission.FLG_ADD].ToString());

                        UserPermission.Edit = (PermissionValue.ePermission)Enum.Parse(typeof(PermissionValue.ePermission), dr[0][(int)PermissionValue.eUserPermission.FLG_CHG].ToString());

                        UserPermission.Delete = (PermissionValue.ePermission)Enum.Parse(typeof(PermissionValue.ePermission), dr[0][(int)PermissionValue.eUserPermission.FLG_DEL].ToString());

                        //if (dr[0][PermissionValue.eUserPermission.FLG_VIEW.ToString()].ToString() == "1")
                        //    UserPermission.View = PermissionValue.ePermission.Yes;

                        //if (dr[0][PermissionValue.eUserPermission.FLG_ADD.ToString()].ToString() == "1")
                        //    UserPermission.Add = PermissionValue.ePermission.Yes;

                        //if (dr[0][PermissionValue.eUserPermission.FLG_CHG.ToString()].ToString() == "1")
                        //    UserPermission.Edit = PermissionValue.ePermission.Yes;

                        //if (dr[0][PermissionValue.eUserPermission.FLG_DEL.ToString()].ToString() == "1")
                        //    UserPermission.Delete = PermissionValue.ePermission.Yes;

                        //if (dr[0][PermissionValue.eUserPermission.FLG_VIEW.ToString()].ToString() == "0")
                        //    UserPermission.View = PermissionValue.ePermission.No;

                        //if (dr[0][PermissionValue.eUserPermission.FLG_ADD.ToString()].ToString() == "0")
                        //    UserPermission.Add = PermissionValue.ePermission.No;

                        //if (dr[0][PermissionValue.eUserPermission.FLG_CHG.ToString()].ToString() == "0")
                        //    UserPermission.Edit = PermissionValue.ePermission.No;

                        //if (dr[0][PermissionValue.eUserPermission.FLG_DEL.ToString()].ToString() == "0")
                        //    UserPermission.Delete = PermissionValue.ePermission.No;

                        //if (dr[0][PermissionValue.eUserPermission.FLG_VIEW.ToString()].ToString() == "-1")
                        //    UserPermission.View = PermissionValue.ePermission.UpToGroup;

                        //if (dr[0][PermissionValue.eUserPermission.FLG_ADD.ToString()].ToString() == "-1")
                        //    UserPermission.Add = PermissionValue.ePermission.UpToGroup;

                        //if (dr[0][PermissionValue.eUserPermission.FLG_CHG.ToString()].ToString() == "-1")
                        //    UserPermission.Edit = PermissionValue.ePermission.UpToGroup;

                        //if (dr[0][PermissionValue.eUserPermission.FLG_DEL.ToString()].ToString() == "-1")
                        //    UserPermission.Delete = PermissionValue.ePermission.UpToGroup;
                    }
                }

                // Check Group Permission
                DataTable dtGroup = authorizedMntCtrl.LoadGroupPermissionJoinScreen(screenAttribute.ScreenCD);

                if (dtGroup != null)
                {
                    DataRow[] dr = dtGroup.Select(String.Format("GROUP_CD = '{0}'", Common.CurrentUserInfomation.GroupCode.StrongValue));

                    GroupPermission.View = (PermissionValue.ePermission)Enum.Parse(typeof(PermissionValue.ePermission), dr[0][(int)PermissionValue.eUserPermission.FLG_VIEW].ToString());

                    GroupPermission.Add = (PermissionValue.ePermission)Enum.Parse(typeof(PermissionValue.ePermission), dr[0][(int)PermissionValue.eUserPermission.FLG_ADD].ToString());

                    GroupPermission.Edit = (PermissionValue.ePermission)Enum.Parse(typeof(PermissionValue.ePermission), dr[0][(int)PermissionValue.eUserPermission.FLG_CHG].ToString());

                    GroupPermission.Delete = (PermissionValue.ePermission)Enum.Parse(typeof(PermissionValue.ePermission), dr[0][(int)PermissionValue.eUserPermission.FLG_DEL].ToString());


                    //if (dr[0][PermissionValue.eGroupPermission.FLG_VIEW.ToString()].ToString() == "1")
                    //    GroupPermission.View = PermissionValue.ePermission.Yes;

                    //if (dr[0][PermissionValue.eGroupPermission.FLG_ADD.ToString()].ToString() == "1")
                    //    GroupPermission.Add = PermissionValue.ePermission.Yes;

                    //if (dr[0][PermissionValue.eGroupPermission.FLG_CHG.ToString()].ToString() == "1")
                    //    GroupPermission.Edit = PermissionValue.ePermission.Yes;

                    //if (dr[0][PermissionValue.eGroupPermission.FLG_DEL.ToString()].ToString() == "1")
                    //    GroupPermission.Delete = PermissionValue.ePermission.Yes;

                    //if (dr[0][PermissionValue.eGroupPermission.FLG_VIEW.ToString()].ToString() == "0")
                    //    GroupPermission.View = PermissionValue.ePermission.No;

                    //if (dr[0][PermissionValue.eGroupPermission.FLG_ADD.ToString()].ToString() == "0")
                    //    GroupPermission.Add = PermissionValue.ePermission.No;

                    //if (dr[0][PermissionValue.eGroupPermission.FLG_CHG.ToString()].ToString() == "0")
                    //    GroupPermission.Edit = PermissionValue.ePermission.No;

                    //if (dr[0][PermissionValue.eGroupPermission.FLG_DEL.ToString()].ToString() == "0")
                    //    GroupPermission.Delete = PermissionValue.ePermission.No;
                }
            }
            #endregion

            #region Set Active Permission Value
            ActivePermission.View   = GetActivePermission(GroupPermission.View, UserPermission.View);
            ActivePermission.Add    = GetActivePermission(GroupPermission.Add, UserPermission.Add);
            ActivePermission.Edit   = GetActivePermission(GroupPermission.Edit, UserPermission.Edit);
            ActivePermission.Delete = GetActivePermission(GroupPermission.Delete, UserPermission.Delete);
            #endregion
        }