/// <summary> /// 增加一条异常信息表数据 /// </summary> /// <param name="model">要插入的异常信息表实体</param> /// <returns>插入生成的最新主键值</returns> public int Add(ExceptionInfoEntity model) { SqlParameter param_id = new SqlParameter(); param_id.ParameterName = "@id"; param_id.SqlDbType = SqlDbType.Int; param_id.Direction = ParameterDirection.Output; SqlParameter[] parameters = { new SqlParameter("@exceptionLevel", SqlDbType.NVarChar, 2), new SqlParameter("@exceptionSource", SqlDbType.NVarChar, 2), new SqlParameter("@exceptionFun", SqlDbType.NVarChar, 100), new SqlParameter("@sourceData", SqlDbType.NVarChar, -1), new SqlParameter("@exceptionMsg", SqlDbType.NVarChar, -1), new SqlParameter("@exceptionData", SqlDbType.NVarChar, -1), new SqlParameter("@creator", SqlDbType.NVarChar, 256), new SqlParameter("@host", SqlDbType.NVarChar, 40), param_id }; parameters[0].Value = model.exceptionLevel; parameters[1].Value = model.exceptionSource; parameters[2].Value = model.exceptionFun; parameters[3].Value = model.sourceData; parameters[4].Value = model.exceptionMsg; parameters[5].Value = model.exceptionData; parameters[6].Value = model.creator; parameters[7].Value = model.host; int rowsAffected; SQLServerHelper.RunProcedure("uspWip_AddExceptionInfo", parameters, out rowsAffected); return((int)parameters[parameters.Length - 1].Value); }
public ReturnBody <AuthorizationUserModel> GetAuthorizationuser(AuthorizationUserModel model) { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <AuthorizationUserModel>(namespaceName, "GetAuthorizationuser", model); try { #region 验证 if (model == null || string.IsNullOrEmpty(model.s95id)) { exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY; return(BLLHelpler.GetReturnBody <AuthorizationUserModel>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg)); } #endregion var retModel = Authorizationbll.GetAuthorization(model.s95id); if (retModel == null) { exception.exceptionMsg = "没有找到相关用户"; return(BLLHelpler.GetReturnBody <AuthorizationUserModel>(ResCode.FAILURE, exception.exceptionMsg)); } return(BLLHelpler.GetReturnBody <AuthorizationUserModel>(ResCode.SUCCESS, ResMsg.SUCCESS, retModel)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <AuthorizationUserModel>(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
/// <summary> /// 获取单个打印配置 /// </summary> /// <param name="model"></param> /// <returns></returns> public ReturnBody <PrintConfigEntity> GetSinglePrintConfig(QueryPrintConfigParam model) { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <QueryPrintConfigParam>(namespaceName, "GetSinglePrintConfig", model); try { #region 验证 if (model == null || string.IsNullOrEmpty(model.printType)) { exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY; return(BLLHelpler.GetReturnBody <PrintConfigEntity>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg, exception)); } #endregion var retModel = printConfigBLL.GetModel(model.printType.ToString()); if (retModel == null) { exception.exceptionMsg = "没有找到数据"; return(BLLHelpler.GetReturnBody <PrintConfigEntity>(ResCode.FAILURE, exception.exceptionMsg, exception)); } return(BLLHelpler.GetReturnBody <PrintConfigEntity>(ResCode.SUCCESS, ResMsg.SUCCESS, retModel)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <PrintConfigEntity>(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
/// <summary> /// 获取需要打印的数据列表 /// </summary> /// <param name="tempName">模板名称</param> /// <returns></returns> public List <PrintInfoModel> GetNeedPrintList() { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <string>(namespaceName, "GetNeedPrintList", "", "", "", ExceptionSource.WIPReceive, ExceptionLevel.BusinessError, WipSource.PrintService); List <PrintInfoModel> printList = null; try { string printTypeStr = string.Join(",", GetPrintTypeList()); DataSet ds = dal.GetNeedPrintList(printTypeStr); printList = DataTableToListForNeedPrint(ds.Tables[0]); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); //判断ex的内容,如果是数据库超时,则过滤,直接光写文本日志 if (ex.Message.Contains("信号灯超时时间已到") || ex.Message.Contains("未找到或无法访问服务器") || ex.Message.Contains("超时时间已到")) { Log4netHelper.WriteErrorLogByLog4Net(typeof(PrintConfigBLL), ex.Message, ex); } else { WipLogHelper.WriteExceptionInfo(exception); } } return(printList); }
private string namespaceName = "WIP_Test.TestService";//命名空间 /// <summary> /// 加解密数据 /// </summary> /// <param name="param"></param> /// <returns></returns> public ReturnBody <string> GetEncryptData(GetEncryptData param) { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <GetEncryptData>(namespaceName, "GetEncryptData", param); try { string result = ""; if (param.isEncrypt == "0") {//加密 result = DESEncryptHelper.Encrypt(param.value); } else if (param.isEncrypt == "1") { //解密 result = DESEncryptHelper.Decrypt(param.value); } else { return(BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE, "是否解密值错误")); } return(BLLHelpler.GetReturnBody <string>(ResCode.SUCCESS, ResMsg.SUCCESS, result)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE, exception, "出现错误:" + ex.Message)); } }
/// <summary> /// 获取单个代码项表 /// </summary> /// <param name="model"></param> /// <returns></returns> public ReturnBody <CodeItemsEntity> GetSingleCodeItems(QueryCodeItemsModel model) { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <QueryCodeItemsModel>(namespaceName, "GetSingleCodeItems", model); try { #region 验证 if (model == null || string.IsNullOrEmpty(model.setCode) || string.IsNullOrEmpty(model.code)) { exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY; return(BLLHelpler.GetReturnBody <CodeItemsEntity>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg, exception)); } #endregion var retModel = codeItemsBLL.GetModel(model.setCode, model.code); if (retModel == null) { exception.exceptionMsg = "没有找到数据"; return(BLLHelpler.GetReturnBody <CodeItemsEntity>(ResCode.FAILURE, exception.exceptionMsg, exception)); } return(BLLHelpler.GetReturnBody <CodeItemsEntity>(ResCode.SUCCESS, ResMsg.SUCCESS, retModel)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <CodeItemsEntity>(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
/// <summary> /// 查询用户登录记录列表 /// </summary> /// <param name="userName">用户名</param> /// <returns>用户登录记录列表</returns> public ReturnBody <List <UserLoginLogEntity> > GetUserLoginLogList(string userName) { ReturnBody <List <UserLoginLogEntity> > ret = null; //请求信息没记录下来 ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <string>(namespaceName, "GetUserLoginLogList", userName, "", ""); try {//校验 IValidateFactory factory = new UserLoginLogValiFactory(); IValidate validate = factory.CreateValidate(); ret = validate.Validate <string, List <UserLoginLogEntity> >(userName, ref exception); if (ret != null) { return(ret); } ret = new ReturnBody <List <UserLoginLogEntity> >(); ret.resCode = ResCode.SUCCESS; ret.resData = IOCContainer.Container.GetExport <IUserLoginLogBLL>("UserLoginLog").Value.GetUserLoginLogList(userName); } catch (Exception ex) {//异常信息没有记录下来 WipLogHelper.GetExceptionInfoForError(ex, ref exception); WipLogHelper.WriteExceptionInfo(exception); ret.resCode = ResCode.FAILURE; ret.resMsg = ex.Message; } return(ret); }
public WIP_Models.ReturnBody <T2> Validate <T1, T2>(T1 param, ref ExceptionInfoEntity exception) { ReturnBody <T2> retBody = null; #region 验证 retBody = ValidateDataHelper.CommonValidateIsNULL <T1, T2>(param, ref exception); if (retBody != null) { return(retBody); } string _userName = param as string; if (string.IsNullOrEmpty(_userName)) { retBody = new ReturnBody <T2>() { resCode = ResCode.PARAMETERNOEMPTY, resMsg = "查询登录名不能为空" }; } #endregion return(retBody); }
private void PostMail(MailBaseData _MailBaseData, string recipientsAddressRange, string MailSubject, string Describe, string File_Path) { MailSubject = MailSubject + " (" + WIPCommon.ForamtCurDateTime() + ")";//任务名称 Describe += "<br/><br/>"; Describe += "消息来自主机:" + WIPCommon.GetHostName() + "<br/>"; Describe += "主机发生时间:" + WIPCommon.ForamtCurDateTime() + "<br/>"; IDictionary <string, object> logDict = new Dictionary <string, object>(); logDict.Add("recipientsAddressRange", recipientsAddressRange); logDict.Add("MailSubject", MailSubject); logDict.Add("Describe", Describe); logDict.Add("File_Path", File_Path); ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <IDictionary <string, object> >(namespaceName, "MailSending", logDict, "", ""); try { if (File_Path == null) { File_Path = ""; } SMTPHelper.MailSending(_MailBaseData, _recipientsAddressRange, MailSubject, Describe.ToString(), ""); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); WipLogHelper.WriteExceptionInfo(exception); } }
public WIP_Models.ReturnBody <T2> Validate <T1, T2>(T1 param, ref ExceptionInfoEntity exception) { ReturnBody <T2> retBody = null; #region 验证 retBody = ValidateDataHelper.CommonValidateIsNULL <T1, T2>(param, ref exception); if (retBody != null) { return(retBody); } /* * ValidateInStoreParam _param = param as ValidateInStoreParam; * * List<ValidateModel> columnsList = new List<ValidateModel>() { * new ValidateModel(){ ChinaName="流转卡号", DataType=typeof(string), DataValue=_param.processCardNumber }, * new ValidateModel(){ ChinaName="设备号", DataType=typeof(string), DataValue=_param.equipId }, * new ValidateModel(){ ChinaName="时间戳", DataType=typeof(DateTime), DataValue=_param.timestamp } * }; * retBody = ValidateDataHelper.CommonValidate<T1, T2>(param, ref exception, columnsList); * if (retBody != null) * { * return retBody; * } * //*/ #endregion return(retBody); }
public ResponseUpdater(bool execResult, ExceptionInfoEntity exception) { _ResponseUpdaterRet = new ResponseUpdaterRet() { execResult = execResult, exception = exception }; }
/// <summary> /// 获取代码集表列表 /// </summary> /// <returns></returns> public ReturnBody <List <CodeSetsModel> > GetAllCodeSets() { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <string>(namespaceName, "GetAllCodeSets", ""); try { List <CodeSetsModel> list = codeSetsBLL.GetModelList(); return(BLLHelpler.GetReturnBody <List <CodeSetsModel> >(ResCode.SUCCESS, ResMsg.SUCCESS, list)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <List <CodeSetsModel> >(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
/// <summary> /// 获取打印配置列表(分页) /// </summary> /// <returns></returns> public ReturnBody <PageResultModel <PrintConfigModel> > GetPrintConfigList(QueryPrintConfigParam queryModel) { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <QueryPrintConfigParam>(namespaceName, "GetPrintConfigList", queryModel); try { PageResultModel <PrintConfigModel> list = printConfigBLL.GetModelListForPage(queryModel); return(BLLHelpler.GetReturnBody <PageResultModel <PrintConfigModel> >(ResCode.SUCCESS, ResMsg.SUCCESS, list)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <PageResultModel <PrintConfigModel> >(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
/// <summary> /// 生成token /// </summary> /// <param name="user"></param> /// <returns></returns> public ReturnBody <string> GenerateToken(GenerateTokenParam user) { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <GenerateTokenParam>(namespaceName, "GenerateToken", user); try { string token = JwtHelp.GenerateToken(user.Name, null, user.ExpDays); return(BLLHelpler.GetReturnBody <string>(ResCode.SUCCESS, ResMsg.SUCCESS, token)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE, exception, "出现错误:" + ex.Message)); } }
/// <summary> /// 获取邮件类别列表 /// </summary> /// <returns></returns> public ReturnBody <List <MailRuleEntity> > GetMailRuleList() { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <string>(namespaceName, "GetMailRuleList", "", "", ""); try { List <MailRuleEntity> list = MailRuleBLL.GetInstance().GetMailRuleList(); return(BLLHelpler.GetReturnBody <List <MailRuleEntity> >(ResCode.SUCCESS, ResMsg.SUCCESS, list)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <List <MailRuleEntity> >(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
/// <summary> /// 获取指定代码集的代码项表列表 /// </summary> /// <returns></returns> public ReturnBody <List <CodeSetsModel> > GetAllCodeItemsByCodeSet(GetAllCodeItemsByCodeSetParam param) { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <GetAllCodeItemsByCodeSetParam>(namespaceName, "GetAllCodeItemsByCodeSet", param); try { string strWhere = " codeItems.setCode='" + param.codeSet + "' "; List <CodeSetsModel> list = codeItemsBLL.GetAllModelList(strWhere); return(BLLHelpler.GetReturnBody <List <CodeSetsModel> >(ResCode.SUCCESS, ResMsg.SUCCESS, list)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <List <CodeSetsModel> >(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
/// <summary> /// 写异常信息表数据 /// </summary> /// <param name="exception"></param> public static void WriteExceptionInfo(ExceptionInfoEntity exception) { Task.Run(() =>//未找到消费线程,新建线程消费队列 { try { //只是记录日志吧 Log4netHelper.WriteErrorLogByLog4Net(typeof(Log4netHelper), JsonConvert.SerializeObject(exception)); dal.AddWithKey(exception); } catch (Exception ex) { Log4netHelper.WriteErrorLogByLog4Net(typeof(Log4netHelper), "WriteExceptionInfo记录异常表出现异常,exception:" + JsonConvert.SerializeObject(exception), ex); } }); }
/// <summary> /// 打印操作 /// </summary> /// <param name="workbook"></param> /// <param name="printInfo"></param> /// <returns></returns> public void Print(string json_cellList, PrintInfoModel printInfo, PageOrientationType orientation) { IDictionary <string, object> logDict = new Dictionary <string, object>(); logDict.Add("json_cellList", json_cellList); logDict.Add("printInfo", printInfo); logDict.Add("orientation", orientation); ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <IDictionary <string, object> >(namespaceName, "Print", logDict , "", printInfo == null ? "" : printInfo.processCardNumber, ExceptionSource.WIPPost, ExceptionLevel.BusinessError, wipSource); try { //创建文件 List <ExcelSheetModel> sheetModelList = new List <ExcelSheetModel>(); List <ExcelCellModel> cellModelList = JsonConvert.DeserializeObject <List <ExcelCellModel> >(json_cellList); ExcelSheetModel sheetModel = new ExcelSheetModel() { sheetName = this.workbook.GetSheetAt(0).SheetName, dataList = cellModelList, sheetType = "", }; sheetModelList.Add(sheetModel); byte[] bytes = ExcelUtil.writeExcelToFile(this.workbook, sheetModelList, printInfo.tempName); //修改为“打印中” var result = UpdatePrintStatusToPrinting(printInfo.id); if (!result) { throw new Exception("更新状态为打印中失败,printInfo.id:" + printInfo.id.ToString()); } PrintHelper.PrintExcel(bytes, printInfo.printerName, orientation); //打印成功 this.DoByPrintResultSuccess(printInfo); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); WipLogHelper.WriteExceptionInfo(exception); //打印失败 this.DoByPrintResultFailure(printInfo, ex); } }
/// <summary> /// 更新权限到Redis /// </summary> /// <param name="param"></param> /// <returns></returns> public ReturnBody <string> UpdateAuth() { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <string>(namespaceName, "UpdateAuth", "", "", ""); try { JwtHelp.UpdateAuthToRedis(); ReturnBody <string> ret = new ReturnBody <string>(); ret.resCode = ResCode.SUCCESS; return(ret); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
//*/ /// <summary> /// 发送邮件 /// </summary> /// <param name="param"></param> /// <returns></returns> public ReturnBody <bool> SendMail(MailParam param) { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <MailParam>(namespaceName, "SendMail", param); try { param.describe = "<p class=\"MsoNormal\"><span lang=\"EN-US\"> </span>上汽项目<span lang=\"EN-US\">,ECM</span>联调问题很多<span lang=\"EN-US\">,</span>项目已经红色预警<span lang=\"EN-US\">,</span>我们将在周末继续配合法方修正各个关键点<span lang=\"EN-US\">.<o:p></o:p></span></p>"; IMail _mail = new Mail(MailCategory.缺省); _mail.MailSending(param.mailSubject, param.describe, param.file_Path); return(BLLHelpler.GetReturnBody <bool>(ResCode.SUCCESS, ResMsg.SUCCESS, true)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <bool>(ResCode.FAILURE, ResMsg.FAILURE, exception, false)); } }
/// <summary> /// 初始化异常信息类(仅仅是获取异常信息对象) /// </summary> /// <typeparam name="T">入参类</typeparam> /// <param name="namespaceName">当前命名空间名</param> /// <param name="exceptionFun">方法名</param> /// <param name="param">入参类</param> /// <param name="exceptionSource">异常方向,默认是WIP接收</param> /// <param name="msgSource">消息来源,默认是WIPREST服务</param> /// <returns></returns> public static ExceptionInfoEntity GetExceptionInfo <T>(string namespaceName, string exceptionFun, T param, string key1 = "", string key2 = "", ExceptionSource exceptionSource = ExceptionSource.WIPReceive, ExceptionLevel exceptionLevel = ExceptionLevel.BusinessError , string msgSource = WipSource.WIPREST) { ExceptionInfoEntity exception = new ExceptionInfoEntity() { host = WIPCommon.GetHostName(msgSource), key1 = key1, key2 = key2, exceptionLevel = Convert.ToInt32(exceptionLevel).ToString(), //异常级别:默认是业务错误 exceptionFun = namespaceName + "." + exceptionFun, //异常方法名 exceptionSource = Convert.ToInt32(exceptionSource).ToString(), //异常方向 sourceData = JsonConvert.SerializeObject(param), //入参 creator = JwtHelp.GetCurUserName() }; return(exception); }
/// <summary> /// 公共校验 /// </summary> /// <typeparam name="T1"></typeparam> /// <typeparam name="T2"></typeparam> /// <param name="param"></param> /// <param name="exception"></param> /// <param name="columnsList"></param> /// <returns></returns> public static WIP_Models.ReturnBody <T2> CommonValidate <T1, T2>(T1 param, ref ExceptionInfoEntity exception, List <ValidateModel> columnsList) { ReturnBody <T2> retBody = null; if (param == null) { exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY; retBody = BLLHelpler.GetReturnBody <T2>(ResCode.PARAMETERNOEMPTY, ResMsg.PARAMETERNOEMPTY, exception); return(retBody); } ValidateResModel res = ValidateDataHelper.ValidateNullOrEmpty(columnsList); if (res != null && !res.IsValidate) { exception.exceptionMsg = res.ValidateMsg; return(BLLHelpler.GetReturnBody <T2>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg, exception)); } return(retBody); }
/// <summary> /// 获取邮件人员列表 /// </summary> /// <returns></returns> public ReturnBody <List <MailPersonModel> > GetMailPersonList(QueryMailPersonParam param) { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <string>(namespaceName, "GetMailPersonList", "", "", ""); try { if (param == null || string.IsNullOrEmpty(param.categoryId)) { return(BLLHelpler.GetReturnBody <List <MailPersonModel> >(ResCode.PARAMETERNOEMPTY, ResMsg.PARAMETERNOEMPTY, null)); } List <MailPersonModel> list = MailRuleBLL.GetInstance().GetMailPersonList(param.categoryId); return(BLLHelpler.GetReturnBody <List <MailPersonModel> >(ResCode.SUCCESS, ResMsg.SUCCESS, list)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <List <MailPersonModel> >(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
/// <summary> /// 获取权限 /// </summary> /// <param name="param"></param> /// <returns></returns> public ReturnBody <List <RedisModel> > GetAuth() { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <string>(namespaceName, "GetAuth", "", "", ""); try { List <RedisModel> redisModelList = new List <RedisModel>(); redisModelList = JwtHelp.GetAuthFormRedis(); ReturnBody <List <RedisModel> > ret = new ReturnBody <List <RedisModel> >(); ret.resCode = ResCode.SUCCESS; ret.resData = redisModelList; return(ret); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <List <RedisModel> >(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
/// <summary> /// 获取代码项表列表(分页) /// </summary> /// <returns></returns> public ReturnBody <PageResultModel <CodeItemsEntity> > GetCodeItemsList(QueryCodeItemsModel queryModel) { var strOrderBy = " codeItems.lastModifyTime DESC"; var strWhere = ""; ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <QueryCodeItemsModel>(namespaceName, "GetCodeItemsList", queryModel); try { if (queryModel != null) { if (!string.IsNullOrEmpty(queryModel.code)) { strWhere += " codeItems.code LIKE '%" + queryModel.code + "%',"; } if (!string.IsNullOrEmpty(queryModel.name)) { strWhere += " codeItems.name LIKE '%" + queryModel.name + "%',"; } if (!string.IsNullOrEmpty(queryModel.setCode)) { strWhere += " codeItems.setCode LIKE '%" + queryModel.setCode + "%',"; } if (!string.IsNullOrEmpty(queryModel.delFlag)) { strWhere += " codeItems.delFlag ='" + queryModel.delFlag + "',"; } if (!string.IsNullOrEmpty(strWhere)) { strWhere = strWhere.Substring(0, strWhere.Length - 1); } } PageResultModel <CodeItemsEntity> list = codeItemsBLL.GetModelListForPage(strOrderBy, strWhere, queryModel); return(BLLHelpler.GetReturnBody <PageResultModel <CodeItemsEntity> >(ResCode.SUCCESS, ResMsg.SUCCESS, list)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <PageResultModel <CodeItemsEntity> >(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
/// <summary> /// 更新邮箱人员 /// </summary> /// <returns></returns> public ReturnBody <string> UpdateMailPerson(UpdateMailPersonParam param) { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <UpdateMailPersonParam>(namespaceName, "UpdateMailPerson", param, "", ""); try { MethodReturnResultModel ret = MailRuleBLL.GetInstance().UpdateMailPerson(param, JwtHelp.GetCurUserName()); if (ret != null && ret.IsSuccess) { return(BLLHelpler.GetReturnBody <string>(ResCode.SUCCESS, ResMsg.SUCCESS, "")); } else { return(BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE, "")); } } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
/// <summary> /// 删除代码项表 /// </summary> /// <param name="model"></param> /// <returns></returns> public ReturnBody <bool> EnableCodeItems(QueryCodeItemsModel model) { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <QueryCodeItemsModel>(namespaceName, "DelCodeItems", model); try { #region 验证 if (model == null || model.id == 0) { exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY; return(BLLHelpler.GetReturnBody <bool>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg, exception)); } #endregion var result = codeItemsBLL.Enable(model.id.ToString(), model.delFlag, JwtHelp.GetCurUserName()); return(BLLHelpler.GetReturnBody <bool>(ResCode.SUCCESS, ResMsg.SUCCESS, result)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <bool>(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
public void MailSending(string MailSubject, string Describe, string File_Path) { #region 数据获取 try { _recipientsAddressRange = MailRuleBLL.GetInstance().GetMailPersonListRetStr(_categoryId); List <MailBaseData> mailBaseDataList = WIPDataAccess.CreateDAL <ICommonDAL>("CommonDAL").GetMailBaseData(); if (mailBaseDataList == null || mailBaseDataList.Count == 0) { throw new Exception("没有找到邮箱基础数据"); } if (mailBaseDataList.Count > 1) { throw new Exception(string.Format("配置的邮箱基础数据大于1条,请检查数据!查到的条数是{0}条", mailBaseDataList.Count.ToString())); } _MailBaseData = mailBaseDataList[0]; } catch (Exception ex) { IDictionary <string, object> logDict = new Dictionary <string, object>(); logDict.Add("MailSubject", MailSubject); logDict.Add("Describe", Describe); ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <IDictionary <string, object> >(namespaceName, "MailSending", logDict, "", ""); WipLogHelper.GetExceptionInfoForError(ex, ref exception); WipLogHelper.WriteExceptionInfo(exception); } #endregion if (string.IsNullOrEmpty(_recipientsAddressRange) || _MailBaseData == null) // 如果基础数据没有获取到,就不发邮件 { return; } this.PostMail(_MailBaseData, _recipientsAddressRange, MailSubject, Describe.ToString(), ""); }
/// <summary> /// 禁启用代码集表 /// </summary> /// <param name="model"></param> /// <returns></returns> public ReturnBody <bool> EnableCodeSets(QueryCodeSetsModel model) { ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <QueryCodeSetsModel>(namespaceName, "EnableCodeSets", model); try { #region 验证 if (model == null || string.IsNullOrEmpty(model.code)) { exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY; return(BLLHelpler.GetReturnBody <bool>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg, exception)); } #endregion string lastModifier = JwtHelp.GetCurUserName(); var result = codeSetsBLL.Enable(model.code.ToString(), model.delFlag, lastModifier); return(BLLHelpler.GetReturnBody <bool>(ResCode.SUCCESS, ResMsg.SUCCESS, result)); } catch (Exception ex) { WipLogHelper.GetExceptionInfoForError(ex, ref exception); return(BLLHelpler.GetReturnBody <bool>(ResCode.FAILURE, ResMsg.FAILURE, exception)); } }
/// <summary> /// 公共返回方法 /// </summary> /// <typeparam name="T">返回T</typeparam> /// <param name="redCode">返回编号</param> /// <param name="exception">异常信息</param> /// <param name="resMsg">返回提示</param> /// <param name="t">返回t</param> /// <returns></returns> public static ReturnBody <T> GetReturnBody <T>(string resCode, string resMsg, ExceptionInfoEntity exception, T t = default(T)) { if (resCode != ResCode.SUCCESS) { WipLogHelper.WriteExceptionInfo(exception); } return(new ReturnBody <T>() { resCode = resCode, resMsg = resMsg, resData = t }); }