PageRenderTime 17ms CodeModel.GetById 12ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 0ms

/EQT_V1/EQT.Model/UserContext.cs

http://sgsoft-las.googlecode.com/
C# | 201 lines | 134 code | 42 blank | 25 comment | 25 complexity | 9fb91bd441b7173ce99b7d80f157045f MD5 | raw file
Possible License(s): LGPL-2.1
  1using System;
  2using System.Data;
  3
  4
  5namespace EQT.Model
  6{
  7
  8
  9
 10    /// <summary>
 11    /// UserContext ?????
 12    /// </summary>
 13    public class UserContext
 14    {
 15        #region ??????
 16        public const string ROLE_ID_TESTER_GROUP = "TesterGroup";
 17        public const string ROLE_ID_TESTER_GROUP_DDL = "TesterGroup_DDL";
 18        public const string ROLE_ID_TESTER_GROUP_QDL = "TesterGroup_QDL";
 19        public const string ROLE_ID_REPORT_GROUP = "ReportGroup";
 20        public const string ROLE_ID_BUSINESS_GROUP = "BusinessGroup";
 21        public const string ROLE_ID_BACKSERVICE_GROUP = "BackServiceGroup";
 22        public const string ROLE_ID_ADMINISTRATORS = "Administrators";
 23        #endregion
 24
 25        public UserContext()
 26        {
 27        }
 28
 29        /// <summary>
 30        /// ?????
 31        /// </summary>
 32        private bool IsValidUser
 33        {
 34            get
 35            {
 36                return (tuser != null) && (userRole != null) && (trole != null);
 37            }
 38        }
 39
 40        /// <summary>
 41        /// ?????????
 42        /// </summary>
 43        private bool IsValidEmpUser
 44        {
 45            get
 46            {
 47                return IsValidUser && (emp != null) && (dept != null);
 48            }
 49        }
 50        #region ?????????????????
 51
 52        private MoTuser tuser;
 53        /// <summary>
 54        /// ??
 55        /// </summary>
 56        public MoTuser TUser
 57        {
 58            get { return tuser; }
 59            set { tuser = value; }
 60        }
 61
 62        private MoEmployee emp;
 63        /// <summary>
 64        /// ??
 65        /// </summary>
 66        public MoEmployee Emp
 67        {
 68            get { return emp; }
 69            set { emp = value; }
 70        }
 71
 72
 73        private MoDept dept;
 74        /// <summary>
 75        /// ??
 76        /// </summary>
 77        public MoDept Dept
 78        {
 79            get { return dept; }
 80            set { dept = value; }
 81        }
 82
 83        private MoUserRole userRole;
 84        /// <summary>
 85        /// ????
 86        /// </summary>
 87        public MoUserRole UserRole
 88        {
 89            get { return userRole; }
 90            set { userRole = value; }
 91        }
 92
 93        private MoTrole trole;
 94        /// <summary>
 95        /// ???????????????????
 96        /// </summary>
 97        public MoTrole TRole
 98        {
 99            get { return trole; }
100            set { trole = value; }
101        }
102
103
104
105        #endregion
106
107        #region ??
108        public string UserID
109        {
110            get 
111            {
112                if (tuser != null) return tuser.Uid;
113                return String.Empty;
114            }           
115        }
116
117      
118
119        public string UserName
120        {
121            get
122            {
123                if (tuser != null) return tuser.Display_Name;
124                return String.Empty;
125            }            
126        }
127
128       
129        public string RoleID
130        {
131            get 
132            {
133                if (userRole != null) return userRole.Role_Id;
134                return String.Empty; 
135            }
136           
137        }
138
139        
140        public string RoleName
141        {
142            get
143            {
144                if (trole != null) return trole.Role_Name;
145                return String.Empty;
146            }
147
148        }
149        #endregion
150
151        #region ????
152        public string EmpID
153        {
154            get 
155            {
156                if (emp != null) return emp.Emp_Id;
157                return String.Empty; 
158            
159            }
160           
161        }
162
163     
164        public string EmpName
165        {
166            get
167            {
168                if (emp != null) return emp.Fullname;
169                return String.Empty;
170            }
171           
172        }
173
174      
175        public string DeptID
176        {
177            get 
178            {
179                if (dept != null) return dept.Dept_Id;
180                return String.Empty;
181            
182            }
183            
184        }
185
186       
187        public string DeptName
188        {
189            get
190            {
191                if (dept != null) return dept.Dept_Name;
192                return String.Empty;
193            }
194
195        }
196        #endregion
197
198        //Note:????????????Cache
199
200    }
201}