/// <summary> /// /// </summary> /// <param name="userId">用户ID</param> /// <param name="userName">用户姓名</param> /// <param name="device">设备类型</param> /// <param name="operRemark">日志内容</param> /// <param name="operType">日志类型</param> /// <returns></returns> public bool AddLog(int userId, string userName, CPEnum.DeviceTypeEnum device, string operRemark, string operType) { CPLog log = new CPLog(); log.UserId = userId; log.UserName = userName; log.OperTime = DateTime.Now; log.OperDevice = device; log.OperRemark = operRemark; log.OperType = operType; log.OperIP = ""; try { //获取操作IP log.OperIP = CPAppContext.GetClientIP(); } catch (Exception ex) { ex.ToString(); } log.OperUrl = ""; try { //获取办理页面地址 log.OperUrl = CPAppContext.GetHttpContext().Request.Path; } catch (Exception ex) { } return(this._CPLogRep.Add(log) > 0 ? true : false); }
public string UserAdminSysIds() { string UserAdminSysIds = CPAppContext.GetHttpContext().Session.GetString("UserAdminSysIds"); if (string.IsNullOrEmpty(UserAdminSysIds)) { return(""); } else { return(UserAdminSysIds); } }
public string DepNames() { string DepNames = CPAppContext.GetHttpContext().Session.GetString("DepNames"); if (string.IsNullOrEmpty(DepNames)) { return(""); } else { return(DepNames); } }
public string UserRoleNames() { string RoleNames = CPAppContext.GetHttpContext().Session.GetString("RoleNames"); if (string.IsNullOrEmpty(RoleNames)) { return(""); } else { return(RoleNames); } }
public string UserPhotoPath() { string UserPhotoPath = CPAppContext.GetHttpContext().Session.GetString("UserPhotoPath"); if (string.IsNullOrEmpty(UserPhotoPath)) { return(""); } else { return(UserPhotoPath); } }
public string UserLoginName() { string UserLoginName = CPAppContext.GetHttpContext().Session.GetString("UserLoginName"); if (string.IsNullOrEmpty(UserLoginName)) { return(""); } else { return(UserLoginName); } }
public string UserIden() { string UserKey = CPAppContext.GetHttpContext().Session.GetString("UserKey"); if (string.IsNullOrEmpty(UserKey)) { return(""); } else { return(UserKey); } }
public int UserId() { string UserId = CPAppContext.GetHttpContext().Session.GetString("UserId"); if (string.IsNullOrEmpty(UserId)) { return(0); } else { return(int.Parse(UserId)); } }
public string Session([CPName("Key")] string key) { string s = CPAppContext.GetHttpContext().Session.GetString(key); if (string.IsNullOrEmpty(s)) { return(""); } else { return(s); } }
public void SetHeader() { try { //增加设置允许跨域访问,否则会导致如果直接把HTML放入手机里时,会导致不能访问数据的问题 CPAppContext.GetHttpContext().Response.Headers.Add("Access-Control-Allow-Origin", "*"); //允许哪些url可以跨域请求到本域 CPAppContext.GetHttpContext().Response.Headers.Add("Access-Control-Allow-Methods", "POST"); //允许的请求方法,一般是GET,POST,PUT,DELETE,OPTIONS CPAppContext.GetHttpContext().Response.Headers.Add("Access-Control-Allow-Headers", "x-requested-with,content-type"); //允许哪些请求头可以跨域 } catch (Exception ex) { ex.ToString(); } }
public static bool CheckHasQueryStringKey(string key) { if (string.IsNullOrEmpty(key)) { return(false); } if (CPAppContext.GetHttpContext().Request.Query.Keys.Contains(key) == false) { return(false); } else { return(true); } }
public string QueryString([CPName("参数key")] string key) { if (string.IsNullOrEmpty(key)) { return(""); } object obj = CPAppContext.GetHttpContext().Request.Query[key]; if (obj == null) { return(""); } else { return(obj.ToString()); } }