/// <summary> /// 发送联络单 /// </summary> /// <param name="receiverIds">接收者</param> /// <param name="organizeIds">组织机构数组</param> /// <param name="roleIds">角色数组</param> /// <returns>影响行数</returns> public int Send(string contactId, string[] receiverIds, string[] organizeIds, string[] roleIds) { BaseUserManager userManager = new BaseUserManager(DbHelper, UserInfo); receiverIds = userManager.GetUserIds(receiverIds, organizeIds, roleIds); // 删除邮件的处理技巧、发送给部门的、发送给角色的。 // 删除邮件的列表过滤问题解决 BaseContactDetailsManager contactDetailsManager = new BaseContactDetailsManager(DbHelper, UserInfo); BaseContactDetailsEntity contactDetailsEntity = null; // 组织机构数组 if (organizeIds != null) { BaseOrganizeManager organizeManager = new BaseOrganizeManager(DbHelper, UserInfo); for (int i = 0; i < organizeIds.Length; i++) { contactDetailsEntity = new BaseContactDetailsEntity(); // 这里一定要给个不可猜测的主键,为了提高安全性 contactDetailsEntity.Id = BaseBusinessLogic.NewGuid(); contactDetailsEntity.ContactId = contactId; contactDetailsEntity.Category = "Organize"; contactDetailsEntity.ReceiverId = organizeIds[i]; contactDetailsEntity.ReceiverRealName = organizeManager.GetProperty(organizeIds[i], BaseOrganizeEntity.FieldFullName); contactDetailsEntity.IsNew = 1; contactDetailsEntity.Enabled = 1; contactDetailsEntity.NewComment = 0; contactDetailsManager.Add(contactDetailsEntity, false); } } // 角色数组 if (roleIds != null) { BaseRoleManager roleManager = new BaseRoleManager(DbHelper, UserInfo); for (int i = 0; i < roleIds.Length; i++) { contactDetailsEntity = new BaseContactDetailsEntity(); // 这里一定要给个不可猜测的主键,为了提高安全性 contactDetailsEntity.Id = BaseBusinessLogic.NewGuid(); contactDetailsEntity.ContactId = contactId; contactDetailsEntity.Category = "Role"; contactDetailsEntity.ReceiverId = roleIds[i]; contactDetailsEntity.ReceiverRealName = roleManager.GetProperty(roleIds[i], BaseRoleEntity.FieldRealName); contactDetailsEntity.IsNew = 1; contactDetailsEntity.Enabled = 1; contactDetailsEntity.NewComment = 0; contactDetailsManager.Add(contactDetailsEntity, false); } } return(this.Send(contactId, receiverIds)); }
/// <summary> /// 发送联络单 /// </summary> /// <param name="receiverIds">接收者</param> /// <param name="organizeIds">组织机构数组</param> /// <param name="roleIds">角色数组</param> /// <returns>影响行数</returns> public int Send(string contactId, string[] receiverIds, string[] organizeIds, string[] roleIds) { BaseUserManager userManager = new BaseUserManager(DbHelper, UserInfo); receiverIds = userManager.GetUserIds(receiverIds, organizeIds, roleIds); // 删除邮件的处理技巧、发送给部门的、发送给角色的。 // 删除邮件的列表过滤问题解决 BaseContactDetailsManager contactDetailsManager = new BaseContactDetailsManager(DbHelper, UserInfo); BaseContactDetailsEntity contactDetailsEntity = null; // 组织机构数组 if (organizeIds != null) { BaseOrganizeManager organizeManager = new BaseOrganizeManager(DbHelper, UserInfo); for (int i = 0; i < organizeIds.Length; i++) { contactDetailsEntity = new BaseContactDetailsEntity(); // 这里一定要给个不可猜测的主键,为了提高安全性 contactDetailsEntity.Id = BaseBusinessLogic.NewGuid(); contactDetailsEntity.ContactId = contactId; contactDetailsEntity.Category = "Organize"; contactDetailsEntity.ReceiverId = organizeIds[i]; contactDetailsEntity.ReceiverRealName = organizeManager.GetProperty(organizeIds[i], BaseOrganizeEntity.FieldFullName); contactDetailsEntity.IsNew = 1; contactDetailsEntity.Enabled = 1; contactDetailsEntity.NewComment = 0; contactDetailsManager.Add(contactDetailsEntity, false); } } // 角色数组 if (roleIds != null) { BaseRoleManager roleManager = new BaseRoleManager(DbHelper, UserInfo); for (int i = 0; i < roleIds.Length; i++) { contactDetailsEntity = new BaseContactDetailsEntity(); // 这里一定要给个不可猜测的主键,为了提高安全性 contactDetailsEntity.Id = BaseBusinessLogic.NewGuid(); contactDetailsEntity.ContactId = contactId; contactDetailsEntity.Category = "Role"; contactDetailsEntity.ReceiverId = roleIds[i]; contactDetailsEntity.ReceiverRealName = roleManager.GetProperty(roleIds[i], BaseRoleEntity.FieldRealName); contactDetailsEntity.IsNew = 1; contactDetailsEntity.Enabled = 1; contactDetailsEntity.NewComment = 0; contactDetailsManager.Add(contactDetailsEntity, false); } } return this.Send(contactId, receiverIds); }