public SystemGeneralModel(ConfigureClassEnum ConfigureClass) { string strConfigureClass = ConfigureClass.ToString(); SystemGeneralModel _SystemGeneralModel = GetConfigure(strConfigureClass); this.ConfigureClass = _SystemGeneralModel.ConfigureClass; this.ConfigureContent = _SystemGeneralModel.ConfigureContent; }
public static SystemGeneralModel GetConfigure(string strConfigureClass) { SystemGeneralModel _SystemGeneralModel = new SystemGeneralModel(); using (var context = new EG_MagicCubeEntities()) { if (context.SystemConfigure.Count() > 0) { _SystemGeneralModel = context.SystemConfigure.AsQueryable().Where(c => c.ConfigureName == strConfigureClass).Select(c => new SystemGeneralModel() { ConfigureClass = c.ConfigureName, ConfigureContent = c.ConfigureValue }).FirstOrDefault(); } if (_SystemGeneralModel == null) { _SystemGeneralModel = new SystemGeneralModel(); _SystemGeneralModel.ConfigureClass = strConfigureClass; } } return(_SystemGeneralModel); }