Ejemplo n.º 1
0
 private void GetPermission()
 {
     AccountManager accMgr = new AccountManager();
     this.Permission = accMgr.GetUserPermission(this.CurrentUser.ID);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public Permission GetUserPermission(int userId)
        {
            Permission permission = new Permission();

            AnanEntities db = new AnanEntities();
            try
            {
                Admin_Super ad = (from auser in db.Admin_Super where auser.user_id == userId select auser).FirstOrDefault<Admin_Super>();
                if (ad != null)
                {
                    System.Reflection.FieldInfo[] fields = permission.GetType().GetFields();
                    if (fields != null)
                    {
                        foreach (System.Reflection.FieldInfo field in fields)
                        {
                            field.SetValue(permission, 1);
                        }
                    }
                }
                else
                {
                    //TBD
                }
            }
            catch
            {
            }
            finally
            {
                if (db != null)
                {
                    db.Dispose();
                }
            }

            return permission;
        }