using HcUtility.Comm; using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Web; namespace DSWeb.Areas.MvcShipping.DB { public class DingTalkContext : DbContext { public DingTalkContext() : base("DongShengDB") { } public DbSet Users { get; set; } public DbSet ParamSets { get; set; } public SysParamSet pAgentid { get; set; } public DBResult CanUse() { var result = new DBResult(); pAgentid = ParamSets.FirstOrDefault(p => p.PARAMNAME == "DingTalkAgentid"); if (pAgentid == null || string.IsNullOrWhiteSpace(pAgentid.PARAMVALUE)) { //throw new Exception("钉钉Agentid参数配置错误"); result.SetErrorInfo("钉钉Agentid参数配置错误"); } else { result.OK(); } return result; } } }