纽威
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.8 KiB

3 years ago
  1. using NFine.Domain.Entity.SystemManage;
  2. using NFine.Repository;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace NFine.Application.SystemManage
  10. {
  11. public class MailApp : RepositoryFactory<ItemsEntity>
  12. {
  13. public string MailServer { get; set; }
  14. /// <summary>
  15. /// 用户名
  16. /// </summary>
  17. public string MailUserName { get; set; }
  18. /// <summary>
  19. /// 密码
  20. /// </summary>
  21. public string MailPassword { get; set; }
  22. /// <summary>
  23. /// 名称
  24. /// </summary>
  25. public string MailName { get; set; }
  26. /// <summary>
  27. /// 端口
  28. /// </summary>
  29. public int Post { get; set; }
  30. public MailApp(string ItemType,string ItemDetailType)
  31. {
  32. string sql = @"select top 1 F_Define1 mailFrom,F_Define2 Password,F_Define3 MailServer ,F_Define4 Post,detail.F_ItemName Name
  33. from Sys_SRM_Items item
  34. left join Sys_SRM_ItemsDetail detail on detail.F_ItemId=item.F_Id
  35. where item.F_EnCode='" + ItemType + @"' and detail.F_ItemCode='" + ItemDetailType + @"'";
  36. DataTable dt = Repository().FindTableBySql(sql);
  37. if (dt != null && dt.Rows.Count > 0)
  38. {
  39. MailServer = dt.Rows[0]["MailServer"].ToString();
  40. MailUserName = dt.Rows[0]["mailFrom"].ToString();
  41. MailPassword = dt.Rows[0]["Password"].ToString();
  42. MailName = dt.Rows[0]["Name"].ToString();
  43. Post = Convert.ToInt32(dt.Rows[0]["Post"].ToString());
  44. }
  45. }
  46. }
  47. }