/// <summary> /// 更新邮箱人员 /// </summary> /// <param name="param"></param> /// <param name="lastModifier"></param> /// <returns></returns> public MethodReturnResultModel UpdateMailPerson(UpdateMailPersonParam param, string lastModifier) { MethodReturnResultModel funRes = null; try { #region 准备数据 string truncateSql = " DELETE udtWip_MailPerson WHERE categoryId='" + param.categoryId + "' "; string insertSql = ""; #endregion using (SqlConnection conn = new SqlConnection(SQLServerHelper.connectionString)) { conn.Open(); using (SqlTransaction trans = conn.BeginTransaction()) { TransactionModel transModel = new TransactionModel() { conn = conn, trans = trans }; try { SQLServerHelper.ExecuteSql(truncateSql, transModel); foreach (var item in param.mailPersonParamList) { insertSql = @" INSERT INTO udtWip_MailPerson(categoryId,mailAddress,mailName,creator,createTime,lastModifier,lastModifyTime) SELECT '" + param.categoryId + "','" + item.mailAddress + "','" + item.mailName + "','" + lastModifier + "',getdate(),'" + lastModifier + "',GETDATE() "; SQLServerHelper.ExecuteSql(insertSql, transModel); } funRes = new MethodReturnResultModel() { IsSuccess = true }; trans.Commit(); } catch { trans.Rollback(); throw; } } } } catch (Exception) { throw; } return(funRes); }
/// <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)); } }