/// <summary> /// 设置操作日志内容 /// </summary> /// <returns></returns> private static LogInfoModel InitLogInfo(string InNo) { LogInfoModel logModel = new LogInfoModel(); //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //设置公司代码 logModel.CompanyCD = userInfo.CompanyCD; //设置登陆用户ID logModel.UserID = userInfo.UserID; //设置模块ID 模块ID请在ConstUtil中定义,以便维护 logModel.ModuleID = ConstUtil.MODULE_ID_SUBDELIVERYTRANS_SAVE; //设置操作日志类型 修改 logModel.ObjectName = "SubDeliveryTrans"; //操作对象 logModel.ObjectID = InNo; //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = string.Empty; return(logModel); }
/// <summary> /// 设置操作日志内容 /// </summary> /// <returns></returns> private static LogInfoModel InitLogInfo(string wcno) { LogInfoModel logModel = new LogInfoModel(); //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //设置公司代码 logModel.CompanyCD = userInfo.CompanyCD; //设置登陆用户ID logModel.UserID = userInfo.UserID; //设置模块ID 模块ID请在ConstUtil中定义,以便维护 logModel.ModuleID = ConstUtil.MODULE_ID_SUMMARTSETTING_LIST; //设置操作日志类型 修改 logModel.ObjectName = ConstUtil.CODING_RULE_TABLE_SUMMARYSETTING; //操作对象 logModel.ObjectID = wcno; //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = string.Empty; return(logModel); }
/// <summary> /// 设置操作日志内容 /// </summary> /// <returns></returns> private static LogInfoModel InitLogInfo(string ArriveNo) { LogInfoModel logModel = new LogInfoModel(); //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //设置公司代码 logModel.CompanyCD = userInfo.CompanyCD; //设置登陆用户ID logModel.UserID = userInfo.UserID; ////设置模块ID 模块ID请在ConstUtil中定义,以便维护 //logModel.ModuleID = ConstUtil.MODULE_ID_PurchaseArrive_Add; //设置操作日志类型 修改 logModel.ObjectName = ConstUtil.CODING_RULE_TABLE_PURCHASEARRIVE; //操作对象 logModel.ObjectID = ArriveNo; //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = string.Empty; return(logModel); }
/// <summary> /// 删除文档分类 /// </summary> /// <param name="id"></param> /// <returns></returns> public static int DeleteCodeDocType(int id) { if (id == 0) { return(0); } UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; string CompanyCD = userInfo.CompanyCD; //string CompanyCD = "AAAAAA"; int isSucc = CategorySetDBHelper.DeleteCodeDocType(id); //定义变量 string remark; //成功时 if (isSucc > 0) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; } //获取删除的编号列表 //操作日志 LogInfoModel logModel = InitLogInfo(Convert.ToString(id)); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = ConstUtil.LOG_PROCESS_DELETE; logModel.ModuleID = ConstUtil.Menu_DocTypeList; logModel.ObjectID = "文档分类ID:" + id; //设置操作日志类型 修改 logModel.ObjectName = ConstUtil.CODING_RULE_TABLE_DocType; //设置操作成功标识 logModel.Remark = remark; LogDBHelper.InsertLog(logModel); return(isSucc); }
/// <summary> /// 更新币种信息 /// </summary> /// <param name="Model"></param> /// <returns></returns> public static bool UpdateCurrTypeSetting(CurrencyTypeSettingModel Model) { UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; if (Model == null) { return(false); } if (Model.CompanyCD == null) { Model.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; } try { bool succ = false; string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; LogInfoModel logModel = InitLogInfo(Model.ID.ToString()); logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; succ = CurrTypeSettingDBHelper.UpdateCurrTypeSetting(Model); if (!succ) { logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } else { logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } LogDBHelper.InsertLog(logModel); return(succ); } catch (Exception ex) { WriteSystemLog(userInfo, ex); throw ex; } }
/// <summary> /// 设置操作日志内容 /// </summary> /// <returns></returns> private static LogInfoModel InitLogInfo(string ID) { LogInfoModel logModel = new LogInfoModel(); //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //设置公司代码 logModel.CompanyCD = userInfo.CompanyCD; //设置登陆用户ID logModel.UserID = userInfo.UserID; //设置模块ID 模块ID请在ConstUtil中定义,以便维护 logModel.ModuleID = "2011702"; //设置操作日志类型 修改 logModel.ObjectName = "InputCompanyRoyalty"; //操作对象 logModel.ObjectID = ID; //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = string.Empty; return(logModel); }
/// <summary> /// 编辑日志 /// </summary> /// <param name="log">日志信息</param> private static LogInfoModel EditLogInfo(LogInfo log) { //日志数据模板定义 LogInfoModel model = new LogInfoModel(); //公司代码 model.CompanyCD = log.UserInfo.CompanyCD; //登陆用户ID model.UserID = log.UserInfo.UserID; //操作模块ID model.ModuleID = log.ModuleID; //操作单据编号 model.ObjectID = log.ObjectID; //操作对象 model.ObjectName = log.ObjectName; //涉及关键元素 model.Element = log.Element; //备注 model.Remark = log.Description; return(model); }
/// <summary> /// 新增会计科目信息 /// </summary> /// <param name="Model">科目实体</param> /// <returns>True 成功,false失败</returns> public static bool InsertAccountSubjects(AccountSubjectsModel Model) { UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; if (Model == null) { return(false); } if (Model.CompanyCD == null) { Model.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; } try { bool succ = false; string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; LogInfoModel logModel = InitLogInfo(Model.SubjectsCD); logModel.Element = ConstUtil.LOG_PROCESS_INSERT; succ = AccountSubjectsDBHelper.InsertAccountSubjects(Model); if (!succ) { logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } else { logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } LogDBHelper.InsertLog(logModel); return(succ); } catch (Exception ex) { WriteSystemLog(userInfo, ex); throw ex; } }
public static bool DeleteSubStorageIn(string IDs, string InNos, string CompanyCD) { var BIANHAO = InNos.Replace("'", "");//此方法当编号规则里不存在'时可以 LogInfoModel logModel = InitLogInfo(BIANHAO); logModel.Element = ConstUtil.LOG_PROCESS_DELETE; //设置模块ID 模块ID请在ConstUtil中定义,以便维护 logModel.ModuleID = ConstUtil.MODULE_ID_SUBSTOREMANAGER_SUBSTORAGEINITLIST; ArrayList lstDelete = new ArrayList(); SqlCommand deletePri = SubStorageDBHelper.DeleteSubStorageIn(IDs); lstDelete.Add(deletePri); SqlCommand deleteDeteil = SubStorageDBHelper.DeleteSubStorageInDetail(InNos, CompanyCD); lstDelete.Add(deleteDeteil); bool isSucc = SqlHelper.ExecuteTransWithArrayList(lstDelete); string remark; //成功时 if (isSucc) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; logModel.Remark = remark; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; logModel.Remark = remark; } LogDBHelper.InsertLog(logModel); return(isSucc); }
public static bool DeletePurchaseArriveAll(string DetailNo) { LogInfoModel logModel = InitLogInfo(DetailNo); logModel.Element = ConstUtil.LOG_PROCESS_DELETE; //设置模块ID 模块ID请在ConstUtil中定义,以便维护 logModel.ModuleID = ConstUtil.MODULE_ID_PurchaseArriveInfo; UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; string CompanyCD = userInfo.CompanyCD; //string[] sql = new string[2]; //int index = 0; //PurchaseArriveDBHelper.DeletePurchasePlanPrimary(ArriveNo, ref sql, index++); //PurchaseArriveDBHelper.DeletePurchasePlanDetail(ArriveNo, ref sql, index++); //SqlHelper.ExecuteTransForListWithSQL(sql); //bool isSucc = SqlHelper.Result.OprateCount > 0 ? true : false; bool isSucc = PurchaseArriveDBHelper.DeletePurchasePlanPrimary(DetailNo); string remark; //成功时 if (isSucc) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; logModel.Remark = remark; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; logModel.Remark = remark; } LogDBHelper.InsertLog(logModel); return(isSucc); }
/// <summary> /// 内部转账单登记凭证状态 /// </summary> /// <param name="ids"></param> /// <returns></returns> public static bool AccountInSideChangeAcco(string ids, int AttestBillID) { UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; try { bool suuc = InSideChangeAccoDBHelper.AccountInSideChangeAcco(ids, AttestBillID); string[] idsStr = ids.Split(','); for (int i = 0; i < idsStr.Length; i++) { string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; LogInfoModel logModel = InitLogInfo(idsStr[i].ToString()); logModel.ModuleID = ConstUtil.MODULE_ID_INSIDECHANGEACCO_LIST; logModel.Element = ConstUtil.LOG_PROCESS_ACCOUNT; logModel.ObjectName = ConstUtil.CODING_RULE_TABLE_INSIDECHANGEACCO; if (suuc) { logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } LogDBHelper.InsertLog(logModel); } return(suuc); } catch (Exception ex) { WriteSystemLog(userInfo, ex); throw ex; } }
/// <summary> /// 修改收款单信息 /// </summary> /// <param name="model">收款单实体</param> /// <returns>true 成功,false失败</returns> public static bool UpdateIncomeBill(IncomeBillModel model, decimal OldPrice) { if (model == null) { return(false); } model.ModifiedUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; try { bool succ = false; string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; LogInfoModel logModel = InitLogInfo(model.InComeNo, 0); logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; succ = IncomeBillDBHelper.UpdateIncomeBill(model, OldPrice); if (!succ) { logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } else { logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } LogDBHelper.InsertLog(logModel); return(succ); } catch (Exception ex) { WriteSystemLog(userInfo, 0, ex); return(false); } }
/// <summary> /// 添加收款单信息 /// </summary> /// <param name="model">收款单实体</param> /// <returns>true 成功,false失败</returns> public static bool InsertIncomeBill(IncomeBillModel model, out int ID) { ID = 0; UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; model.CompanyCD = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).CompanyCD; model.ModifiedUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; try { bool succ = false; string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; LogInfoModel logModel = InitLogInfo(model.InComeNo, 0); logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; succ = IncomeBillDBHelper.InsertIncomeBill(model, out ID); if (!succ) { logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } else { logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } LogDBHelper.InsertLog(logModel); return(succ); } catch (Exception ex) { WriteSystemLog(userInfo, 0, ex); return(false); } }
/// <summary> /// 确认调职信息 /// </summary> /// <param name="model">调职信息</param> /// <returns></returns> public static bool ConfirmEmplApplyNotifyInfo(EmplApplyNotifyModel model) { //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //设置公司代码 model.CompanyCD = userInfo.CompanyCD; model.ModifiedUserID = userInfo.UserID; //定义返回变量 bool isSucc = false; //操作日志 LogInfoModel logModel = InitLogInfo(model.NotifyNo); //更新操作 logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; isSucc = EmplApplyNotifyDBHelper.ConfirmEmplApplyNotifyInfo(model); //更新成功时 if (isSucc) { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } //更新不成功 else { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } //登陆日志 LogDBHelper.InsertLog(logModel); return(isSucc); }
/// <summary> /// 设置操作日志内容 /// </summary> /// <returns></returns> private static LogInfoModel InitLogInfo(string prodno, string TableName) { LogInfoModel logModel = new LogInfoModel(); //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //设置公司代码 logModel.CompanyCD = userInfo.CompanyCD; //设置登陆用户ID logModel.UserID = userInfo.UserID; //设置模块ID 模块ID请在ConstUtil中定义,以便维护 switch (TableName) { case "officedba.CodeReasonType": logModel.ModuleID = ConstUtil.Menu_CodeReasonType; logModel.ObjectName = ConstUtil.CODING_RULE_TABLE_CodeReasonType; break; case "officedba.CodeFeeType": logModel.ModuleID = ConstUtil.Menu_CodeFeeType; logModel.ObjectName = ConstUtil.CODING_RULE_TABLE_CodeFeeType; break; case "officedba.CodeUnitType": logModel.ModuleID = ConstUtil.Menu_CodeUnitType; logModel.ObjectName = ConstUtil.CODING_RULE_TABLE_CodeUnitType; break; } //设置操作日志类型 修改 //操作对象 logModel.ObjectID = prodno; //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = string.Empty; return(logModel); }
/// <summary> /// 删除机构岗位信息 /// </summary> /// <param name="quarterID">组织机构ID</param> /// <returns></returns> public static bool DeleteDeptQuarterInfo(string quarterID) { UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //设置公司代码 string CompanyCD = userInfo.CompanyCD; //执行删除操作 bool isSucc = DeptQuarterDBHelper.DeleteQuarterInfo(quarterID, CompanyCD); //定义变量 string remark; //成功时 if (isSucc) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; } //操作日志 LogInfoModel logModel = InitLogInfo(quarterID); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = ConstUtil.LOG_PROCESS_DELETE; //设置操作成功标识 logModel.Remark = remark; //登陆日志 LogDBHelper.InsertLog(logModel); return(isSucc); }
public static bool DeleteProviderInfoAll(string CustNo, string CompanyCD) { LogInfoModel logModel = InitLogInfo(CustNo); logModel.Element = ConstUtil.LOG_PROCESS_DELETE; //设置模块ID 模块ID请在ConstUtil中定义,以便维护 logModel.ModuleID = ConstUtil.MODULE_ID_PROVIDERINFOINFO; UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //string[] sql = new string[3]; //int index = 0; SqlCommand[] cmdList = new SqlCommand[3]; cmdList [0] = ProviderInfoDBHelper.DeleteProviderInfo(CustNo, CompanyCD); //供应商信息 cmdList[1] = ProviderInfoDBHelper.DeleteProviderLinkMan(CustNo, CompanyCD); //供应商联系人 cmdList[2] = ProviderInfoDBHelper.DeleteProviderProduct(CustNo, CompanyCD); //供应商产品 SqlHelper.ExecuteTransForList(cmdList); bool isSucc = SqlHelper.Result.OprateCount > 0 ? true : false; string remark; //成功时 if (isSucc) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; logModel.Remark = remark; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; logModel.Remark = remark; } LogDBHelper.InsertLog(logModel); return(isSucc); }
/// <summary> /// 付款单反确认 /// </summary> /// <param name="ids"></param> /// <returns></returns> public static bool AntiAutidt(string ids) { UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; try { string loginUserID = ((UserInfoUtil)SessionUtil.Session["UserInfo"]).UserID; string[] idsStr = ids.Split(','); bool suuc = PayBillDBHelper.AntiAutidt(ids); for (int i = 0; i < idsStr.Length; i++) { LogInfoModel logModel = InitLogInfo(idsStr[i].ToString()); logModel.ModuleID = ConstUtil.MODULE_ID_PAYBILL_LIST; logModel.Element = ConstUtil.LOG_PROCESS_ANTIAUDIT; logModel.ObjectName = ConstUtil.CODING_RULE_TABLE_PAYBILL; if (suuc) { logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } LogDBHelper.InsertLog(logModel); } return(suuc); } catch (Exception ex) { WriteSystemLog(userInfo, ex); throw ex; } }
public static bool InsertPerformenceTemplate(IList <PerformanceTemplateElemModel> modeList, PerformanceTemplateModel model) { UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; bool isSucc = false; //操作日志 LogInfoModel logModel = InitLogInfo(modeList[0].ModifiedUserID); //更新 if (ConstUtil.EDIT_FLAG_UPDATE.Equals(modeList[0].EditFlag)) { try { logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; //执行更新操作 // isSucc = PerformanceTemplateEmpDBHelper.UpdatePerformenceTempElm(modeList, templateList); if (PerformanceTemplateDBHelper.UpdatePerformenceTemplate(model)) { if (PerformanceTemplateDBHelper.DeletePerformenceTemElem(model)) { if (PerformanceTemplateDBHelper.InsertPerformenceTempElm(modeList)) { isSucc = true; } else { isSucc = false; } } else { isSucc = false; } } else { isSucc = false; } logModel.ObjectID = modeList[0].ModifiedUserID; } catch (Exception ex) { //输出系统日志 WriteSystemLog(userInfo, ex); } } //插入 else { try { logModel.Element = ConstUtil.LOG_PROCESS_INSERT; //执行插入操作 if (PerformanceTemplateDBHelper.InsertPerformenceTemplate(model)) { if (PerformanceTemplateDBHelper.InsertPerformenceTempElm(modeList)) { isSucc = true; } else { isSucc = false; } } else { isSucc = false; } logModel.ObjectID = modeList[0].ModifiedUserID; } catch (Exception ex) { //输出系统日志 WriteSystemLog(userInfo, ex); } } //更新成功时 if (isSucc) { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } //更新不成功 else { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } //登陆日志 LogDBHelper.InsertLog(logModel); return(isSucc); }
/// <summary> /// 根据收文ID修改收文信息 /// </summary> /// <param name="DocReceiveM">收文信息</param> /// <returns>bool值</returns> public static bool UpdateDocReceive(DocReceiveModel DocReceiveM) { UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; LogInfoModel logModel = new LogInfoModel(); //操作日志 bool isSucc = false; //定义返回变量 #region 设置操作日志内容 //设置公司代码 logModel.CompanyCD = userInfo.CompanyCD; //设置登陆用户ID logModel.UserID = userInfo.UserID; //设置模块ID 模块ID在ConstUtil中定义,以便维护 logModel.ModuleID = ConstUtil.MODULE_ID_DOCRECEIVE_LIST; //操作单据编号 编号 logModel.ObjectID = DocReceiveM.ReceiveDocNo; //操作对象 操作的表信息 logModel.ObjectName = ConstUtil.TABLE_NAME_DOCRECEIVE; //涉及关键元素 涉及其他业务、表关系 logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; //备注 操作类型 logModel.Remark = ConstUtil.LOG_PROCESS_UPDATE; #endregion try { isSucc = DocReceiveDBHelper.UpdateDocReceive(DocReceiveM); } catch (System.Exception ex) { #region 操作失败时记录日志到文件 //定义变量 LogInfo logSys = new LogInfo(); //设置日志类型 需要指定为系统日志 logSys.Type = LogInfo.LogType.SYSTEM; //指定系统日志类型 出错信息 logSys.SystemKind = LogInfo.SystemLogKind.SYSTEM_ERROR; //指定登陆用户信息 logSys.UserInfo = userInfo; //设定模块ID logSys.ModuleID = ConstUtil.MODULE_ID_DOCRECEIVE_LIST; //描述 logSys.Description = ex.ToString(); //输出日志 LogUtil.WriteLog(logSys); #endregion } if (isSucc)//操作成功 { logModel.Remark += "成功"; } else//操作失败 { logModel.Remark += "失败"; } //记录日志 LogDBHelper.InsertLog(logModel); return(isSucc); }
/// <summary> /// 根据收文ID删除收文信息 /// </summary> /// <param name="ReceiveID">收文ID</param> /// <returns>操作记录数</returns> public static int DelDocReceive(string[] ReceiveID) { UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; LogInfoModel logModel = new LogInfoModel(); //操作日志 int isSucc = 0; //定义返回变量 #region 设置操作日志内容 //设置公司代码 logModel.CompanyCD = userInfo.CompanyCD; //设置登陆用户ID logModel.UserID = userInfo.UserID; //设置模块ID 模块ID在ConstUtil中定义,以便维护 logModel.ModuleID = ConstUtil.MODULE_ID_DOCRECEIVE_LIST; System.Text.StringBuilder sb = new System.Text.StringBuilder(); for (int i = 0; i < ReceiveID.Length; i++) { sb.Append(ReceiveID[i] + ";"); } //操作单据编号 联系人姓名 logModel.ObjectID = "收文ID:" + sb.ToString(); //操作对象 操作的表信息 logModel.ObjectName = ConstUtil.TABLE_NAME_DOCRECEIVE; //涉及关键元素 涉及其他业务、表关系 logModel.Element = ConstUtil.LOG_PROCESS_DELETE; //备注 操作类型 logModel.Remark = ConstUtil.LOG_PROCESS_DELETE; #endregion try { isSucc = LinkManDBHelper.DelLinkInfo(ReceiveID, ConstUtil.TABLE_NAME_DOCRECEIVE); } catch (System.Exception ex) { #region 操作失败时记录日志到文件 //定义变量 LogInfo logSys = new LogInfo(); //设置日志类型 需要指定为系统日志 logSys.Type = LogInfo.LogType.SYSTEM; //指定系统日志类型 出错信息 logSys.SystemKind = LogInfo.SystemLogKind.SYSTEM_ERROR; //指定登陆用户信息 logSys.UserInfo = userInfo; //设定模块ID logSys.ModuleID = ConstUtil.MODULE_ID_DOCRECEIVE_LIST; //描述 logSys.Description = ex.ToString(); //输出日志 LogUtil.WriteLog(logSys); #endregion } if (isSucc > 0)//操作成功 { logModel.Remark += "成功"; } else//操作失败 { logModel.Remark += "失败"; } //记录日志 LogDBHelper.InsertLog(logModel); return(isSucc); }
public static string UpdateStorageCheckStatus(int stype, Model.Office.StorageManager.StorageCheck sc) { // return "1|单据确认成功"; return "2|结单成功"; //定义返回变量 string res = string.Empty; /* * 定义日志内容变量 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件 */ //获取当前用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //执行操作 try { //执行操作 res = XBase.Data.Office.StorageManager.StorageCheckDBHelper.UpdateStorageCheckStatus(stype, sc); } catch (Exception ex) { //输出日志 WriteSystemLog(userInfo, ex); } //定义变量 string remark; //成功时 if (res.Split('|')[0] == "1" || res.Split('|')[0] == "2") { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; } //操作日志 LogInfoModel logModel = InitLogInfo(sc.CheckNo); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 if (stype == 1) { logModel.Element = ConstUtil.LOG_PROCESS_CONFIRM; } else if (stype == 2) { logModel.Element = ConstUtil.LOG_PROCESS_COMPLETE; } else if (stype == 3) { logModel.Element = ConstUtil.LOG_PROCESS_CONCELCOMPLETE; } else if (stype == 4) { logModel.Element = ConstUtil.LOG_PROCESS_UNCONFIRM; } //设置操作成功标识 logModel.Remark = remark; //登陆日志 LogDBHelper.InsertLog(logModel); return(res); }
public async Task Execute(IJobExecutionContext context) { Stopwatch stopwatch = Stopwatch.StartNew(); var url = context.JobDetail.JobDataMap.GetString(Constant.RequestUrl); url = url?.IndexOf("http") == 0 ? url : "http://" + url; var requestParameters = context.GetString(Constant.RequestParameters); var logs = context.JobDetail.JobDataMap[Constant.LogList] as List <string> ?? new List <string>(); var headersString = context.GetString(Constant.Headers); var headers = headersString != null?JsonConvert.DeserializeObject <Dictionary <string, string> >(headersString?.Trim()) : null; var requestType = (HttpMethod)Enum.Parse(typeof(HttpMethod), context.GetString(Constant.RequestType)); var loginfo = new LogInfoModel { Url = url, BeginTime = DateTime.Now, RequestType = requestType, Parameters = requestParameters, JobName = $"{context.JobDetail.Key.Group}.{context.JobDetail.Key.Name}", }; try { var http = HttpHelper.Instance; var response = new HttpResponseMessage(); switch (requestType) { case HttpMethod.Get: response = await http.GetAsync(url, headers); break; case HttpMethod.Post: response = await http.PostAsync(url, requestParameters, headers); break; case HttpMethod.Put: response = await http.PutAsync(url, requestParameters, headers); break; case HttpMethod.Delete: response = await http.DeleteAsync(url, headers); break; } var result = HttpUtility.HtmlEncode(await response.Content.ReadAsStringAsync()); stopwatch.Stop(); long seconds = stopwatch.Elapsed.Ticks; loginfo.EndTime = DateTime.Now; loginfo.Seconds = seconds; loginfo.Result = result.PadLeft(200); if (!response.IsSuccessStatusCode) { loginfo.ErrorMsg = result.PadLeft(200); context.JobDetail.JobDataMap[Constant.Exception] = this.SerializeObject(loginfo); } else { using (var dbContext = new QuartzContext()) { dbContext.QuartzLog.Add(new QuartzLog() { CreateTime = DateTime.Now, LogLevel = LogLevel.Info, ExcuteTime = new DateTime(stopwatch.Elapsed.Ticks), Message = result, Name = context.JobDetail.Key.Name, Group = context.JobDetail.Key.Group, }); dbContext.SaveChanges(); } } } catch (Exception ex) { stopwatch.Stop(); double seconds = stopwatch.Elapsed.TotalSeconds; loginfo.ErrorMsg = ex.Message + ex.StackTrace; context.JobDetail.JobDataMap[Constant.Exception] = this.SerializeObject(loginfo); loginfo.Seconds = seconds; } finally { logs.Add(this.SerializeObject(loginfo)); context.JobDetail.JobDataMap[Constant.LogList] = logs; } }
/// <summary> /// 编辑面试评测模板信息 /// </summary> /// <param name="model">保存信息</param> /// <returns></returns> public static bool SaveRectCheckTemplateInfo(RectCheckTemplateModel model) { //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //设置公司代码 model.CompanyCD = userInfo.CompanyCD; //设置最后修改者 model.ModifiedUserID = userInfo.UserID; //定义返回变量 bool isSucc = false; //操作日志 LogInfoModel logModel = InitLogInfo(model.TemplateNo); //更新 if (ConstUtil.EDIT_FLAG_UPDATE.Equals(model.EditFlag)) { try { logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; //执行更新操作 isSucc = RectCheckTemplateDBHelper.UpdateRectTemplateInfo(model); } catch (Exception ex) { //输出系统日志 WriteSystemLog(userInfo, ex); } } //插入 else { try { logModel.Element = ConstUtil.LOG_PROCESS_INSERT; //执行插入操作 isSucc = RectCheckTemplateDBHelper.InsertRectTemplateInfo(model); } catch (Exception ex) { //输出系统日志 WriteSystemLog(userInfo, ex); } } //更新成功时 if (isSucc) { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } //更新不成功 else { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } //登陆日志 LogDBHelper.InsertLog(logModel); return(isSucc); }
public static bool UpdateStatus(SubDeliverySend model, int stype) { //定义返回变量 bool res = false; /* * 定义日志内容变量 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件 */ //获取当前用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //执行操作 try { //执行操作 res = XBase.Data.Office.LogisticsDistributionManager.SubDeliverySendSaveDBHelper.UpdateStatus(model, stype); } catch (Exception ex) { //输出日志 WriteSystemLog(userInfo, ex); } //定义变量 string remark; //成功时 if (res) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; } //操作日志 LogInfoModel logModel = InitLogInfo(model.SendNo); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 string msg = string.Empty; switch (stype) { case 1: /*确认*/ msg = ConstUtil.LOG_PROCESS_CONFIRM; break; case 2: /*结单*/ msg = ConstUtil.LOG_PROCESS_COMPLETE; break; case 3: /*取消结单*/ msg = ConstUtil.LOG_PROCESS_CONCELCOMPLETE; break; case 4: /*取消确认*/ msg = ConstUtil.LOG_PROCESS_UNCONFIRM; break; } logModel.Element = msg;; //设置操作成功标识 logModel.Remark = remark; //登陆日志 LogDBHelper.InsertLog(logModel); return(res); }
/// <summary> /// 删除文档分类 /// </summary> /// <param name="id"></param> /// <returns></returns> public static int DeleteCodeBigType(int id, string TableName) { if (id == 0) { return(0); } UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; string CompanyCD = userInfo.CompanyCD; //string CompanyCD = "AAAAAA"; int isSucc = CategorySetDBHelper.DeleteCodeBigType(id, TableName); //定义变量 string remark; //成功时 if (isSucc > 0) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; } //获取删除的编号列表 //操作日志 LogInfoModel logModel = InitLogInfo(Convert.ToString(id)); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = ConstUtil.LOG_PROCESS_DELETE; if (TableName == "officedba.CodeCompanyType") { logModel.ModuleID = ConstUtil.Menu_CompanyType; logModel.ObjectID = "往来单位ID:" + id; logModel.ObjectName = ConstUtil.CODING_RULE_TABLE_CompanyType; } else if (TableName == "officedba.CodeProductType") { logModel.ModuleID = ConstUtil.Menu_ProductType; logModel.ObjectID = "物品分类ID:" + id; logModel.ObjectName = ConstUtil.CODING_RULE_TABLE_ProductType; } //设置操作日志类型 修改 //设置操作成功标识 logModel.Remark = remark; //登陆日志 LogDBHelper.InsertLog(logModel); return(isSucc); //if (id == 0) // return 0; //try //{ // return CategorySetDBHelper.DeleteCodeBigType(id,TableName); //} //catch (Exception ex) //{ // throw; //} }
public static string DelStorageTransfer(string[] ID) { //if (XBase.Data.Office.StorageManager.StorageTransferDBHelper.DelStorageTransfer(ID)) // return "2"; //else // return "1"; bool flag = false; //string res = string.Empty; /* * 定义日志内容变量 * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库 * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件 */ //获取当前用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //执行操作 try { //执行操作 flag = XBase.Data.Office.StorageManager.StorageTransferDBHelper.DelStorageTransfer(ID); } catch (Exception ex) { //输出日志 WriteSystemLog(userInfo, ex); } //定义变量 string remark; //成功时 if (flag) { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_SUCCESS; } else { //设置操作成功标识 remark = ConstUtil.LOG_PROCESS_FAILED; } string idInfo = string.Empty; foreach (string str in ID) { idInfo += str + ","; } //操作日志 LogInfoModel logModel = InitLogInfo(idInfo); //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空 logModel.Element = ConstUtil.LOG_PROCESS_DELETE; //设置操作成功标识 logModel.Remark = remark; //登陆日志 LogDBHelper.InsertLog(logModel); if (flag) { return("2"); } else { return("1"); } }
public async Task Execute(IJobExecutionContext context) { var maxLogCount = 20; //最多保存日志数量 var warnTime = 20; //接口请求超过多少秒记录警告日志 //获取相关参数 var requestUrl = context.JobDetail.JobDataMap.GetString(Constant.REQUESTURL); requestUrl = requestUrl?.IndexOf("http") == 0 ? requestUrl : "http://" + requestUrl; var requestParameters = context.JobDetail.JobDataMap.GetString(Constant.REQUESTPARAMETERS); var headersString = context.JobDetail.JobDataMap.GetString(Constant.HEADERS); var mailMessage = (MailMessageEnum)int.Parse(context.JobDetail.JobDataMap.GetString(Constant.MAILMESSAGE) ?? "0"); var headers = headersString != null?JsonConvert.DeserializeObject <Dictionary <string, string> >(headersString?.Trim()) : null; var requestType = (RequestTypeEnum)int.Parse(context.JobDetail.JobDataMap.GetString(Constant.REQUESTTYPE)); Stopwatch stopwatch = new Stopwatch(); stopwatch.Restart(); // 开始监视代码运行时间 HttpResponseMessage response = new HttpResponseMessage(); var loginfo = new LogInfoModel(); loginfo.Url = requestUrl; loginfo.BeginTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); loginfo.RequestType = requestType.ToString(); loginfo.Parameters = requestParameters; loginfo.JobName = $"{context.JobDetail.Key.Group}.{context.JobDetail.Key.Name}"; var logs = context.JobDetail.JobDataMap[Constant.LOGLIST] as List <string> ?? new List <string>(); if (logs.Count >= maxLogCount) { logs.RemoveRange(0, logs.Count - maxLogCount); } try { var http = HttpHelper.Instance; switch (requestType) { case RequestTypeEnum.Get: response = await http.GetAsync(requestUrl, headers); break; case RequestTypeEnum.Post: response = await http.PostAsync(requestUrl, requestParameters, headers); break; case RequestTypeEnum.Put: response = await http.PutAsync(requestUrl, requestParameters, headers); break; case RequestTypeEnum.Delete: response = await http.DeleteAsync(requestUrl, headers); break; } var result = HttpUtility.HtmlEncode(await response.Content.ReadAsStringAsync()); stopwatch.Stop(); // 停止监视 double seconds = stopwatch.Elapsed.TotalSeconds; //总秒数 loginfo.EndTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); loginfo.Seconds = seconds; loginfo.Result = $"<span class='result'>{result.MaxLeft(1000)}</span>"; if (!response.IsSuccessStatusCode) { loginfo.ErrorMsg = $"<span class='error'>{result.MaxLeft(3000)}</span>"; await ErrorAsync(loginfo.JobName, new Exception(result.MaxLeft(3000)), JsonConvert.SerializeObject(loginfo), mailMessage); context.JobDetail.JobDataMap[Constant.EXCEPTION] = JsonConvert.SerializeObject(loginfo); } else { try { //这里需要和请求方约定好返回结果约定为HttpResultModel模型 var httpResult = JsonConvert.DeserializeObject <HttpResultModel>(HttpUtility.HtmlDecode(result)); if (!httpResult.IsSuccess) { loginfo.ErrorMsg = $"<span class='error'>{httpResult.ErrorMsg}</span>"; await ErrorAsync(loginfo.JobName, new Exception(httpResult.ErrorMsg), JsonConvert.SerializeObject(loginfo), mailMessage); context.JobDetail.JobDataMap[Constant.EXCEPTION] = JsonConvert.SerializeObject(loginfo); } else { await InformationAsync(loginfo.JobName, JsonConvert.SerializeObject(loginfo), mailMessage); } } catch (Exception) { await InformationAsync(loginfo.JobName, JsonConvert.SerializeObject(loginfo), mailMessage); } } } catch (Exception ex) { stopwatch.Stop(); // 停止监视 double seconds = stopwatch.Elapsed.TotalSeconds; //总秒数 loginfo.ErrorMsg = $"<span class='error'>{ex.Message} {ex.StackTrace}</span>"; context.JobDetail.JobDataMap[Constant.EXCEPTION] = JsonConvert.SerializeObject(loginfo); loginfo.Seconds = seconds; await ErrorAsync(loginfo.JobName, ex, JsonConvert.SerializeObject(loginfo), mailMessage); } finally { logs.Add($"<p>{JsonConvert.SerializeObject(loginfo)}</p>"); context.JobDetail.JobDataMap[Constant.LOGLIST] = logs; double seconds = stopwatch.Elapsed.TotalSeconds; //总秒数 if (seconds >= warnTime) //如果请求超过20秒,记录警告日志 { await WarningAsync(loginfo.JobName, "耗时过长 - " + JsonConvert.SerializeObject(loginfo), mailMessage); } } }
/// <summary> /// 编辑调职信息 /// </summary> /// <param name="model">调职信息</param> /// <returns></returns> public static bool SaveEmplApplyNotifyInfo(EmplApplyNotifyModel model) { //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //设置公司代码 model.CompanyCD = userInfo.CompanyCD; model.ModifiedUserID = userInfo.UserID; //定义返回变量 bool isSucc = false; //操作日志 LogInfoModel logModel = InitLogInfo(model.NotifyNo); //更新 if (!string.IsNullOrEmpty(model.ID)) { try { logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; //执行更新操作 isSucc = EmplApplyNotifyDBHelper.UpdateEmplApplyNotifyInfo(model); } catch (Exception ex) { //输出系统日志 WriteSystemLog(userInfo, ex); } } //插入 else { try { logModel.Element = ConstUtil.LOG_PROCESS_INSERT; //执行插入操作 isSucc = EmplApplyNotifyDBHelper.InsertEmplApplyNotifyInfo(model); } catch (Exception ex) { //输出系统日志 WriteSystemLog(userInfo, ex); } } //更新成功时 if (isSucc) { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } //更新不成功 else { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } //登陆日志 LogDBHelper.InsertLog(logModel); return(isSucc); }
public static bool SaveBetterInfo(PerformanceBetterModel model, IList <PerformanceBetterDetailModel> modleSummaryList) { //获取登陆用户信息 UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"]; //定义返回变量 bool isSucc = false; //操作日志 LogInfoModel logModel = InitLogInfo(model.PlanNo); try { logModel.Element = ConstUtil.LOG_PROCESS_UPDATE; //执行更新操作 /// isSucc = PerformanceTaskDBHelper.UpdatePerTaskInfo(model, modellist, modleSummaryList); if (model.EditFlag == ConstUtil.EDIT_FLAG_INSERT) { if (PerformanceBetterDBHelper.InsertBetterInfo(model)) { if (PerformanceBetterDBHelper.InsertBetterDetaiInfo(modleSummaryList)) { isSucc = true; } else { isSucc = false; } } else { isSucc = false; } } else { if (PerformanceBetterDBHelper.UpdateBetterInfobyPlanNo(model)) { if (PerformanceBetterDBHelper.DeleteBetterDetatilInfobyPlanNo(model.PlanNo, model.CompanyCD)) { if (PerformanceBetterDBHelper.InsertBetterDetaiInfo(modleSummaryList)) { isSucc = true; } else { isSucc = false; } } else { isSucc = false; } } else { isSucc = false; } } } catch (Exception ex) { //输出系统日志 WriteSystemLog(userInfo, ex); } //更新成功时 if (isSucc) { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_SUCCESS; } //更新不成功 else { //设置操作成功标识 logModel.Remark = ConstUtil.LOG_PROCESS_FAILED; } //登陆日志 LogDBHelper.InsertLog(logModel); return(isSucc); }