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 ...
随机推荐
- webpack最基本的用法
webpack 安装 webpack是所以Node.js开发的工具,可通过npm安装,首先要保证node已经安装完毕,可以去node官网下载, 然后通过npm下载webpack npm install ...
- 1245. Tree Diameter
解题思路:本题是一道图的题目,但是无向图,给定的输入是图的各个边,题目中给出一个关键信息(Each node has labels in the set {0, 1, ..., edges.lengt ...
- mysql查询相关的命令解析
特:不重启mysql 更新配置文件方法(不允许重启mysql实例或连接不上msyql服务器): gdb -p $(pidof mysqld) -ex "set max_connections ...
- 卿烨科技 Fireball
9人开发病毒感染超2亿电脑!Fireball病毒境外做案被举报 原标题:名校毕业生研发病毒年获利8000万 2.5亿台电脑感染 海淀网友协助民警追踪跨境黑客 高材生开公司研发病毒 一年获利8000 ...
- I/O复用select 使用简介
一:五种I/O模型区分: 1.阻塞I/O模型 最流行的I/O模型是阻塞I/O模型,缺省情形下,所有套接口都是阻塞的.我们以数据报套接口为例来讲解此模型(我们使用UDP而不是TCP作为例子的原 ...
- 11、testng.xml文件解析
我们可以从以下几种方式调用testng 用testng.xml ant 命令行 我们本次重点介绍testng.xml,testng.xml 文件来配置测试用例的执行 ,testng.xml 文件可以很 ...
- sed use case: Filter without editing
if we want to filter with sed pattern and just print the filtered lines without any further editing ...
- 通过Module读取寄存器的值
1: int eax; 2: _asm_("nop":"=a"(eax)); 3: printk("Get Eax Value:\n"); ...
- 拾遗:~/.zshrc 配置
Tips: zsh 默认仅显示最近 16 条历史记录 $ # 等价于 history - :显示最近 条记录 $ history $ # 等价于 history - : 显示从第 条到最后 条,即是全 ...
- C语言static和局部变量
#include <stdio.h> void test(); int main() { /************************************************ ...