RoadFlow2.7.5 MyController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc; namespace WebMvc
{
public class MyController : Controller
{
/// <summary>
/// Action执行前判断
/// </summary>
/// <param name="filterContext"></param>
protected override void OnActionExecuting(ActionExecutingContext filterContext)
{
base.OnActionExecuting(filterContext);
var myAttribute = filterContext.ActionDescriptor.GetCustomAttributes(typeof(MyAttributeAttribute), false);
bool isCheckLogin = true;
bool isCheckApp = true;
bool isCheckUrl = true;
if (myAttribute.Length == )
{
MyAttributeAttribute myAttr = (MyAttributeAttribute)myAttribute[];
isCheckLogin = myAttr.CheckLogin;
isCheckApp = myAttr.CheckApp;
isCheckUrl = myAttr.CheckUrl;
}
if (isCheckUrl)
{
if (!Common.Tools.CheckReferrer(false))
{
filterContext.Result = Content("地址验证错误");
return;
}
}
if (isCheckLogin)
{
string msg;
if (!this.CheckLogin(out msg))
{
if (filterContext.HttpContext.Request.IsAjaxRequest())
{
filterContext.Result = Content("{\"loginstatus\":-1, \"url\":\"\"}");
}
else
{
string lastURL = System.Web.HttpContext.Current.Request.Url.PathAndQuery.UrlEncode();
filterContext.Result = Content(string.Concat("<script>",
msg.IsNullOrEmpty() ? "" : string.Format("alert('{0}');", msg),
string.Compare(filterContext.Controller.ToString(), "WebMvc.Controllers.HomeController", true) == ? "top.location='" + Url.Content("~/Login") + "'" : "top.lastURL='" + lastURL + "';top.currentWindow=window;top.login();", "</script>"), "text/html");
}
return;
}
}
if (isCheckApp)
{
string appMsg;
if (!Common.Tools.CheckApp(out appMsg))
{
filterContext.Result = Content("权限验证错误");
return;
}
}
} /// <summary>
/// 验证登录
/// </summary>
/// <param name="msg"></param>
/// <returns></returns>
protected virtual bool CheckLogin(out string msg)
{
return WebMvc.Common.Tools.CheckLogin(out msg);
} /// <summary>
/// 当前登录用户ID
/// </summary>
public static Guid CurrentUserID
{
get
{
return RoadFlow.Platform.Users.CurrentUserID;
}
} /// <summary>
/// 当前用户
/// </summary>
public static RoadFlow.Data.Model.Users CurrentUser
{
get
{
return RoadFlow.Platform.Users.CurrentUser;
}
} /// <summary>
/// 当前用户姓名
/// </summary>
public static string CurrentUserName
{
get
{
return RoadFlow.Platform.Users.CurrentUserName;
}
} /// <summary>
/// 当前用户部门
/// </summary>
public static RoadFlow.Data.Model.Organize CurrentUserDept
{
get
{
return RoadFlow.Platform.Users.CurrentDept;
}
} /// <summary>
/// 当前用户部门ID
/// </summary>
public static Guid CurrentUserDeptID
{
get
{
return RoadFlow.Platform.Users.CurrentDeptID;
}
} /// <summary>
/// 当前用户部门名称
/// </summary>
public static string CurrentUserDeptName
{
get
{
return RoadFlow.Platform.Users.CurrentDeptName;
}
} /// <summary>
/// 当前用户单位
/// </summary>
public static RoadFlow.Data.Model.Organize CurrentUserUnit
{
get
{
return RoadFlow.Platform.Users.CurrentUnit;
}
} /// <summary>
/// 当前用户单位ID
/// </summary>
public static Guid CurrentUserUnitID
{
get
{
return RoadFlow.Platform.Users.CurrentUnitID;
}
} /// <summary>
/// 当前用户单位名称
/// </summary>
public static string CurrentUserUnitName
{
get
{
return RoadFlow.Platform.Users.CurrentUnitName;
}
} /// <summary>
/// 当前日期时间
/// </summary>
public static DateTime CurrentDateTime
{
get
{
return RoadFlow.Utility.DateTimeNew.Now;
}
}
}
}
RoadFlow2.7.5 MyController.cs的更多相关文章
- ngx-admin with Asp.net Core 2.0, possibly plus OrchardCore
1 Download ngx-admin from https://github.com/akveo/ngx-admin 2 Create a new Web Application in vs201 ...
- 【.NetCore学习】ubuntu16.04 搭建.net core mvc api 运行环境
查看linux内核版本 uname -a 打印结果 python@ubuntu:~$ uname -a Linux ubuntu 4.4.0-31-generic #50-Ubuntu SMP Wed ...
- [C#] 剖析 AssemblyInfo.cs - 了解常用的特性 Attribute
剖析 AssemblyInfo.cs - 了解常用的特性 Attribute [博主]反骨仔 [原文]http://www.cnblogs.com/liqingwen/p/5944391.html 序 ...
- Atitit 软件架构方法的进化与演进cs bs soa roa msa attilax总结
Atitit 软件架构方法的进化与演进cs bs soa roa msa attilax总结 1.1. 软件体系架构是沿着单机到 CS 架构,再到 BS 的三层架构甚至多层架构逐步发展过来的,关于 ...
- 从java文件和CS文件里查询方法使用次数工具
前几天,领导让我找一下老系统(Java)里getRemoteUser方法都哪个文件用了,package是什么,方法被调用了多少次,当时因为着急,所以,直接人工找的,但是以后要是再出现,人工找就太讨厌了 ...
- 关于 WP 开发中.xaml 与.xaml.cs 的关系
今天我们先来看一下在WP8.1开发中最长见到的几个文件之间的关系.比较论证,在看这个问题之前我们简单看看.NET平台其他两个不同的框架: Windows Forms 先看看Window Forms中的 ...
- .net 用户控件ascx.cs注册js脚本代码无效果
在.net web项目中碰到一个比较奇怪的问题,网上没找到解决方案,先自己mark一下 问题描述: 添加一个用户控件ascx,在后端.cs添加js注册脚本,执行后没有弹出框 注册脚本为: this.P ...
- DateHelper.cs日期时间操作辅助类C#
//==================================================================== //** Copyright © classbao.com ...
- 仅用aspx文件实现Ajax调用后台cs程序。(实例)
仅用aspx文件实现Ajax调用后台cs无刷新程序.(实例) 两个文件:aaa.aspx 和aaa.aspx.cs 一.aaa.aspx <script type="text/java ...
随机推荐
- Delphi GDI+ 安装方法
[转]Delphi GDI+ 安装方法转自:万一博客(http://www.cnblogs.com/del/)GDI+ 是 Windows 的一个函数库, 来自 Windows\System32\GD ...
- C#调用Mail发送QQ邮件
需要用到: 1.System.Net.Mail; 2.QQ邮箱的POP3/SMTP服务码 QQ邮箱的POP3/SMTP服务码获取方法: 1.打开qq邮箱: 2.进入设置页面-->账户:(往下翻) ...
- 关于linux redhat及免费的问题
我想下载一个redhat的免费版,这个免费版是不是就不叫redhat了? 是Fedora吗? 不要推荐 红旗 以及其它的版本了,谢谢!!! 007struggle | 浏览 12141 次 发布于20 ...
- chromedriver安装(谷歌浏览器驱动安装)
如果程序执行错误,浏览器没有打开,那么应该是没有装 Chrome 浏览器或者 Chrome 驱动没有配置在环境变量里.下载驱动,然后将驱动文件路径配置在环境变量即可. chromedriver下载地址 ...
- require.js实现单页web应用(SPA)
本文转载自:https://blog.csdn.net/qq_33401924/article/details/53815922 移动端单页应用基本上是做移动端最流行的的方式了,但是对于很多前端来说, ...
- VC++ 2010 创建高级Ribbon界面详解(2)
Ribbon 控件的使用 1.命令按钮 命令按钮可以说是我们最常用的Ribbon控件了,我们通常都是通过命令按钮来发送某个命令,执行某个动作.它代替了过去的菜单命令,成为使用最频繁的Ribbon控件. ...
- jenkins+jhipster集成
准备工作: 安装Jenkins 新建一个Jhipster项目 开始集成: 新建一个Jenkins构建项目 只配置源代码 构建,成功,稍微有点信心了 配置执行构建脚本 ./mvnw package -P ...
- mariadb入门
MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可.开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方 ...
- hdu6396 /// fread()快速读入挂
题目大意: 给定n k 给定主角具有的k种属性 给定n个怪兽具有的k种属性和打死该怪兽后能得到的k种属性对应增幅 求主角最多能打死多少怪兽和最终主角的k种属性 k最大为5 开5个优先队列贪心 快速读入 ...
- ASP.NET 中 ContentType 类型
在ASP.NET中使用Response.ContentType="类型名";来确定输出格式 不同的ContentType 会影响客户端所看到的效果.默认的ContentType为 ...