/// <summary> /// Called after the action method executes. /// </summary> /// <param name="filterContext">The filter context.</param> public override void OnActionExecuted(ActionExecutedContext filterContext) { IFunction function = filterContext.GetExecuteFunction(ServiceProvider); if (function == null || !function.OperateLogEnabled) { return; } Operator @operator = new Operator() { Ip = filterContext.HttpContext.Request.GetIpAddress(), }; if (filterContext.HttpContext.Request.IsAuthenticated) { ClaimsIdentity identity = filterContext.HttpContext.User.Identity as ClaimsIdentity; if (identity != null) { @operator.UserId = identity.GetClaimValue(ClaimTypes.NameIdentifier); @operator.UserName = identity.GetClaimValue(ClaimTypes.Name); } } OperateLog operateLog = new OperateLog() { FunctionName = function.Name, Operator = @operator }; if (function.DataLogEnabled) { foreach (DataLog dataLog in DataLogCache.DataLogs) { operateLog.DataLogs.Add(dataLog); } } OperateLogWriter.Write(operateLog); }
public OperationResult Insert(OperateLogModel model) { var entity = new OperateLog { Area = model.Area, Controller = model.Controller, Action = model.Action, Description = model.Description, IPAddress = model.IPAddress, LoginName = model.LoginName, UserId = model.UserId, LogTime = model.LogTime }; OperateLogRepository.Insert(entity); return(new OperationResult(OperationResultType.Success, "添加成功")); }
public static string DeleteAll() { using (dbDataContext db = new HsBusiness.dbDataContext()) { string result = ""; var item = db.Arrears.Where(x => true).ToList(); db.Arrears.DeleteAllOnSubmit(item); OperateLog opermodel = new OperateLog(); opermodel.Operator = Common.TCContext.Current.OnlineRealName.ToString(); //操作人 opermodel.OperTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //操作时间 opermodel.OperType = "全部删除"; //操作类型 opermodel.Operdescribe = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + Common.TCContext.Current.OnlineRealName + "进行了批量删除操作"; db.SubmitChanges(); result = JsonConvert.SerializeObject(new { msg = "删除成功", stste = 1 }); return(result); } }
public static bool Add(this OperateLogBll value, string table, int targetId, DataUpdateType operateType, int systemUserId, string log) { //var userBll = new SystemUserBll(); //var user = userBll.QuerySingle(systemUserId); var model = new OperateLog { TargetTable = table, TargetId = targetId, OperateType = (int)operateType, SystemUserId = systemUserId, LogContent = log, OperateTime = DateTime.Now }; return(value.Insert(model).Id > 0); }
/// <summary> /// 绑定列表 /// </summary> /// <returns></returns> public string ListBind() { string page = Request["page"]; string rows = Request["pagesize"]; string key = Request["key"]; string ajmc = Request["ajmc"]; string gh = Request["gh"]; int pageNumber = int.Parse(page); int pageSize = int.Parse(rows); string where = " and T.SFSC='N'"; object[] values = new object[3]; if (!string.IsNullOrEmpty(key)) { where += " and AJBH like :AJBH"; values[0] = "%" + key + "%"; } if (!string.IsNullOrEmpty(ajmc)) { where += " and AJMC like :AJMC"; values[1] = "%" + ajmc + "%"; } if (!string.IsNullOrEmpty(gh)) { where += " and LSZH like :LSZH"; values[2] = "%" + gh + "%"; } EDRS.BLL.YX_DZJZ_WJSQDY bll = new EDRS.BLL.YX_DZJZ_WJSQDY(this.Request); DataSet ds = bll.GetListByPageEx(where, "SQSJ desc", (pageSize * pageNumber) - pageSize + 1, (pageSize * pageNumber), values); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { //数据日志 OperateLog.AddLog(OperateLog.LogType.阅卷Web, "获取阅卷绑定列表成功", UserInfo, UserRole, this.Request); int count = bll.GetRecordCount(where, values); return("{\"Total\":" + count + ",\"Rows\":" + JsonHelper.JsonString(ds.Tables[0]) + "}"); } //数据日志 OperateLog.AddLog(OperateLog.LogType.阅卷Web, "获取阅卷绑定列表-未找到信息", UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "未找到阅卷绑定信息", null)); }
/// <summary> /// 修改 /// </summary> /// <param name="dwbm"></param> /// <returns></returns> private string UpData() { string id = Request.Form.Get("key_hidd"); string uid = Request.Form.Get("hidd_unitNumber").Trim(); if (string.IsNullOrEmpty(id) || !Regex.IsMatch(id, @"^[A-Za-z0-9]{1,8}$")) { return(ReturnString.JsonToString(Prompt.error, "未找到需要修改信息", null)); } if (string.IsNullOrEmpty(uid) || !Regex.IsMatch(id, @"^[A-Za-z0-9]{1,8}$")) { return(ReturnString.JsonToString(Prompt.error, "未找到需要修改信息", null)); } string msg = string.Empty; //if (!ProvingFrom(ref msg)) // return ReturnString.JsonToString(Prompt.error, msg, null); XT_ZZJG_BMBM bll = new XT_ZZJG_BMBM(this.Request); EDRS.Model.XT_ZZJG_BMBM model = bll.GetModel(uid, id); if (model != null) { model.BMMC = Request.Form.Get("txt_name").Trim(); model.BMJC = Request.Form.Get("txt_abbreviation").Trim(); //model.BMAHJC = Request.Form.Get("txt_abbreviationNum1").Trim(); //model.BMWHJC = Request.Form.Get("txt_abbreviationNum2").Trim(); //model.SFLSJG = Request.Form.Get("txt_temporary") == null ? "N" : "Y"; //model.SFCBBM = Request.Form.Get("txt_undertake") == null ? "0" : "1"; //model.BMXH = Convert.ToDecimal(Request.Form.Get("txt_number").Trim()); model.BZ = Request.Form.Get("txt_remark").Trim(); if (bll.Update(model)) { //数据日志 OperateLog.AddLog(OperateLog.LogType.部门管理Web, "修改部门成功", model.BMMC, UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.win, "保存成功", null)); } //数据日志 OperateLog.AddLog(OperateLog.LogType.部门管理Web, "修改部门失败", model.BMMC, UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "保存失败", null)); } //数据日志 OperateLog.AddLog(OperateLog.LogType.部门管理Web, "未找到修改部门信息", Request.Form.Get("txt_name"), UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "未找到需要修改信息", null)); }
/// <summary> /// 绑定数据列表 /// </summary> /// <returns></returns> private string ListBindGn() { string page = Request["page"]; string rows = Request["pagesize"]; string key = Request["key"]; string gn = Request["gn"]; int pageNumber = int.Parse(page); int pageSize = int.Parse(rows); string where = string.Empty; object[] values = new object[7]; where += " and T.SFSC=:SFSC"; values[0] = "N"; where += " and b.DWBM=:DWBM"; values[1] = UserInfo.DWBM; if (!string.IsNullOrEmpty(key)) { where += " and( T.MC like :MC or T.GH like :GH or T.DLBM like :DLBM or T.GZZH like :GZZH)"; values[2] = "%" + key + "%"; values[3] = "%" + key + "%"; values[4] = "%" + key + "%"; values[5] = "%" + key + "%"; } if (!string.IsNullOrEmpty(gn)) { where += " and b.GNBM=:GNBM"; values[6] = gn; } EDRS.BLL.XT_ZZJG_RYBM bll = new EDRS.BLL.XT_ZZJG_RYBM(this.Request); DataSet ds = bll.GetListByPageAndGn(where, "", (pageSize * pageNumber) - pageSize + 1, (pageSize * pageNumber), values); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { //数据日志 OperateLog.AddLog(OperateLog.LogType.功能权限管理Web, "获取人员功能权限成功", UserInfo, UserRole, this.Request); int count = bll.GetRecordCountAndGn(where, values); return("{\"Total\":" + count + ",\"Rows\":" + JsonHelper.JsonString(ds.Tables[0]) + "}"); } //数据日志 OperateLog.AddLog(OperateLog.LogType.功能权限管理Web, "获取人员功能权限未找到数据", UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "", null)); }
public int UpdateLeave(LeaveName data) { var oDic = new Dictionary <string, string> { }; var nDic = new Dictionary <string, string> { }; var opLog = new OperateLog() { operateID = data.lastOperaAccID, active = "更新", category = "請假時間設定", createTime = definePara.dtNow() }; int count = 0; try{ var context = _DbContext.leavenames.FirstOrDefault(b => b.ID == data.ID); if (context != null) { var query = _DbContext.leavenames.FirstOrDefault(b => b.leaveName == data.leaveName); if (query == null || query.ID == context.ID) { toNameFn.AddUpLeave_convertToDic(ref oDic, context); context.leaveName = data.leaveName; context.timeUnit = data.timeUnit; context.halfVal = (data.timeUnit == 3? data.halfVal : false); context.lastOperaAccID = data.lastOperaAccID; context.updateTime = data.updateTime; count = _DbContext.SaveChanges(); if (count == 1) { toNameFn.AddUpLeave_convertToDic(ref nDic, context); opLog.content = toNameFn.AddUpLeave_convertToText(nDic, oDic); saveOperateLog(opLog); //紀錄操作紀錄 } } else { count = 1062; } } }catch (Exception e) { count = ((MySqlException)e.InnerException).Number; } return(count); }
private DataSet GetUnitCaseData() { string where = ""; List <object> values = new List <object>(); string pageIndex = Request["page"]; string pageSize = Request["pagesize"]; string key = Request["key"]; //部门受案号 string unit = Request["unit"]; //承办单位 string timebegin = Request["timebegin"]; //开始日期 string timeend = Request["timeend"]; //结束日期 if (!string.IsNullOrEmpty(unit)) { where += " and CBDW_MC like "; where += "'%" + unit + "%'"; } //strWhere += " and (select count(1) from yx_dzjz_jzml y where y.Bmsah=T1.Bmsah) > 0";//已关联 if (!string.IsNullOrEmpty(timebegin)) { where += " and SLRQ >= to_date('" + Convert.ToDateTime(timebegin).ToShortDateString() + "','yyyy-mm-dd')"; } if (!string.IsNullOrEmpty(timeend)) { where += " and SLRQ <= to_date('" + Convert.ToDateTime(timeend).AddDays(1).ToShortDateString() + "','yyyy-mm-dd')"; } //单位权限 //List<string> unitRoleList = GetDwBm(UserRole.DWBM, UserRole.BMBM, UserRole.JSBM); string qxWhere = " AND DWBM = '" + UserInfo.DWBM + "' AND JSBM in (" + Jsbms + ") AND BMBM in (" + Bmbms + ") AND QXLX = 0"; EDRS.BLL.EDRS_Report bll = new EDRS.BLL.EDRS_Report(Request); int count; //1-8 修改存储过程 DataSet ds = bll.GetCaseGroupByUnit(where, UserInfo.DWBM, UserInfo.GH, Convert.ToInt32(pageSize), Convert.ToInt32(pageIndex), "", out count, values.ToArray()); if (ds == null) { OperateLog.AddLog(OperateLog.LogType.单位卷宗统计Web, "查询单位卷宗统计图表数据失败!", UserInfo, UserRole, Request); } else { OperateLog.AddLog(OperateLog.LogType.单位卷宗统计Web, "查询单位卷宗统计图表数据成功!", UserInfo, UserRole, Request); } return(ds); }
public int UpdateSpLeaveRule(AnnualLeaveRule data) { using (var trans = _DbContext.Database.BeginTransaction()){ var oDic = new Dictionary <string, string> { }; var nDic = new Dictionary <string, string> { }; var opLog = new OperateLog() { operateID = data.lastOperaAccID, active = "更新", category = "特休天數設定", createTime = definePara.dtNow() }; var count = 0; int diffSpecialDays = 0, diffBuffDays = 0; try{ var context = _DbContext.annualleaverule.FirstOrDefault(b => b.ID == data.ID); if (context != null) { toNameFn.AddUpSpLeave_convertToDic(ref oDic, context); diffSpecialDays = data.specialDays - context.specialDays; diffBuffDays = data.buffDays - context.buffDays; //context.seniority = data.seniority; context.specialDays = data.specialDays; context.buffDays = data.buffDays; context.lastOperaAccID = data.lastOperaAccID; context.updateTime = data.updateTime; count = _DbContext.SaveChanges(); if (count == 1) { toNameFn.AddUpSpLeave_convertToDic(ref nDic, context); opLog.content = toNameFn.AddUpSpLeave_convertToText(nDic, oDic); saveOperateLog(opLog); //紀錄操作紀錄 AnnualLeave.UpEmployeeSpLeave(data.ID, diffSpecialDays, diffBuffDays); trans.Commit(); } } }catch (Exception ex) { count = catchErrorProcess(ex, count); } return(count); } }
/// <summary> #endregion #region 根据律师证号获取律师附件信息 /// 根据律师证号获取律师附件信息 /// </summary> /// <returns></returns> private string GetLsFile() { string lszh = Request.Form["lszh"]; EDRS.BLL.YX_DZJZ_LSZZWJ bll = new YX_DZJZ_LSZZWJ(this.Request); List <string> filestr = bll.GetList(lszh); if (filestr.Count > 0) { //数据日志 OperateLog.AddLog(OperateLog.LogType.阅卷Web, "根据编号获取律师附件成功", "", UserInfo, UserRole, this.Request); return(JsonHelper.JsonString(filestr)); } //数据日志 OperateLog.AddLog(OperateLog.LogType.阅卷Web, "根据编号获取律师附件失败", "", UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "获取数据失败", null)); }
/// <summary> /// 公告——改 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExcutedResult UpdateNoticeInfo(UpdateNoticeRequestModel model) { Notice oldNotice = null; var result = _panguRepository.UpdateNoticeInfo(model, out oldNotice); OperateLog log = new OperateLog(); log.Id = Guid.NewGuid(); log.ClientIp = _principalUser.ClientIP; log.CreateTime = DateTime.UtcNow; log.ManagerAccount = _principalUser.Mobile; log.ManagerId = _principalUser.Id; log.OriginalValue = JsonConvert.SerializeObject(oldNotice); log.NewValue = JsonConvert.SerializeObject(model); log.Operate = "Update"; log.Function = "公告修改"; _operateLogRepository.Insert(log); return(result); }
/// <summary> /// 删除 /// </summary> /// <param name="ids"></param> /// <returns></returns> public static string Delete(int ids) { using (dbDataContext db = new dbDataContext()) { var result = ""; var list = db.Business.FirstOrDefault(x => x.ID == ids); db.Business.DeleteOnSubmit(list); OperateLog opermodel = new OperateLog(); opermodel.Operator = list.Users.Name; //操作人 opermodel.OperTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //操作时间 opermodel.OperType = "删除"; //操作类型 opermodel.Operdescribe = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + list.Users.Name + "进行了单个删除操作"; db.OperateLog.InsertOnSubmit(opermodel); db.SubmitChanges(); result = JsonConvert.SerializeObject(new { msg = "删除成功", stste = 1 }); return(result); } }
public OperationResult Insert(OperateLogModel model) { var entity = new OperateLog { Area = model.Area, Controller = model.Controller, Action = model.Action, Description = model.Description, IPAddress = model.IPAddress, LoginName = model.LoginName, UserId = model.UserId, LogTime = model.LogTime, IsDeleted = false }; HpMongoContext.Save(entity); return(new OperationResult(OperationResultType.Success, "添加成功")); }
public void Add(OperateLog model) { using (DbOperator dbOperator = ConnectionManager.CreateConnection()) { dbOperator.ClearParameters(); StringBuilder strSql = new StringBuilder(); strSql.Append("INSERT INTO OperateLog(Operator,OperatorIP,OperateTime,ModuleName,MethodName,OperatorType,LogFrom,OperatorContent) VALUES (@Operator,@OperatorIP,@OperateTime,@ModuleName,@MethodName,@OperatorType,@LogFrom,@OperatorContent);"); dbOperator.AddParameter("Operator", model.Operator); dbOperator.AddParameter("OperatorIP", model.OperatorIP); dbOperator.AddParameter("OperateTime", model.OperateTime); dbOperator.AddParameter("ModuleName", model.ModuleName); dbOperator.AddParameter("MethodName", model.MethodName); dbOperator.AddParameter("OperatorType", (int)model.OperateType); dbOperator.AddParameter("LogFrom", (int)model.LogFrom); dbOperator.AddParameter("OperatorContent", model.OperatorContent); dbOperator.ExecuteNonQuery(strSql.ToString()); } }
/// <summary> /// 修改配置数据 /// </summary> /// <returns></returns> private string UpData() { string pzbm = Request.Form.Get("key_hidd").Trim(); if (string.IsNullOrEmpty(pzbm)) { return(ReturnString.JsonToString(Prompt.error, "未找到需要修改信息", null)); } string msg = string.Empty; if (!ProvingFrom(ref msg)) { return(ReturnString.JsonToString(Prompt.error, msg, null)); } XY_DZJZ_XTPZ bll = new XY_DZJZ_XTPZ(this.Request); EDRS.Model.XY_DZJZ_XTPZ model = bll.GetModel(pzbm); if (model != null) { model.CONFIGID = Convert.ToInt32(Request.Form["slct_type_val"]); model.CONFIGNAME = Enum.Parse(typeof(EnumConfig), Request.Form["slct_type_val"], true).ToString(); if (!string.IsNullOrEmpty(Request.Form["txt_value_val"])) { model.CONFIGVALUE = Request.Form["txt_value_val"]; } else { model.CONFIGVALUE = Request.Form["txt_value"]; } if (bll.Update(model)) { //数据日志 OperateLog.AddLog(OperateLog.LogType.参数配置Web, "修改参数配置成功", model.CONFIGNAME, UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.win, "保存成功,重新登录生效", null)); } //数据日志 OperateLog.AddLog(OperateLog.LogType.参数配置Web, "修改参数配置失败", model.CONFIGNAME, UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "保存失败", null)); } //数据日志 OperateLog.AddLog(OperateLog.LogType.参数配置Web, "修改参数配置未找到信息", Request.Form.Get("txt_cs"), UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "未找到需要修改信息", null)); }
public static string BatchDel(string ids) { using (dbDataContext db = new dbDataContext()) { string result = ""; string[] strArray = ids.Split(','); int[] intArray = Array.ConvertAll <string, int>(strArray, x => Convert.ToInt32(x)); var item = db.Arrears.Where(x => intArray.Contains(x.ID)).ToList(); db.Arrears.DeleteAllOnSubmit(item); OperateLog opermodel = new OperateLog(); opermodel.Operator = Common.TCContext.Current.OnlineRealName.ToString(); //操作人 opermodel.OperTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); //操作时间 opermodel.OperType = "批量删除"; //操作类型 opermodel.Operdescribe = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + Common.TCContext.Current.OnlineRealName + "进行了批量删除操作"; db.SubmitChanges(); result = JsonConvert.SerializeObject(new { msg = "删除成功", stste = 1 }); return(result); } }
/// <summary> /// 打印 /// </summary> /// <returns></returns> private string PrintFileByXh() { //申请序号 string xh = Request.Form.Get("xh"); //选择文件文件序号 string param = Request.Form.Get("param"); if (string.IsNullOrEmpty(xh) || string.IsNullOrEmpty(param)) { return(ReturnString.JsonToString(Prompt.error, "打印未获取到参数", null)); } string[] paramArr = param.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (paramArr.Length == 0) { return(ReturnString.JsonToString(Prompt.error, "请选择需要打印的文件页", null)); } else { //设置文件是需要打印的 List <EDRS.Model.YX_DZJZ_WJSQDYJL> listModel = new List <EDRS.Model.YX_DZJZ_WJSQDYJL>(); EDRS.Model.YX_DZJZ_WJSQDYJL model = null; //循环构造集合 for (int i = 0; i < paramArr.Length; i++) { model = new EDRS.Model.YX_DZJZ_WJSQDYJL(); model.WJXH = paramArr[i]; model.XH = xh; model.SFXYDY = "Y"; listModel.Add(model); } EDRS.BLL.YX_DZJZ_WJSQDY bll = new EDRS.BLL.YX_DZJZ_WJSQDY(Request); if (bll.UpdateListJl(listModel)) { OperateLog.AddLog(OperateLog.LogType.阅卷Web, "打印律师申请文件页成功", UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.win, "打印成功", null)); } OperateLog.AddLog(OperateLog.LogType.阅卷Web, "打印律师申请文件页失败", UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "打印失败", null)); } }
public ActionResult ReApplyBorrow(string borrowId) { try { var result = ApplyBorrowService.GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId }).First(); var borrowRecordList = ApplyBorrowFileListService.GetByWhere(" where BorrowID=@BorrowID", new { BorrowID = borrowId }).ToList(); if (result.ApplyState == 3) { result.ApplyState = 1; var sign = ApplyBorrowService.UpdateModel(result); if (sign) { foreach (var item in borrowRecordList) { var operate = new OperateLog() { OperatePeople = Operator.RealName, OperateTime = DateTime.Now, OperateType = "重新申请借阅", RecordId = item.RecordID, OperateInfo = $"重新申请借阅 借阅编号:{result.BorrowID},档案编号:{item.RecordID}" }; OperateLogService.CreateModel(operate); } return(Json(SuccessTip("重新申请借阅成功!"))); } else { return(Json(ErrorTip("重新申请借阅失败!"))); } } else { return(Json(ErrorTip("当前申请状态不允许重新申请!"))); } } catch (InvalidOperationException ex) { Log.WriteFatal(ex); return(Json(ErrorTip("重新申请借阅失败,当前借阅编号不存在!"))); } }
/// <summary> /// 绑定列表 /// </summary> /// <returns></returns> public string ListBind() { string page = Request.Form["page"]; string rows = Request.Form["pagesize"]; string key = Request.Form["key"]; string ywbm = Request.Form["ywbm"]; int pageNumber = int.Parse(page); int pageSize = int.Parse(rows); string where = string.Empty; List <object> values = new List <object>(); if (!string.IsNullOrEmpty(key)) { where += " and AJLBMC like :AJLBMC "; values.Add("%" + key + "%"); } if (!string.IsNullOrEmpty(ywbm)) { where += " and YWBM = :YWBM "; values.Add(ywbm); } EDRS.BLL.XT_DM_AJLBBM bll = new EDRS.BLL.XT_DM_AJLBBM(this.Request); DataSet ds = bll.GetListByPage(where + " and SFSC = 'N' ", " ajlbbm asc", (pageSize * pageNumber) - pageSize + 1, (pageSize * pageNumber), values.ToArray()); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { //数据日志 OperateLog.AddLog(OperateLog.LogType.参数配置Web, "类别绑定成功", UserInfo, UserRole, this.Request); int count = bll.GetRecordCount(where + " and SFSC='N' ", values.ToArray()); DataTable dt = (ds.Tables[0]).Copy(); return("{\"Total\":" + count + ",\"Rows\":" + JsonHelper.JsonString(dt) + "}"); } //数据日志 OperateLog.AddLog(OperateLog.LogType.参数配置Web, "类别绑定列表未找到信息", UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "未找到类别", null)); }
/// <summary> /// 添加部门数据 /// </summary> /// <returns></returns> private string AddData() { string msg = string.Empty; //if (!ProvingFrom(ref msg)) // return ReturnString.JsonToString(Prompt.error, msg, null); string number = "0001"; XT_ZZJG_BMBM bll = new XT_ZZJG_BMBM(this.Request); EDRS.Model.XT_ZZJG_BMBM modelBM = bll.GetListOrderModel(" and rownum < 2", "BMBM desc", null); if (modelBM != null) { number = (int.Parse(modelBM.BMBM.ToString()) + 1).ToString(); int len = 4 - number.Length; for (int i = 0; i < len; i++) { number = number.Insert(0, "0"); } } EDRS.Model.XT_ZZJG_BMBM model = new EDRS.Model.XT_ZZJG_BMBM(); model.DWBM = Request.Form.Get("hidd_unitNumber").Trim(); model.BMBM = number; model.FBMBM = Request.Form.Get("hidd_superiorNumber").Trim(); model.BMMC = Request.Form.Get("txt_name").Trim(); model.BMJC = Request.Form.Get("txt_abbreviation").Trim(); model.BMAHJC = ""; model.BMWHJC = ""; model.SFLSJG = "N"; model.SFCBBM = "0"; model.BMXH = 0; model.BZ = Request.Form.Get("txt_remark").Trim(); model.BMYS = ""; if (bll.Add(model)) { //数据日志 OperateLog.AddLog(OperateLog.LogType.部门管理Web, "添加部门成功", model.BMMC, UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.win, "保存成功", null)); } //数据日志 OperateLog.AddLog(OperateLog.LogType.部门管理Web, "添加部门失败", model.BMMC, UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "保存失败", null)); }
public int DelTimeRule(int id, int loginID) { using (var trans = _DbContext.Database.BeginTransaction()){ var dic = new Dictionary <string, string> { }; var opLog = new OperateLog() { operateID = loginID, active = "刪除", category = "工作時間設定", createTime = definePara.dtNow() }; var count = 0; try { var context = _DbContext.worktimerules.FirstOrDefault(b => b.ID == id); if (context != null) { toNameFn.AddUpTimeRule_convertToDic(ref dic, context); _DbContext.worktimerules.Remove(context); count = _DbContext.SaveChanges(); } if (count == 1) { var query = _DbContext.accounts.Where(b => b.timeRuleID == id).ToList(); foreach (var tmp in query) { tmp.timeRuleID = 0; tmp.lastOperaAccID = 0; tmp.updateTime = definePara.dtNow(); _DbContext.SaveChanges(); } opLog.content = toNameFn.AddUpTimeRule_convertToText(dic); saveOperateLog(opLog); //紀錄操作紀錄 trans.Commit(); } } catch (Exception ex) { count = catchErrorProcess(ex, count); } return(count); } }
public int UpdateTimeRule(WorkTimeRule updateData) { var oDic = new Dictionary <string, string> { }; var nDic = new Dictionary <string, string> { }; var opLog = new OperateLog() { operateID = updateData.lastOperaAccID, active = "更新", category = "工作時間設定", createTime = definePara.dtNow() }; int count = 0; try{ var context = _DbContext.worktimerules.FirstOrDefault(b => b.ID == updateData.ID); if (context != null) { toNameFn.AddUpTimeRule_convertToDic(ref oDic, context); context.name = updateData.name; context.type = updateData.type; context.startTime = updateData.startTime; context.endTime = updateData.endTime; context.sRestTime = updateData.sRestTime; context.eRestTime = updateData.eRestTime; context.elasticityMin = updateData.elasticityMin; context.lastOperaAccID = updateData.lastOperaAccID; context.updateTime = updateData.updateTime; count = _DbContext.SaveChanges(); if (count == 1) { toNameFn.AddUpTimeRule_convertToDic(ref nDic, context); opLog.content = toNameFn.AddUpTimeRule_convertToText(nDic, oDic); saveOperateLog(opLog); //紀錄操作紀錄 } } }catch (Exception e) { count = ((MySqlException)e.InnerException).Number; } return(count); }
/// <summary> /// 绑定人员 /// </summary> /// <returns></returns> private string GetPeople() { string page = Request["page"]; string rows = Request["pagesize"]; string key = Request["condition"]; int pageNumber = int.Parse(page); int pageSize = int.Parse(rows); string where = string.Empty; object[] values = new object[6]; where += " and SFSC=:SFSC"; values[0] = "N"; where += " and DWBM=:DWBM"; values[1] = UserInfo.DWBM; if (!string.IsNullOrEmpty(key)) { string value = JsonHelper.DeserializeObjectKey(key, "value"); if (!string.IsNullOrEmpty(value)) { where += " and( MC like :MC or GH like :GH or DLBM like :DLBM or GZZH like :GZZH)"; values[2] = "%" + value + "%"; values[3] = "%" + value + "%"; values[4] = "%" + value + "%"; values[5] = "%" + value + "%"; } } EDRS.BLL.XT_ZZJG_RYBM bll = new EDRS.BLL.XT_ZZJG_RYBM(this.Request); DataSet ds = bll.GetListByPage(where, "", (pageSize * pageNumber) - pageSize + 1, (pageSize * pageNumber), values); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { //数据日志 OperateLog.AddLog(OperateLog.LogType.功能权限管理Web, "阅卷分配获取人员信息成功", UserInfo, UserRole, this.Request); int count = bll.GetRecordCount(where, values); return("{\"Total\":" + count + ",\"Rows\":" + JsonHelper.JsonString(ds.Tables[0]) + "}"); } //数据日志 OperateLog.AddLog(OperateLog.LogType.功能权限管理Web, "阅卷分配未找到相关人员信息", UserInfo, UserRole, this.Request); return(ReturnString.JsonToString(Prompt.error, "未找到任何人员信息", null)); }
/// <summary> /// 获取人员列表 /// </summary> /// <returns></returns> private string GetRybmList() { string err = string.Empty; int count = 0; string xm = ""; #region 获取参数 if (!string.IsNullOrEmpty(Request.Params["condition"])) { xm = Request.Params["condition"].Trim(); xm = JsonHelper.DeserializeObjectKey(xm, "value"); } int pageindex = Convert.ToInt32(Request.Params["page"]); int rows = Convert.ToInt32(Request.Params["pagesize"]); #endregion StringBuilder strWhere = new StringBuilder(); if (!string.IsNullOrEmpty(xm)) { strWhere.AppendFormat(" and mc like '%{0}%'", xm); } DataTable dt = Cyvation.CCQE.BLL.ZzjgManage.GetRyList(this.UserInfo.DWBM, this.UserInfo.GH, strWhere.ToString(), rows, pageindex, out count, out err); string retValue = string.Empty; if (!string.IsNullOrEmpty(err)) { OperateLog.AddLog(OperateLog.LogType.人员管理Web, "查询人员列表数据失败:" + err, UserInfo, UserRole, Request); retValue = err; } else { OperateLog.AddLog(OperateLog.LogType.人员管理Web, "查询人员列表数据成功!" + err, UserInfo, UserRole, Request); retValue = "{\"Total\":" + count + ",\"Rows\":" + JsonHelper.JsonString(dt) + "}"; //retValue = "{\"Rows\":" + JsonHelper.JsonString(dt) + "}"; } return(retValue); }
/// <summary> /// 公告——增 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExcutedResult InsertNoticeInfo(NoticeRequestModel model) { var result = _panguRepository.InsertNoticeInfo(model); if (result.Code == SysResultCode.Success) { OperateLog log = new OperateLog(); log.Id = Guid.NewGuid(); log.ClientIp = _principalUser.ClientIP; log.CreateTime = DateTime.UtcNow; log.ManagerAccount = _principalUser.Mobile; log.ManagerId = _principalUser.Id; log.OriginalValue = string.Empty; log.NewValue = JsonConvert.SerializeObject(model); log.Operate = "Insert"; log.Function = "公告新增"; _operateLogRepository.Insert(log); } return(result); }
/// <summary> /// 广告——删 /// </summary> /// <param name="id"></param> /// <returns></returns> public ExcutedResult DeleteNoticeInfo(string id) { var result = _panguRepository.DeleteNoticeInfo(id); if (result.Code == SysResultCode.Success) { OperateLog log = new OperateLog(); log.Id = Guid.NewGuid(); log.ClientIp = _principalUser.ClientIP; log.CreateTime = DateTime.UtcNow; log.ManagerAccount = _principalUser.Mobile; log.ManagerId = _principalUser.Id; log.OriginalValue = string.Empty; log.NewValue = id; log.Operate = "Delete"; log.Function = "公告删除"; _operateLogRepository.Insert(log); } return(result); }
/// <summary> /// 添加一条记录 /// </summary> public int Add(OperateLog entity, IDbTransaction tran) { string sql = @"insert into [OperateLog] ([module], [objectId], [userId], [userName], [content], [addTime]) values (@module, @objectId, @userId, @userName, @content, @addTime)"; object param = new { module = entity.Module, objectId = entity.ObjectId, userId = entity.UserId, userName = entity.UserName, content = entity.Content, addTime = entity.AddTime }; int count = tran.Connection.Execute(sql, param, tran); return(count); }
public int DelEmployee(int employeeID, int operateID) { using (var trans = _DbContext.Database.BeginTransaction()){ var dic = new Dictionary <string, string> { }; var opLog = new OperateLog() { operateID = operateID, employeeID = employeeID, active = "刪除", category = "員工資料", createTime = definePara.dtNow() }; var count = 0; try { var context = _DbContext.accounts.FirstOrDefault(b => b.ID == employeeID); var detail = _DbContext.employeedetails.FirstOrDefault(b => b.accountID == employeeID); if (context != null) { toNameFn.AddUpEmployee_covertToDic(ref dic, context, detail); _DbContext.accounts.Remove(context); count = _DbContext.SaveChanges(); if (count == 1) { if (detail != null) { _DbContext.Remove(detail); _DbContext.SaveChanges(); } //record operateLOg opLog.content = toNameFn.AddUpEmployee_covertToText(dic); saveOperateLog(opLog); //紀錄操作紀錄 } trans.Commit(); } } catch (Exception ex) { count = catchErrorProcess(ex, count); } return(count); } }
public int UpdatePunchCard(PunchCardLog updateData, bool normal) //true正常打卡新增/false編輯新增 { var oDic = new Dictionary <string, string> { }; var nDic = new Dictionary <string, string> { }; var opLog = new OperateLog() { operateID = updateData.lastOperaAccID, employeeID = updateData.accountID, active = "更新", category = "打卡紀錄", createTime = definePara.dtNow() }; int count = 0; var query = _DbContext.punchcardlogs.Where(b => b.accountID == updateData.accountID && b.logDate == updateData.logDate && b.ID != updateData.ID); if (query.Count() > 0) { return(1062); //該日期已有紀錄 } PunchCardLog context = _DbContext.punchcardlogs.FirstOrDefault(b => b.ID == updateData.ID); if (context != null) { toNameFn.AddUpPunchCardLog_convertToDic(ref oDic, context); context.logDate = updateData.logDate; context.onlineTime = updateData.onlineTime; context.offlineTime = updateData.offlineTime; context.punchStatus = updateData.punchStatus; context.lastOperaAccID = updateData.lastOperaAccID; context.updateTime = updateData.updateTime; count = _DbContext.SaveChanges(); } if (count == 1 && !normal) { toNameFn.AddUpPunchCardLog_convertToDic(ref nDic, context); opLog.content = toNameFn.AddUpPunchCardLog_convertToText(nDic, oDic); saveOperateLog(opLog); //紀錄操作紀錄 } return(count); }
private DataSet GetCaseByMouth() { string where = ""; List <object> values = new List <object>(); string unit = Request["unit"]; //承办单位 string timebegin = Request["timebegin"]; //开始日期 string timeEnd = Request["timeend"]; //结束日期 if (!string.IsNullOrEmpty(unit)) { where += " and CBDW_BM in ("; where += "" + unit.Replace(";", ",") + ""; where += ")"; } //strWhere += " and (select count(1) from yx_dzjz_jzml y where y.Bmsah=T1.Bmsah) > 0";//已关联 if (!string.IsNullOrEmpty(timebegin)) { where += " and SLRQ >= to_date('" + Convert.ToDateTime(timebegin).ToShortDateString() + "','yyyy-mm-dd')"; } if (!string.IsNullOrEmpty(timeEnd)) { where += " and SLRQ < to_date('" + Convert.ToDateTime(timeEnd).AddDays(1).ToShortDateString() + "','yyyy-mm-dd')"; } //单位权限 //List<string> unitRoleList = GetDwBm(UserRole.DWBM, UserRole.BMBM, UserRole.JSBM); EDRS.BLL.EDRS_Report bll = new EDRS.BLL.EDRS_Report(Request); string qxWhere = " AND DWBM = '" + UserInfo.DWBM + "' AND JSBM in (" + Jsbms + ") AND BMBM in (" + Bmbms + ") AND QXLX = 0"; DataSet ds = bll.GetCaseGroupMouth(where, qxWhere, "mm", values.ToArray()); if (ds == null) { OperateLog.AddLog(OperateLog.LogType.卷宗月统计图Web, "查询卷宗月统计报表图表数据失败!", UserInfo, UserRole, Request); } else { OperateLog.AddLog(OperateLog.LogType.卷宗月统计图Web, "查询卷宗月统计报表图表数据成功!", UserInfo, UserRole, Request); } return(ds); }
/// <summary> /// Occurs after the action method is invoked. /// </summary> /// <param name="actionExecutedContext">The action executed context.</param> public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) { IFunction function = actionExecutedContext.Request.GetExecuteFunction(ServiceProvider); if (function == null || !function.OperateLogEnabled) { return; } Operator @operator = new Operator() { Ip = actionExecutedContext.Request.GetClientIpAddress() }; IIdentity identity = actionExecutedContext.ActionContext.RequestContext.Principal.Identity; if (identity.IsAuthenticated) { ClaimsIdentity user = identity as ClaimsIdentity; if (user != null) { @operator.UserId = user.GetClaimValue(ClaimTypes.NameIdentifier); @operator.Name = user.GetClaimValue(ClaimTypes.Name); @operator.NickName = user.GetClaimValue(ClaimTypes.GivenName); } } OperateLog operateLog = new OperateLog() { FunctionName = function.Name, Operator = @operator }; if (function.DataLogEnabled) { foreach (DataLog dataLog in DataLogCache.DataLogs) { operateLog.DataLogs.Add(dataLog); } } OperateLogWriter.Write(operateLog); }
/// <summary> /// 输出操作日志 /// </summary> /// <param name="operateLog">操作日志信息</param> public void Write(OperateLog operateLog) { operateLog.CheckNotNull("operateLog" ); _operateLogRepository.Insert(operateLog); }