using DeviceRepair.DataAccess.Data; using DeviceRepair.Models.Common; using DeviceRepair.Utils; using NLog; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; namespace DeviceRepair.DataAccess.SysCommon { public class EmailConfigDa : BaseDa { private static readonly Logger log = LogManager.GetCurrentClassLogger(); public EmailConfigDa(IDictionary apiParams) : base(apiParams) { } public DataSet GetDatas() { DataSet dsDatas = new DataSet("Datas"); try { if (!ApiParameters.ContainsKey("ModuleCode")) { throw new ArgumentException($"邮件模块编码不能为空!"); } string ModuleCode = ApiParameters["ModuleCode"]?.Trim(); SysEmailConfigInfo Datas = devMain.Queryable().First(x => x.MuduleCode == ModuleCode); DataTable table = Datas.toDataTable(); dsDatas.Tables.Add(table); return dsDatas; } catch (SqlException sqlEx) { throw sqlEx; } catch (Exception ex) { log.Error(ex); throw ex; } } } }